From 022dd2b409eb3126f414986c91db128d79f1ee9b Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Fri, 29 Apr 2016 14:35:06 -0400 Subject: [PATCH] Tests: Replace prove by autotools tap runner MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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: Jérémie Galarneau --- .gitignore | 1 + configure.ac | 2 ++ tests/Makefile.am | 41 ++++++++++++++--------------------------- tests/run.sh | 22 ---------------------- tests/tests | 7 ------- tests/tests_debuginfo | 2 -- 6 files changed, 17 insertions(+), 58 deletions(-) delete mode 100755 tests/run.sh delete mode 100644 tests/tests delete mode 100644 tests/tests_debuginfo diff --git a/.gitignore b/.gitignore index 177307d1..3bb772be 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ .libs .deps *.bkp +*.trs ctf-lexer.c ctf-parser.c ctf-parser.h diff --git a/configure.ac b/configure.ac index 193504ac..d2245d1a 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,8 @@ AM_MAINTAINER_MODE([enable]) # Enable silent rules if available (Introduced in AM 1.11) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +AC_REQUIRE_AUX_FILE([tap-driver.sh]) + # Checks for C compiler AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE diff --git a/tests/Makefile.am b/tests/Makefile.am index 5927f59e..5ad2cc59 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,34 +1,21 @@ SUBDIRS = utils bin lib -EXTRA_DIST = $(srcdir)/ctf-traces/** tests -if ENABLE_DEBUGINFO -EXTRA_DIST += $(srcdir)/debuginfo-data/** tests_debuginfo -endif - -SCRIPT_LIST = run.sh - -dist_noinst_SCRIPTS = $(SCRIPT_LIST) +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/config/tap-driver.sh -all-local: - @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ - for script in $(SCRIPT_LIST); do \ - cp -f $(srcdir)/$$script $(builddir); \ - done; \ - fi +TESTS = bin/test_trace_read \ + bin/test_trace_read \ + bin/test_packet_seq_num \ + bin/test_intersection \ + lib/test_bitfield \ + lib/test_seek_empty_packet \ + lib/test_seek_big_trace \ + lib/test_ctf_writer_complete -clean-local: - @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ - for script in $(SCRIPT_LIST); do \ - rm -f $(builddir)/$$script; \ - done; \ - fi +EXTRA_DIST = $(srcdir)/ctf-traces/** \ + $(srcdir)/debuginfo-data/** -TEMPLIST := $(shell mktemp -u) -check-am: - @cat $(srcdir)/tests > $(TEMPLIST) if ENABLE_DEBUGINFO - @echo '' >> $(TEMPLIST) - @cat $(srcdir)/tests_debuginfo >> $(TEMPLIST) +TESTS += lib/test_dwarf_complete \ + lib/test_bin_info_complete endif - ./run.sh $(TEMPLIST) - rm $(TEMPLIST) 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/tests b/tests/tests deleted file mode 100644 index 6e028df2..00000000 --- a/tests/tests +++ /dev/null @@ -1,7 +0,0 @@ -bin/test_trace_read -bin/test_packet_seq_num -bin/test_intersection -lib/test_bitfield -lib/test_seek_empty_packet -lib/test_seek_big_trace -lib/test_ctf_writer_complete \ No newline at end of file diff --git a/tests/tests_debuginfo b/tests/tests_debuginfo deleted file mode 100644 index df87fc1d..00000000 --- a/tests/tests_debuginfo +++ /dev/null @@ -1,2 +0,0 @@ -lib/test_dwarf_complete -lib/test_bin_info_complete -- 2.34.1