From bce066c49dc7413a1cb3d8df0ea829990b494202 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Thu, 29 Mar 2018 16:16:26 -0400 Subject: [PATCH] Add --post-script to tap-driver.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Allow warn_process.sh to be run between each test to validate that a test does not leave ghost processes. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- config/tap-driver.sh | 9 ++++++++- tests/regression/Makefile.am | 4 ++-- tests/utils/warn_processes.sh | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/config/tap-driver.sh b/config/tap-driver.sh index ee61fc112..32521614d 100755 --- a/config/tap-driver.sh +++ b/config/tap-driver.sh @@ -52,7 +52,7 @@ Usage: [--expect-failure={yes|no}] [--color-tests={yes|no}] [--enable-hard-errors={yes|no}] [--ignore-exit] [--diagnostic-string=STRING] [--merge|--no-merge] - [--comments|--no-comments] [--] TEST-COMMAND + [--comments|--no-comments] [--post-script] [--] TEST-COMMAND The '--test-name', '-log-file' and '--trs-file' options are mandatory. END } @@ -62,6 +62,7 @@ END test_name= # Used for reporting. log_file= # Where to save the result and output of the test script. trs_file= # Where to save the metadata of the test run. +post_script= # Script to be run after the test. expect_failure=0 color_tests=0 merge=0 @@ -84,6 +85,7 @@ while test $# -gt 0; do --comments) comments=1;; --no-comments) comments=0;; --diagnostic-string) diag_string=$2; shift;; + --post-script) post_script=$2; shift;; --) shift; break;; -*) usage_error "invalid option: '$1'";; esac @@ -640,6 +642,11 @@ exit 0 test $? -eq 0 || fatal "I/O or internal error" +if test ! -z $post_script ; then + $post_script + test $? -eq 0 || fatal "Post script returned an error. See $log_file" +fi + # Local Variables: # mode: shell-script # sh-indentation: 2 diff --git a/tests/regression/Makefile.am b/tests/regression/Makefile.am index 7f146d48e..b1642812a 100644 --- a/tests/regression/Makefile.am +++ b/tests/regression/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = tools kernel ust -LOG_DRIVER_FLAGS='--merge' -LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ +LOG_DRIVER_FLAGS = --merge --post-script $(top_srcdir)/tests/utils/warn_processes.sh +LOG_DRIVER = env PGREP='$(PGREP)' AM_TAP_AWK='$(AWK)' $(SHELL) \ $(top_srcdir)/config/tap-driver.sh TESTS = tools/filtering/test_invalid_filter \ diff --git a/tests/utils/warn_processes.sh b/tests/utils/warn_processes.sh index 6858b8663..d84edb6f9 100755 --- a/tests/utils/warn_processes.sh +++ b/tests/utils/warn_processes.sh @@ -1,6 +1,8 @@ #!/bin/bash -PGREP="$1" +if [ -z $PGREP ]; then + PGREP=pgrep +fi if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then exit -- 2.34.1