Add --post-script to tap-driver.sh
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 29 Mar 2018 20:16:26 +0000 (16:16 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 3 Apr 2018 20:04:35 +0000 (16:04 -0400)
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 <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
config/tap-driver.sh
tests/regression/Makefile.am
tests/utils/warn_processes.sh

index ee61fc1129630cd9deefbf3b448d69255a5a352c..32521614de9dd265fe3002d3aa462e62247499f9 100755 (executable)
@@ -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]
                 [--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
 }
 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.
 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
 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;;
   --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
   --) shift; break;;
   -*) usage_error "invalid option: '$1'";;
   esac
@@ -640,6 +642,11 @@ exit 0
 
 test $? -eq 0 || fatal "I/O or internal error"
 
 
 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
 # Local Variables:
 # mode: shell-script
 # sh-indentation: 2
index 7f146d48e1cace28583512fce4177f87fbe34d23..b1642812af9f1116cf51c88dcf10db7ea2846a56 100644 (file)
@@ -1,7 +1,7 @@
 SUBDIRS = tools kernel ust
 
 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 \
        $(top_srcdir)/config/tap-driver.sh
 
 TESTS = tools/filtering/test_invalid_filter \
index 6858b86632d2f7297e8eff082d20f1ece278a8bd..d84edb6f9c5686a2e421fef340af7f82f9b1154e 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/bash
 
 #!/bin/bash
 
-PGREP="$1"
+if [ -z $PGREP ]; then
+       PGREP=pgrep
+fi
 
 if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then
        exit
 
 if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then
        exit
This page took 0.028462 seconds and 5 git commands to generate.