From: Michael Jeanson Date: Thu, 12 May 2016 15:01:18 +0000 (-0400) Subject: Tests: Replace prove by autotools tap runner X-Git-Tag: v2.9.0-rc1~109 X-Git-Url: https://git.lttng.org/?p=lttng-ust.git;a=commitdiff_plain;h=f3c7428e8878c6e467020881813c018e0d530a21 Tests: Replace prove by autotools tap runner This patch removes the dependency on the prove perl script to run the TAP test suite. It replaces it with the autotools shell TAP driver that only requires a shell and awk. Custom arguments can be passed to the test runner with env variables as follow: env LOG_DRIVER_FLAGS='--comments --ignore-exit' \ TESTS='foo.test baz.test' make -e check This tap driver also creates a log file for each test that can then be used by another system to build a test report. Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/.gitignore b/.gitignore index 78cba0dc..a5c33fb5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ *.swp *.o *.swo +*.trs +*.log Makefile .libs/ .deps/ @@ -61,6 +63,8 @@ tests/ust-elf/prog tests/ust-elf/test_ust_elf tests/benchmark/bench1 tests/benchmark/bench2 +tests/ctf-types/ctf-types +tests/test-app-ctx/hello # Java agent library *.class diff --git a/Makefile.am b/Makefile.am index 5bb53112..1db74801 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,3 +36,7 @@ pkgconfig_DATA = lttng-ust.pc dist_doc_DATA = README.md ChangeLog dist_noinst_DATA = CodingStyle + +check-loop: + cd tests && $(MAKE) $(AM_MAKEFLAGS) check-loop +.PHONY: check-loop diff --git a/configure.ac b/configure.ac index 74153731..26c3b1d7 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,8 @@ AM_MAINTAINER_MODE([enable]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_SRCDIR([include/lttng/tracepoint.h]) +AC_REQUIRE_AUX_FILE([tap-driver.sh]) + # Configuration options, which will be installed in the config.h AC_CONFIG_HEADERS([config.h include/lttng/ust-config.h]) AH_TEMPLATE([LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS], [Use efficient unaligned access.]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 377acd67..96a3faae 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -5,23 +5,18 @@ if CXX_WORKS SUBDIRS += hello.cxx endif -SCRIPT_LIST = test_loop run.sh unit_tests +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/config/tap-driver.sh -dist_noinst_SCRIPTS = $(SCRIPT_LIST) +TESTS = snprintf/test_snprintf \ + ust-elf/test_ust_elf -all-local: - @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ - for script in $(SCRIPT_LIST); do \ - cp -f $(srcdir)/$$script $(builddir); \ - done; \ - fi +check-loop: + while [ 0 ]; do \ + $(MAKE) $(AM_MAKEFLAGS) check; \ + if [ "$$?" != "0" ]; then \ + break; \ + fi \ + done -clean-local: - @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ - for script in $(SCRIPT_LIST); do \ - rm -f $(builddir)/$$script; \ - done; \ - fi - -check-am: - ./run.sh unit_tests +.PHONY: check-loop diff --git a/tests/README b/tests/README index 5f1da32f..5f7bcc20 100644 --- a/tests/README +++ b/tests/README @@ -1,10 +1,10 @@ Using the ust test suite. Running - ./run.sh unit_tests + make check runs all the tests once. Running - ./test_loop + make check-loop runs the test in a loop. This is useful to check for errors that would not always happen. diff --git a/tests/run.sh b/tests/run.sh deleted file mode 100755 index c6c50fd9..00000000 --- a/tests/run.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2013 - Christian Babeux -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; only version 2 -# of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -[ -z "$1" ] && echo "Error: No testlist. Please specify a testlist to run." && exit 1 - -prove --merge --exec '' - < $1 diff --git a/tests/test_loop b/tests/test_loop deleted file mode 100755 index be3e16c4..00000000 --- a/tests/test_loop +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -DIR=$(dirname $0) - -while [ 0 ]; do - $DIR/run.sh $DIR/unit_tests - if [ "$?" != "0" ]; then - break; - fi -done - -echo "$0: ********* STOPPED BECAUSE OF ERROR *********" diff --git a/tests/unit_tests b/tests/unit_tests deleted file mode 100644 index 4d69789b..00000000 --- a/tests/unit_tests +++ /dev/null @@ -1,2 +0,0 @@ -snprintf/test_snprintf -ust-elf/test_ust_elf