tests: make test names in plugins/flt.utils.trimmer/test_trimming unique
[babeltrace.git] / tests / plugins / flt.utils.trimmer / test_trimming
index 3ec05a4115ecbb976201259c56c39a3fa45970ba..cf83a7809996de2e5f1a7b784925f446a43820e0 100755 (executable)
@@ -31,7 +31,8 @@ fi
 source "$UTILSSH"
 
 data_dir="$BT_TESTS_DATADIR/plugins/flt.utils.trimmer"
-temp_expected=$(mktemp)
+temp_stdout_expected=$(mktemp)
+temp_stderr_expected="/dev/null"
 
 plan_tests 32
 
@@ -39,19 +40,26 @@ function run_test
 {
        local begin_time="$1"
        local end_time="$2"
+       # with_stream_msgs_cs is set to "true" or "false" by the tests.
        local local_args=(
+               "--plugin-path" "$data_dir"
                "-c" "src.test-trimmer.TheSourceOfAllEvil"
                "-p" "with-stream-msgs-cs=$with_stream_msgs_cs"
                "-c" "sink.text.details"
                "--params=compact=true,with-metadata=false"
-               "--plugin-path=$data_dir"
        )
 
+       if [ "$with_stream_msgs_cs" = "true" ]; then
+               test_name="with stream message clock snapshots"
+       else
+               test_name="without stream message clock snapshots"
+       fi
+
        if [ -n "$begin_time" ]; then
                local_args+=("--begin=$begin_time")
-               test_name="with --begin=$begin_time"
+               test_name="$test_name, with --begin=$begin_time"
        else
-               test_name="without --begin"
+               test_name="$test_name, without --begin"
        fi
 
        if [ -n "$end_time" ]; then
@@ -61,9 +69,7 @@ function run_test
                test_name="$test_name, without --end"
        fi
 
-       # with_stream_msgs_cs is set to "true" or "false" by the tests.
-
-       bt_diff_cli "$temp_expected" "${local_args[@]}"
+       bt_diff_cli "$temp_stdout_expected" "$temp_stderr_expected" "${local_args[@]}"
        ok $? "$test_name"
 }
 
@@ -71,7 +77,7 @@ function test_with_stream_msg_cs {
        with_stream_msgs_cs="true"
 
        # Baseline (without trimming)
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [100 10,100,000,000,000] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -82,7 +88,7 @@ function test_with_stream_msg_cs {
        run_test "" ""
 
        # Trim begin at a time before what the clock class can represent
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [100 10,100,000,000,000] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -93,7 +99,7 @@ function test_with_stream_msg_cs {
        run_test 50 ""
 
        # Trim begin before stream beginning
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [100 10,100,000,000,000] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -104,7 +110,7 @@ function test_with_stream_msg_cs {
        run_test 10050 ""
 
        # Trim begin before packet beginning
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [150 10,150,000,000,000] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -115,7 +121,7 @@ function test_with_stream_msg_cs {
        run_test 10150 ""
 
        # Trim begin before first event
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [250 10,250,000,000,000] {0 0 0} Stream beginning
        [250 10,250,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -126,7 +132,7 @@ function test_with_stream_msg_cs {
        run_test 10250 ""
 
        # Trim begin before second event
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [350 10,350,000,000,000] {0 0 0} Stream beginning
        [350 10,350,000,000,000] {0 0 0} Packet beginning
        [400 10,400,000,000,000] {0 0 0} Event `event 2` (1)
@@ -137,7 +143,7 @@ function test_with_stream_msg_cs {
        run_test 10350 ""
 
        # Trim begin before packet end
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [850 10,850,000,000,000] {0 0 0} Stream beginning
        [850 10,850,000,000,000] {0 0 0} Packet beginning
        [900 10,900,000,000,000] {0 0 0} Packet end
@@ -147,13 +153,13 @@ function test_with_stream_msg_cs {
        run_test 10850 ""
 
        # Trim begin after everything
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        END
 
        run_test 11050 ""
 
        # Trim end after stream end
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [100 10,100,000,000,000] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -165,7 +171,7 @@ function test_with_stream_msg_cs {
        run_test "" 11050
 
        # Trim end after packet end
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [100 10,100,000,000,000] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -177,7 +183,7 @@ function test_with_stream_msg_cs {
        run_test "" 10950
 
        # Trim end after second event
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [100 10,100,000,000,000] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -189,7 +195,7 @@ function test_with_stream_msg_cs {
        run_test "" 10450
 
        # Trim end after first event
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [100 10,100,000,000,000] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -200,7 +206,7 @@ function test_with_stream_msg_cs {
        run_test "" 10350
 
        # Trim end after packet beginning
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [100 10,100,000,000,000] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [250 10,250,000,000,000] {0 0 0} Packet end
@@ -210,7 +216,7 @@ function test_with_stream_msg_cs {
        run_test "" 10250
 
        # Trim end after stream beginning
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [100 10,100,000,000,000] {0 0 0} Stream beginning
        [150 10,150,000,000,000] {0 0 0} Stream end
        END
@@ -218,13 +224,13 @@ function test_with_stream_msg_cs {
        run_test "" 10150
 
        # Trim end before everything
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        END
 
        run_test "" 10050
 
        # Trim end at a time before what the clock class can represent
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        END
 
        run_test "" 50
@@ -234,7 +240,7 @@ function test_without_stream_msg_cs {
        with_stream_msgs_cs="false"
 
        # Baseline (without trimming)
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -245,7 +251,7 @@ function test_without_stream_msg_cs {
        run_test "" ""
 
        # Trim begin at a time before what the clock class can represent
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -256,7 +262,7 @@ function test_without_stream_msg_cs {
        run_test 50 ""
 
        # Trim begin before stream beginning
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -267,7 +273,7 @@ function test_without_stream_msg_cs {
        run_test 10050 ""
 
        # Trim begin before packet beginning
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -278,7 +284,7 @@ function test_without_stream_msg_cs {
        run_test 10150 ""
 
        # Trim begin before first event
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [250 10,250,000,000,000] {0 0 0} Stream beginning
        [250 10,250,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -289,7 +295,7 @@ function test_without_stream_msg_cs {
        run_test 10250 ""
 
        # Trim begin before second event
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [350 10,350,000,000,000] {0 0 0} Stream beginning
        [350 10,350,000,000,000] {0 0 0} Packet beginning
        [400 10,400,000,000,000] {0 0 0} Event `event 2` (1)
@@ -300,7 +306,7 @@ function test_without_stream_msg_cs {
        run_test 10350 ""
 
        # Trim begin before packet end
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [850 10,850,000,000,000] {0 0 0} Stream beginning
        [850 10,850,000,000,000] {0 0 0} Packet beginning
        [900 10,900,000,000,000] {0 0 0} Packet end
@@ -310,13 +316,13 @@ function test_without_stream_msg_cs {
        run_test 10850 ""
 
        # Trim begin after everything
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        END
 
        run_test 11050 ""
 
        # Trim end after stream end
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -328,7 +334,7 @@ function test_without_stream_msg_cs {
        run_test "" 11050
 
        # Trim end after packet end
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -340,7 +346,7 @@ function test_without_stream_msg_cs {
        run_test "" 10950
 
        # Trim end after second event
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -352,7 +358,7 @@ function test_without_stream_msg_cs {
        run_test "" 10450
 
        # Trim end after first event
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [300 10,300,000,000,000] {0 0 0} Event `event 1` (0)
@@ -363,7 +369,7 @@ function test_without_stream_msg_cs {
        run_test "" 10350
 
        # Trim end after packet beginning
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [200 10,200,000,000,000] {0 0 0} Packet beginning
        [250 10,250,000,000,000] {0 0 0} Packet end
@@ -373,7 +379,7 @@ function test_without_stream_msg_cs {
        run_test "" 10250
 
        # Trim end after stream beginning
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [Unknown] {0 0 0} Stream end
        END
@@ -381,7 +387,7 @@ function test_without_stream_msg_cs {
        run_test "" 10150
 
        # Trim end before everything
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [Unknown] {0 0 0} Stream end
        END
@@ -389,7 +395,7 @@ function test_without_stream_msg_cs {
        run_test "" 10050
 
        # Trim end at a time before what the clock class can represent
-       cat <<- 'END' > "$temp_expected"
+       cat <<- 'END' > "$temp_stdout_expected"
        [Unknown] {0 0 0} Stream beginning
        [Unknown] {0 0 0} Stream end
        END
@@ -400,4 +406,6 @@ function test_without_stream_msg_cs {
 test_with_stream_msg_cs
 test_without_stream_msg_cs
 
-rm -f "$temp_expected"
+# Do not `rm` $temp_stderr_expected because it's set to `/dev/null` right now
+# and that would print an error.
+rm -f "$temp_stdout_expected"
This page took 0.02826 seconds and 4 git commands to generate.