Commit a2f3b175 authored by Simon McVittie's avatar Simon McVittie

Add support for installing most of the modular tests

Reviewed-by: Will Thompson's avatarWill Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570
parent f43d76a8
...@@ -211,6 +211,13 @@ fi ...@@ -211,6 +211,13 @@ fi
AM_CONDITIONAL([DBUS_ENABLE_MODULAR_TESTS], AM_CONDITIONAL([DBUS_ENABLE_MODULAR_TESTS],
[test "x$enable_modular_tests" = xyes]) [test "x$enable_modular_tests" = xyes])
AC_ARG_ENABLE([installed-tests],
AS_HELP_STRING([--enable-installed-tests],
[enable unit test code in the library and binaries]),
[], [enable_installed_tests=no])
AM_CONDITIONAL([DBUS_ENABLE_INSTALLED_TESTS],
[test "x$enable_installed_tests" = xyes])
if test x$enable_verbose_mode = xyes; then if test x$enable_verbose_mode = xyes; then
AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode]) AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
fi fi
......
...@@ -70,13 +70,20 @@ shell_test_LDFLAGS=@R_DYNAMIC_LDFLAG@ ...@@ -70,13 +70,20 @@ shell_test_LDFLAGS=@R_DYNAMIC_LDFLAG@
spawn_test_LDADD=$(TEST_LIBS) spawn_test_LDADD=$(TEST_LIBS)
spawn_test_LDFLAGS=@R_DYNAMIC_LDFLAG@ spawn_test_LDFLAGS=@R_DYNAMIC_LDFLAG@
EXTRA_DIST= EXTRA_DIST = dbus-test-runner
modular_tests = \ testexecdir = $(libdir)/dbus-1.0/test
testexec_PROGRAMS =
installable_tests = \
test-corrupt \ test-corrupt \
test-dbus-daemon \
test-loopback \ test-loopback \
test-relay test-relay \
$(NULL)
modular_tests = \
test-dbus-daemon
installcheck_tests = installcheck_tests =
installcheck_environment = \ installcheck_environment = \
...@@ -121,12 +128,27 @@ test_dbus_daemon_LDADD = $(top_builddir)/dbus/libdbus-1.la \ ...@@ -121,12 +128,27 @@ test_dbus_daemon_LDADD = $(top_builddir)/dbus/libdbus-1.la \
if DBUS_ENABLE_MODULAR_TESTS if DBUS_ENABLE_MODULAR_TESTS
noinst_PROGRAMS += $(modular_tests) noinst_PROGRAMS += $(modular_tests)
TESTS += $(modular_tests) TESTS += $(modular_tests)
TESTS += $(installable_tests)
installcheck_tests += $(installable_tests)
installcheck_tests += $(modular_tests) installcheck_tests += $(modular_tests)
if DBUS_ENABLE_INSTALLED_TESTS
testexec_PROGRAMS += $(installable_tests)
else !DBUS_ENABLE_INSTALLED_TESTS
testexec_PROGRAMS += $(installable_tests)
endif !DBUS_ENABLE_INSTALLED_TESTS
endif DBUS_ENABLE_MODULAR_TESTS endif DBUS_ENABLE_MODULAR_TESTS
installcheck-local: installcheck-local:
$(MAKE) check-TESTS TESTS='$$(installcheck_tests)' \ $(MAKE) check-TESTS TESTS='$$(installcheck_tests)' \
TESTS_ENVIRONMENT='$$(installcheck_environment)' TESTS_ENVIRONMENT='$$(installcheck_environment)'
if DBUS_ENABLE_INSTALLED_TESTS
$(installcheck_environment) \
$(srcdir)/dbus-test-runner \
$(testexecdir) \
$(testexec_PROGRAMS)
endif DBUS_ENABLE_INSTALLED_TESTS
## keep these in creation order, i.e. uppermost dirs first ## keep these in creation order, i.e. uppermost dirs first
TESTDIRS= \ TESTDIRS= \
......
#!/bin/sh
set -e
dir="$1"
shift
if ! test -d "$dir"; then
echo "Usage: dbus-test-runner directory [executable...]"
exit 0
fi
passed=0
failed=0
skipped=0
for prog in "$@"; do
e=0
"$dir/$prog" || e=$?
case $e in
(0)
echo "PASS: $prog"
passed=`expr $passed + 1`
;;
(77)
echo "SKIP: $prog"
skipped=`expr $skipped + 1`
;;
(*)
echo "FAIL: $prog"
failed=`expr $failed + 1`
;;
esac
done
if test $failed = 0; then
# avoid saying "FAIL", to make it easy to grep results!
echo "PASSED $passed / SKIPPED $skipped"
exit 0
else
echo "PASSED $passed / FAILED $failed / SKIPPED $skipped"
exit 1
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment