summaryrefslogtreecommitdiffstats
path: root/src/external
diff options
context:
space:
mode:
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>2014-11-24 19:13:16 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-05-28 13:55:52 +0200
commit9d453f1e8b28983b363b44c49b7cd701a994fd97 (patch)
treef681e8183b68cfcca3e7b618b119238489b46cce /src/external
parent9c5e4ae08ea41f9b1cdb3b3d0e9c35056baeab86 (diff)
downloadsssd-9d453f1e8b28983b363b44c49b7cd701a994fd97.tar.gz
sssd-9d453f1e8b28983b363b44c49b7cd701a994fd97.tar.xz
sssd-9d453f1e8b28983b363b44c49b7cd701a994fd97.zip
Add integration tests
Add "intgcheck" make target. Update CI to use it. The "intgcheck" target configures and builds sssd in a sub-directory, installs it into a prefix in another sub-directory, and then makes the "intgcheck-installed" target from within src/tests/intg in that separate build. The "intgcheck-installed" target in src/tests/intg runs py.test for all tests it can find in that directory, under fakeroot and nss_wrapper/uid_wrapper environments emulating running under root. It also adds the value of INTGCHECK_PYTEST_ARGS environment/make variable to the py.test command line. You can use it to pass additional py.test options, such as specifying a subset of tests to run. See "py.test --help" output. There are only two test suites in src/tests/intg at the moment: ent_test.py and ldap_test.py. The ent_test.py runs tests on ent.py - a module of assertion functions for checking entries in NSS database (passwd and group), for use in actual tests. The ent_test.py suite can be used as ent.py usage reference. The ldap_test.py suite sets up and starts a slapd instance, adds a few user and group entries, configures and starts sssd and verifies that those users and groups are retrieved correctly using various NSS functions. The tests are very basic at the moment. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> Reviewed-by: Michal Židek <mzidek@redhat.com>
Diffstat (limited to 'src/external')
-rw-r--r--src/external/cwrap.m47
-rw-r--r--src/external/intgcheck.m432
-rw-r--r--src/external/ldap.m44
3 files changed, 39 insertions, 4 deletions
diff --git a/src/external/cwrap.m4 b/src/external/cwrap.m4
index 0bd0bc9c9..b03d1ef00 100644
--- a/src/external/cwrap.m4
+++ b/src/external/cwrap.m4
@@ -4,20 +4,19 @@ dnl AM_CHECK_WRAPPER(name, conditional)
dnl If the cwrap library is found, sets the HAVE_$name conditional
AC_DEFUN([AM_CHECK_WRAPPER],
[
- FOUND_WRAPPER=0
-
AC_MSG_CHECKING([for $1])
PKG_CHECK_EXISTS([$1],
[
AC_MSG_RESULT([yes])
- FOUND_WRAPPER=1
+ AC_SUBST([$2], [yes])
],
[
AC_MSG_RESULT([no])
+ AC_SUBST([$2], [no])
AC_MSG_WARN([cwrap library $1 not found, some tests will not run])
])
- AM_CONDITIONAL($2, [ test x$FOUND_WRAPPER = x1])
+ AM_CONDITIONAL($2, [ test x$2 = xyes])
])
AC_DEFUN([AM_CHECK_UID_WRAPPER],
diff --git a/src/external/intgcheck.m4 b/src/external/intgcheck.m4
new file mode 100644
index 000000000..80d41b599
--- /dev/null
+++ b/src/external/intgcheck.m4
@@ -0,0 +1,32 @@
+AC_CHECK_PROG([HAVE_FAKEROOT], [fakeroot], [yes], [no])
+
+AC_PATH_PROG([PYTEST], [py.test])
+AS_IF([test -n "$PYTEST"], [HAVE_PYTEST=yes], [HAVE_PYTEST=no])
+
+dnl Check for variable and fail unless value is "yes"
+dnl The second argument will be printed in error message in case of error
+dnl Usage:
+dnl SSS_INTGCHECK_REQ(variable, message)
+
+AC_DEFUN([SSS_INTGCHECK_REQ], [
+ AS_IF([test x$$1 = xyes], , [
+ AC_MSG_ERROR([cannot enable integration tests: $2 not found])])
+])
+
+AC_DEFUN([SSS_ENABLE_INTGCHECK_REQS], [
+ AC_ARG_ENABLE(intgcheck-reqs,
+ [AS_HELP_STRING([--enable-intgcheck-reqs],
+ [enable checking for integration test requirements [default=no]])],
+ [enable_intgcheck_reqs="$enableval"],
+ [enable_intgcheck_reqs="no"])
+ if test x"$enable_intgcheck_reqs" = xyes; then
+ SSS_INTGCHECK_REQ([HAVE_UID_WRAPPER], [uid_wrapper])
+ SSS_INTGCHECK_REQ([HAVE_NSS_WRAPPER], [nss_wrapper])
+ SSS_INTGCHECK_REQ([HAVE_SLAPD], [slapd])
+ SSS_INTGCHECK_REQ([HAVE_LDAPMODIFY], [ldapmodify])
+ SSS_INTGCHECK_REQ([HAVE_FAKEROOT], [fakeroot])
+ SSS_INTGCHECK_REQ([HAVE_PYTHON2], [python2])
+ SSS_INTGCHECK_REQ([HAVE_PYTEST], [pytest])
+ SSS_INTGCHECK_REQ([HAVE_PY2MOD_LDAP], [python-ldap])
+ fi
+])
diff --git a/src/external/ldap.m4 b/src/external/ldap.m4
index 3a99ddfcc..43a01efae 100644
--- a/src/external/ldap.m4
+++ b/src/external/ldap.m4
@@ -90,3 +90,7 @@ AC_CHECK_TYPE([LDAPDerefRes],
CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS
+AC_PATH_PROG([SLAPD], [slapd], ,
+ [$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR])
+AS_IF([test -n "$SLAPD"], [HAVE_SLAPD=yes], [HAVE_SLAPD=no])
+AC_CHECK_PROG([HAVE_LDAPMODIFY], [ldapmodify], [yes], [no])