[lttng-dev] [PATCH lttng-ust 1/2] Tests: Replace prove by autotools tap runner
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Thu May 12 15:30:43 UTC 2016
----- On May 12, 2016, at 11:01 AM, Michael Jeanson mjeanson at efficios.com wrote:
> 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.
>
This changes the output of tests to the following:
[...]
PASS: ust-elf/test_ust_elf 44 - debug link filename - expected: main.elf.debug, got: main.elf.debug
PASS: ust-elf/test_ust_elf 45 - debug link crc - expected: 0x2b8cedce, got: 0x2b8cedce
PASS: ust-elf/test_ust_elf 46 - hello.exec is not PIC
PASS: ust-elf/test_ust_elf 47 - hello.pie is PIC
PASS: ust-elf/test_ust_elf 48 - hello.pic is PIC
Is it still TAP compliant ?
Thanks,
Mathieu
> Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
> ---
> .gitignore | 4 ++++
> Makefile.am | 4 ++++
> configure.ac | 2 ++
> tests/Makefile.am | 29 ++++++++++++-----------------
> tests/README | 4 ++--
> tests/run.sh | 22 ----------------------
> tests/test_loop | 12 ------------
> tests/unit_tests | 2 --
> 8 files changed, 24 insertions(+), 55 deletions(-)
> delete mode 100755 tests/run.sh
> delete mode 100755 tests/test_loop
> delete mode 100644 tests/unit_tests
>
> diff --git a/.gitignore b/.gitignore
> index 78cba0d..a5c33fb 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 5bb5311..1db7480 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 7415373..26c3b1d 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 377acd6..96a3faa 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 5f1da32..5f7bcc2 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 c6c50fd..0000000
> --- a/tests/run.sh
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -#!/bin/bash
> -#
> -# Copyright (C) 2013 - Christian Babeux <christian.babeux at 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
> index be3e16c..0000000
> --- 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 4d69789..0000000
> --- a/tests/unit_tests
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -snprintf/test_snprintf
> -ust-elf/test_ust_elf
> --
> 1.9.1
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list