From 1556e6dec3196c296cf3415fce2a36b828f015e0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 8 Jun 2011 17:39:41 +0100 Subject: [PATCH 1/2] Add support for installing most of the modular tests --- configure.ac | 7 +++++++ test/Makefile.am | 30 ++++++++++++++++++++++++++---- test/dbus-test-runner | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 4 deletions(-) create mode 100755 test/dbus-test-runner diff --git a/configure.ac b/configure.ac index 7f9a059..9065baa 100644 --- a/configure.ac +++ b/configure.ac @@ -211,6 +211,13 @@ fi AM_CONDITIONAL([DBUS_ENABLE_MODULAR_TESTS], [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 AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode]) fi diff --git a/test/Makefile.am b/test/Makefile.am index a9db388..8237fde 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -70,13 +70,20 @@ shell_test_LDFLAGS=@R_DYNAMIC_LDFLAG@ spawn_test_LDADD=$(TEST_LIBS) 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-dbus-daemon \ test-loopback \ - test-relay + test-relay \ + $(NULL) + +modular_tests = \ + test-dbus-daemon installcheck_tests = installcheck_environment = \ @@ -121,12 +128,27 @@ test_dbus_daemon_LDADD = $(top_builddir)/dbus/libdbus-1.la \ if DBUS_ENABLE_MODULAR_TESTS noinst_PROGRAMS += $(modular_tests) TESTS += $(modular_tests) +TESTS += $(installable_tests) +installcheck_tests += $(installable_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 installcheck-local: $(MAKE) check-TESTS TESTS='$$(installcheck_tests)' \ 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 TESTDIRS= \ diff --git a/test/dbus-test-runner b/test/dbus-test-runner new file mode 100755 index 0000000..a3dc396 --- /dev/null +++ b/test/dbus-test-runner @@ -0,0 +1,43 @@ +#!/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 -- 1.7.5.3