Tests: Replace prove by autotools tap runner
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 12 May 2016 15:01:18 +0000 (11:01 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 12 May 2016 15:57:22 +0000 (11:57 -0400)
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 <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
.gitignore
Makefile.am
configure.ac
tests/Makefile.am
tests/README
tests/run.sh [deleted file]
tests/test_loop [deleted file]
tests/unit_tests [deleted file]

index 78cba0dc782c92363e3ba386d6144958656f263a..a5c33fb5416b2bef8f3338ba8f5425b5a065358c 100644 (file)
@@ -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
index 5bb531128f932d213a199a34bb5be6d49826ce71..1db748019f117b631661cf3be381ac107b4f8249 100644 (file)
@@ -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
index 7415373190441e0e138b1091ef36ec99b1828bca..26c3b1d7a4caf38c573f79366eea88d60cb180f1 100644 (file)
@@ -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.])
index 377acd676aeb7a46b4db32a6f793e24d831ca881..96a3faae6b69427527a87b52bdb70c4cbf0af206 100644 (file)
@@ -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
index 5f1da32f88b83a0a7879c43be10d04c49f56885b..5f7bcc202b57657a0609a6b8a4b15a628e5f7b55 100644 (file)
@@ -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 (executable)
index c6c50fd..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2013 - Christian Babeux <christian.babeux@efficios.com>
-#
-# 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 (executable)
index be3e16c..0000000
+++ /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 (file)
index 4d69789..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-snprintf/test_snprintf
-ust-elf/test_ust_elf
This page took 0.028427 seconds and 4 git commands to generate.