X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=config%2Ftap-driver.sh;h=65037ab65f5dfb03d729704d0132217b66091053;hp=ee61fc1129630cd9deefbf3b448d69255a5a352c;hb=65702b8f172b8d2156ab1889f7e7c1b134114ec1;hpb=a36b26b4511eded3dbaecaa3a154b5c212391a31 diff --git a/config/tap-driver.sh b/config/tap-driver.sh index ee61fc112..65037ab65 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 @@ -273,6 +275,9 @@ function report(result, details) msg = msg " " details # Output on console might be colorized. print decorate_result(result) msg + # Flush stdout after each test result, this is useful when stdout + # is buffered, for example in a CI system. + fflush() # Log the result in the log file too, to help debugging (this is # especially true when said result is a TAP error or "Bail out!"). print result msg | "cat >&3"; @@ -640,6 +645,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