Tests: Fix first line of output to follow TAP guidelines
authorChristian Babeux <christian.babeux@efficios.com>
Thu, 21 Mar 2013 19:56:44 +0000 (15:56 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 25 Mar 2013 14:05:31 +0000 (10:05 -0400)
From the Test::Harness::TAP documentation [1]:

The plan tells how many tests will be run, or how many tests have
run.  It's a check that the test file hasn't stopped prematurely.
It must appear once, whether at the beginning or end of the output.

The TAP plan *must* be the first line of output of any tests. Currently,
most of the tests output their description and then the TAP plan. This
can cause issues while parsing the test output for "strict" TAP parser
such as the one used in the prove tool.

This commit ensure that the first line outputted by any tests is the TAP
plan.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
24 files changed:
tests/regression/kernel/test_all_events
tests/regression/kernel/test_event_basic
tests/regression/tools/filtering/test_invalid_filter
tests/regression/tools/filtering/test_unsupported_op
tests/regression/tools/filtering/test_valid_filter
tests/regression/tools/health/test_thread_exit
tests/regression/tools/health/test_thread_stall
tests/regression/tools/health/test_tp_fail
tests/regression/tools/streaming/test_high_throughput_limits
tests/regression/tools/streaming/test_kernel
tests/regression/tools/streaming/test_ust
tests/regression/ust/before-after/test_before_after
tests/regression/ust/buffers-uid/test_buffers_uid
tests/regression/ust/high-throughput/test_high_throughput
tests/regression/ust/low-throughput/test_low_throughput
tests/regression/ust/multi-session/test_multi_session
tests/regression/ust/nprocesses/test_nprocesses
tests/regression/ust/overlap/test_overlap
tests/regression/ust/test_event_basic
tests/regression/ust/test_event_wildcard
tests/unit/test_kernel_data.c
tests/unit/test_session.c
tests/unit/test_uri.c
tests/unit/test_ust_data.c

index 48627481b51025c5d62c50790f0bd0aa6f169c51..afd42ab39345bd4b8e4dc687277e596d43135f4d 100755 (executable)
@@ -23,8 +23,6 @@ NUM_TESTS=8
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 function test_all_event()
 {
        TRACE_PATH=$(mktemp -d)
@@ -47,6 +45,8 @@ function test_all_event()
 # MUST set TESTDIR before calling those functions
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 if [ "$(id -u)" == "0" ]; then
        isroot=1
 else
index 4de94dc670fe07a6b338fa40f9db5f9bf5e5801a..5c19744d3b4c0eeb5d74fd373b3931ae49622572 100755 (executable)
@@ -23,8 +23,6 @@ NUM_TESTS=12
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 function test_event_basic()
 {
        TRACE_PATH=$(mktemp -d)
@@ -51,6 +49,8 @@ function test_event_basic()
 # MUST set TESTDIR before calling those functions
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 if [ "$(id -u)" == "0" ]; then
        isroot=1
 else
index 700fa236940117fda9d85b78a272fef1a52cbb33..9e8a3c6f61fc917bb8cec6226bb064ceaf4760e5 100755 (executable)
@@ -28,8 +28,6 @@ NUM_TESTS=119
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 function enable_ust_lttng_event_filter
 {
        sess_name="$1"
@@ -85,6 +83,8 @@ function test_bytecode_limit
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 IFS=$'\n'
 INVALID_FILTERS=(
                # Unsupported ops
index d0c6c862027a1a69ac47b2fb04d7dbea43d7d2b0..b5b7f27bb4a063a8ebe7c9d685555bb93c04be93 100755 (executable)
@@ -27,8 +27,6 @@ TRACE_PATH=$(mktemp -d)
 NUM_TESTS=46
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 function enable_ust_lttng_event_filter_unsupported
 {
        sess_name=$1
@@ -86,6 +84,8 @@ function test_unsupported_op
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 # Unsupported operators
 OP_STR=("MUL" "DIV" "MOD" "PLUS" "MINUS" "LSHIFT" "RSHIFT"
        "BIN_AND" "BIN_OR" "BIN_XOR" "UNARY_BIN_NOT")
index 09ac8689e706a24807a0d7aef2a5a3cb3b02c2f9..5587fdec2eb895e0d5a24112975877086052acff 100755 (executable)
@@ -29,8 +29,6 @@ NUM_TESTS=198
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -x "$CURDIR/$BIN_NAME" ]; then
        BAIL_OUT "No UST nevents binary detected."
 fi
@@ -313,6 +311,8 @@ function validator_true_statement
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 IFS=$'\n'
 
 issue_356_filter="intfield > 0 && intfield > 1 && "
index 885ad194182736e147046d6d33c52b69ef3741fd..aa2bd57c4bedb93f7a6b200e3bc6ff293da6c22d 100755 (executable)
@@ -28,8 +28,6 @@ NUM_TESTS=12
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -f "$CURDIR/$SESSIOND_PRELOAD" ]; then
        BAIL_OUT "libhealthexit.so not available for this test."
 fi
@@ -78,8 +76,11 @@ function test_thread_exit
                return 1
        fi
 }
+
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 THREAD=("LTTNG_THREAD_MANAGE_CLIENTS"
        "LTTNG_THREAD_MANAGE_APPS"
        "LTTNG_THREAD_REG_APPS")
index 1651c021e2f486dea4de1c84fdb8c9cbf40073c9..92951311b774aebc9af031ad983e608effe86a2a 100755 (executable)
@@ -28,8 +28,6 @@ NUM_TESTS=11
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -f "$CURDIR/$SESSIOND_PRELOAD" ]; then
        BAIL_OUT "libhealthstall.so not available for this test."
 fi
@@ -99,6 +97,8 @@ function test_thread_stall
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 THREAD=("LTTNG_THREAD_MANAGE_CLIENTS"
        "LTTNG_THREAD_MANAGE_APPS"
 # This thread is a little bit tricky to stall,
index fdb8745a2acf8167446d00b0b3664412747e349d..c7db62488f7bb42b00dd5e35c50ce7bc59e60dce 100755 (executable)
@@ -28,8 +28,6 @@ NUM_TESTS=9
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -f "$CURDIR/$SESSIOND_PRELOAD" ]; then
        BAIL_OUT "libhealthtpfail.so not available for this test."
 fi
@@ -73,6 +71,8 @@ function test_tp_fail
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 THREAD=("LTTNG_THREAD_MANAGE_CLIENTS"
        "LTTNG_THREAD_MANAGE_APPS")
 
index 2412374bb50ce78cbc19b8652859b82692ea31b8..f3885a84266448ab8b3b92754ea38ca45ca7f73e 100755 (executable)
@@ -35,8 +35,6 @@ NUM_TESTS=112
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -x "$CURDIR/$BIN_NAME" ]; then
        BAIL_OUT "No UST nevents binary detected."
 fi
@@ -162,6 +160,8 @@ function interrupt_cleanup()
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 if [ "$(id -u)" == "0" ]; then
        isroot=1
 else
index db529c53b75b8004a41284bc8621894683e72aa0..9877bb8d949f455c3e9ef071169c26f787eb7965 100755 (executable)
@@ -28,8 +28,6 @@ NUM_TESTS=10
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 # LTTng kernel modules check
 out=`ls /lib/modules/$(uname -r)/extra | grep lttng`
 if [ -z "$out" ]; then
@@ -79,6 +77,8 @@ function test_kernel_after_start ()
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 if [ "$(id -u)" == "0" ]; then
        isroot=1
 else
index 2d49cde31cfe5bc450064eb06a4f865f974aa876..333b2e9a96056cf0fc43f6fd9a33b91ddd1ef8cc 100755 (executable)
@@ -29,8 +29,6 @@ NUM_TESTS=18
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -x "$CURDIR/$BIN_NAME" ]; then
        BAIL_OUT "No UST nevents binary detected."
 fi
@@ -87,6 +85,8 @@ function test_ust_after_start ()
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 start_lttng_relayd "-o $TRACE_PATH"
 start_lttng_sessiond
 
index 6a5776e23a7441ef6aa60982e436ec65eab5290e..c3e24f7d8d53481a1a959d29ad07aeefa236c661 100755 (executable)
@@ -25,8 +25,6 @@ NUM_TESTS=16
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -x "$CURDIR/gen-nevents" ]; then
        BAIL_OUT "No UST nevents binary detected."
 fi
@@ -86,6 +84,8 @@ test_after_apps() {
 # MUST set TESTDIR before calling those functions
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 start_lttng_sessiond
 
 diag "Start application BEFORE tracing was started"
index f56c458d1a780a74c45934e12b9c09419236c9f4..97fd95d489a1fcf7866f31ef916614147a845cfe 100755 (executable)
@@ -26,8 +26,6 @@ NUM_TESTS=58
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -x "$CURDIR/gen-nevents" ]; then
        BAIL_OUT "No UST nevents binary detected."
 fi
@@ -214,6 +212,8 @@ test_multiple_channels() {
 # MUST set TESTDIR before calling those functions
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 TESTS=(
        "test_before_app"
        "test_after_app"
index a801400c463cdefab3fec436cb83a1d5c73c0828..ea450511ae02ddef07bd142e00c240de8ae75b46 100755 (executable)
@@ -26,8 +26,6 @@ NUM_TESTS=9
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -x "$CURDIR/$BIN_NAME" ]; then
        BAIL_OUT "No UST nevents binary detected."
 fi
@@ -38,6 +36,8 @@ TRACE_PATH=$(mktemp -d)
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 start_lttng_sessiond
 
 create_lttng_session $SESSION_NAME $TRACE_PATH
index 197210afeef23f2c42f859ee9cc29f0d7e302dc3..1ca3c38d072d5f116741d3ebf40cd407d503c740 100755 (executable)
@@ -25,8 +25,6 @@ NUM_TESTS=8
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -x "$CURDIR/$BIN_NAME" ]; then
        BAIL_OUT "No UST nevents binary detected."
 fi
@@ -37,6 +35,8 @@ TRACE_PATH=$(mktemp -d)
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 start_lttng_sessiond
 
 create_lttng_session $SESSION_NAME $TRACE_PATH
index ffe8355a8bfb351709713ceccdcac9bfa78e2c99..313a7d70fa9c408d529d4fca80a2a56d5c0233d2 100755 (executable)
@@ -25,8 +25,6 @@ NUM_TESTS=28
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -x "$CURDIR/gen-nevents" ]; then
        BAIL_OUT "No UST nevents binary detected."
 fi
@@ -76,6 +74,8 @@ test_multi_session() {
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 start_lttng_sessiond
 
 TRACE_PATH=$(mktemp -d)
index ac8e99a159d39beee0670506a73c6c64a02e82f6..418fda5c031c2f3c4c2e0e5937ad80dd7b24eb01 100755 (executable)
@@ -27,8 +27,6 @@ NUM_TESTS=9
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -x "$CURDIR/$TEST_BIN_NAME" ]; then
        BAIL_OUT "No UST $TEST_BIN_NAME binary detected."
 fi
@@ -37,6 +35,8 @@ fi
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 start_lttng_sessiond
 
 # Start test for 1000 seconds
index e82307251baf033466970ca1c4d672ac430124f7..add8ff140ee5f3bc4c4e9fab33c8f2e29658f9cf 100755 (executable)
@@ -34,8 +34,6 @@ NUM_TESTS=259
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 if [ ! -x "$CURDIR/demo/demo" ]; then
        BAIL_OUT "No UST nevents binary detected."
 fi
@@ -615,6 +613,8 @@ test_disable_wildcard_overlap()
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 TESTS=(
        "test_enable_wildcard_filter"
        "test_enable_wildcard_filter_2"
index 5a9cfe41bacc3efc049610d2d860dfb0167b4982..3ff91b39e5dee70e2a6d37758f946b6de7470215 100755 (executable)
@@ -27,8 +27,6 @@ NUM_TESTS=25
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 function enable_ust_lttng_event_per_chan()
 {
        sess_name="$1"
@@ -111,6 +109,8 @@ function test_event_basic()
 # MUST set TESTDIR before calling those functions
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 start_lttng_sessiond
 
 test_event_basic
index 88c02b08a201544b6c557920637d2d6e33c237c5..33ba4c4cc3b8a6b4d691d99c0b3085f8ac6c5cff 100755 (executable)
@@ -27,8 +27,6 @@ NUM_TESTS=9
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 function test_event_wildcard()
 {
        TRACE_PATH=$(mktemp -d)
@@ -59,6 +57,8 @@ function test_event_wildcard()
 # MUST set TESTDIR before calling those functions
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 start_lttng_sessiond
 
 test_event_wildcard
index c9dc194d0ca4b449a6837065dfbf9c8150dec91c..f3687456424cd8af8ff88a99bf317b06c58c429a 100644 (file)
@@ -177,10 +177,10 @@ static void test_create_kernel_stream(void)
 
 int main(int argc, char **argv)
 {
-       diag("Kernel data structure unit test");
-
        plan_tests(NUM_TESTS);
 
+       diag("Kernel data structure unit test");
+
        test_create_one_kernel_session();
        test_create_kernel_metadata();
        test_create_kernel_channel();
index 196124bd3c33e5b50beebcb1b49215c89450d879..61db187f1ccff351e93cee8c08297fcefac31639 100644 (file)
@@ -301,10 +301,10 @@ void test_large_session_number(void)
 
 int main(int argc, char **argv)
 {
-       diag("Sessions unit tests");
-
        plan_tests(NUM_TESTS);
 
+       diag("Sessions unit tests");
+
        test_session_list();
 
        test_create_one_session();
index 91bd21c5e3213a444279ef695fa1ea7c2fcc715a..ba0baf9b6e03b0f1f84ef4d763751b3943a7aa95 100644 (file)
@@ -252,10 +252,10 @@ void test_uri_cmp()
 
 int main(int argc, char **argv)
 {
-       diag("URI unit tests");
-
        plan_tests(NUM_TESTS);
 
+       diag("URI unit tests");
+
        test_uri_parsing();
 
        test_uri_cmp();
index 50d43bbd3800dc2cd0828ff4eaa7dff3d797aaac..294b5c58941d7ab8eee7ee4b2d34f33ae0ca9fa7 100644 (file)
@@ -182,10 +182,10 @@ static void test_create_ust_context(void)
 
 int main(int argc, char **argv)
 {
-       diag("UST data structures unit test");
-
        plan_tests(NUM_TESTS);
 
+       diag("UST data structures unit test");
+
        test_create_one_ust_session();
        test_create_ust_metadata();
        test_create_ust_channel();
This page took 0.035949 seconds and 4 git commands to generate.