From fe3e32c0344c10ae2a0add512b409f3ee553a052 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 14 May 2015 14:45:57 +0200 Subject: [PATCH] tests: use the TAP formatter The test results in standard format are easily integrated into CI systems. (cherry picked from commit 6463ce5dd9ffc1aae3ca9ddc4dac4e25fd815237) --- callouts/tests/Makefile.am | 2 ++ configure.ac | 1 + libnm-core/tests/Makefile.am | 2 ++ libnm-glib/tests/Makefile.am | 2 ++ libnm-util/tests/Makefile.am | 2 ++ libnm/tests/Makefile.am | 2 ++ src/devices/wifi/tests/Makefile.am | 2 ++ src/dhcp-manager/tests/Makefile.am | 2 ++ src/dnsmasq-manager/tests/Makefile.am | 2 ++ src/platform/tests/Makefile.am | 3 ++- src/rdisc/tests/Makefile.am | 2 ++ src/settings/plugins/ibft/tests/Makefile.am | 2 ++ src/settings/plugins/ifcfg-rh/tests/Makefile.am | 2 ++ src/settings/plugins/ifupdown/tests/Makefile.am | 2 ++ src/settings/plugins/keyfile/tests/Makefile.am | 2 ++ src/supplicant-manager/tests/Makefile.am | 2 ++ src/tests/Makefile.am | 2 ++ src/tests/config/Makefile.am | 2 ++ tools/run-test-valgrind.sh | 4 ++-- 19 files changed, 37 insertions(+), 3 deletions(-) diff --git a/callouts/tests/Makefile.am b/callouts/tests/Makefile.am index fface33db3..89b2dd9016 100644 --- a/callouts/tests/Makefile.am +++ b/callouts/tests/Makefile.am @@ -29,6 +29,8 @@ test_dispatcher_envp_LDADD = \ ########################################### @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-dispatcher-envp endif diff --git a/configure.ac b/configure.ac index 44292e1ad8..76d9de5238 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,7 @@ AC_INIT([NetworkManager], [nm_version], AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) +AC_REQUIRE_AUX_FILE([tap-driver.sh]) AM_INIT_AUTOMAKE(1.12 tar-ustar no-dist-gzip dist-bzip2 -Wno-portability) dnl NB: Do not [quote] this parameter. AM_MAINTAINER_MODE([enable]) diff --git a/libnm-core/tests/Makefile.am b/libnm-core/tests/Makefile.am index 79aa73dbf9..6b79dba80b 100644 --- a/libnm-core/tests/Makefile.am +++ b/libnm-core/tests/Makefile.am @@ -25,6 +25,8 @@ LDADD = \ $(GLIB_LIBS) @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = $(noinst_PROGRAMS) endif diff --git a/libnm-glib/tests/Makefile.am b/libnm-glib/tests/Makefile.am index 7168d3dd15..a01a50e724 100644 --- a/libnm-glib/tests/Makefile.am +++ b/libnm-glib/tests/Makefile.am @@ -17,6 +17,8 @@ if WITH_VALGRIND else LOG_COMPILER = $(srcdir)/libnm-glib-test-launch.sh endif +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-nm-client test-remote-settings-client ####### NMClient and non-settings tests ####### diff --git a/libnm-util/tests/Makefile.am b/libnm-util/tests/Makefile.am index 16a7f8f3fc..f90fe8bf6e 100644 --- a/libnm-util/tests/Makefile.am +++ b/libnm-util/tests/Makefile.am @@ -11,6 +11,8 @@ AM_CPPFLAGS = \ -DTEST_CERT_DIR=\"$(top_srcdir)/libnm-core/tests/certs/\" @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = \ test-settings-defaults \ test-crypto \ diff --git a/libnm/tests/Makefile.am b/libnm/tests/Makefile.am index a2dafec768..0e7db21b66 100644 --- a/libnm/tests/Makefile.am +++ b/libnm/tests/Makefile.am @@ -22,6 +22,8 @@ if WITH_VALGRIND else LOG_COMPILER = $(srcdir)/libnm-test-launch.sh endif +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-nm-client test-remote-settings-client test-secret-agent test_nm_client_SOURCES = \ diff --git a/src/devices/wifi/tests/Makefile.am b/src/devices/wifi/tests/Makefile.am index 2a7d784970..72dc7189bd 100644 --- a/src/devices/wifi/tests/Makefile.am +++ b/src/devices/wifi/tests/Makefile.am @@ -24,5 +24,7 @@ test_wifi_ap_utils_SOURCES = \ test_wifi_ap_utils_LDADD = $(top_builddir)/src/libNetworkManager.la @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-wifi-ap-utils diff --git a/src/dhcp-manager/tests/Makefile.am b/src/dhcp-manager/tests/Makefile.am index 8aa79a29be..2fb39e0417 100644 --- a/src/dhcp-manager/tests/Makefile.am +++ b/src/dhcp-manager/tests/Makefile.am @@ -38,6 +38,8 @@ test_dhcp_utils_LDADD = \ ################################# @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-dhcp-dhclient test-dhcp-utils EXTRA_DIST = \ diff --git a/src/dnsmasq-manager/tests/Makefile.am b/src/dnsmasq-manager/tests/Makefile.am index b51de6aa5d..ed1225549d 100644 --- a/src/dnsmasq-manager/tests/Makefile.am +++ b/src/dnsmasq-manager/tests/Makefile.am @@ -20,5 +20,7 @@ test_dnsmasq_utils_LDADD = \ $(top_builddir)/src/libNetworkManager.la @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-dnsmasq-utils diff --git a/src/platform/tests/Makefile.am b/src/platform/tests/Makefile.am index 081023c63d..bc032d212e 100644 --- a/src/platform/tests/Makefile.am +++ b/src/platform/tests/Makefile.am @@ -109,8 +109,9 @@ test_cleanup_linux_CPPFLAGS = \ -DKERNEL_HACKS=1 test_cleanup_linux_LDADD = $(PLATFORM_LDADD) - @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = \ test-address-fake \ test-address-linux \ diff --git a/src/rdisc/tests/Makefile.am b/src/rdisc/tests/Makefile.am index 5d6f8b5bcb..e10b34f003 100644 --- a/src/rdisc/tests/Makefile.am +++ b/src/rdisc/tests/Makefile.am @@ -33,5 +33,7 @@ test_rdisc_fake_LDADD = \ $(top_builddir)/src/libNetworkManager.la @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-rdisc-fake diff --git a/src/settings/plugins/ibft/tests/Makefile.am b/src/settings/plugins/ibft/tests/Makefile.am index 3c7c94accd..e7285e0e95 100644 --- a/src/settings/plugins/ibft/tests/Makefile.am +++ b/src/settings/plugins/ibft/tests/Makefile.am @@ -33,6 +33,8 @@ test_ibft_LDADD = \ $(top_builddir)/src/libNetworkManager.la @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-ibft endif diff --git a/src/settings/plugins/ifcfg-rh/tests/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/Makefile.am index a3f6a05204..f629830813 100644 --- a/src/settings/plugins/ifcfg-rh/tests/Makefile.am +++ b/src/settings/plugins/ifcfg-rh/tests/Makefile.am @@ -48,6 +48,8 @@ test_ifcfg_rh_utils_LDADD = \ $(top_builddir)/src/libNetworkManager.la @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-ifcfg-rh-utils test-ifcfg-rh endif diff --git a/src/settings/plugins/ifupdown/tests/Makefile.am b/src/settings/plugins/ifupdown/tests/Makefile.am index 2e927db931..e43a5113df 100644 --- a/src/settings/plugins/ifupdown/tests/Makefile.am +++ b/src/settings/plugins/ifupdown/tests/Makefile.am @@ -25,6 +25,8 @@ test_ifupdown_LDADD = \ # TODO: enable valgrind for ifupdown. Currently it fails. #@VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-ifupdown endif diff --git a/src/settings/plugins/keyfile/tests/Makefile.am b/src/settings/plugins/keyfile/tests/Makefile.am index a79e20b5b6..dffa276eb0 100644 --- a/src/settings/plugins/keyfile/tests/Makefile.am +++ b/src/settings/plugins/keyfile/tests/Makefile.am @@ -35,6 +35,8 @@ test_keyfile_LDADD = \ $(CODE_COVERAGE_LDFLAGS) @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-keyfile endif diff --git a/src/supplicant-manager/tests/Makefile.am b/src/supplicant-manager/tests/Makefile.am index 85268dcff9..d53b7ff4c7 100644 --- a/src/supplicant-manager/tests/Makefile.am +++ b/src/supplicant-manager/tests/Makefile.am @@ -19,4 +19,6 @@ test_supplicant_config_LDADD = \ $(top_builddir)/src/libNetworkManager.la @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-supplicant-config diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index a96d1ce910..85d6d4cad9 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -87,6 +87,8 @@ EXTRA_DIST = test-secret-agent.py ########################################### @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = \ test-ip4-config \ test-ip6-config \ diff --git a/src/tests/config/Makefile.am b/src/tests/config/Makefile.am index 42c6b9a1b0..5936624cea 100644 --- a/src/tests/config/Makefile.am +++ b/src/tests/config/Makefile.am @@ -24,6 +24,8 @@ test_config_LDADD = \ $(top_builddir)/src/libNetworkManager.la @VALGRIND_RULES@ +AM_TESTS_FD_REDIRECT = --tap +LOG_DRIVER = $(top_srcdir)/build-aux/tap-driver.sh TESTS = test-config EXTRA_DIST = \ diff --git a/tools/run-test-valgrind.sh b/tools/run-test-valgrind.sh index f9f9646eb9..e723d75fbc 100755 --- a/tools/run-test-valgrind.sh +++ b/tools/run-test-valgrind.sh @@ -9,7 +9,7 @@ if [ "$1" = "--launch-dbus" ]; then trap "kill $DBUS_SESSION_BUS_PID" EXIT shift fi -TEST="$1"; shift +TEST="$1" if [ "$NMTST_NO_VALGRIND" != "" ]; then "$TEST" @@ -27,7 +27,7 @@ $LIBTOOL --mode=execute "$VALGRIND" \ --gen-suppressions=all \ --suppressions="$SUPPRESSIONS" \ --log-file="$LOGFILE" \ - "$TEST" + "$@" RESULT=$? if [ $RESULT -eq 0 -a "$(wc -c "$LOGFILE" | awk '{print$1}')" -ne 0 ]; then