Tests: Use _run_babeltrace_cmd where possible
authorKienan Stewart <kstewart@efficios.com>
Wed, 31 Jul 2024 18:54:14 +0000 (14:54 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 6 Sep 2024 15:31:20 +0000 (15:31 +0000)
Change-Id: I5b279201a1806e8975de39fa85e666da3d0c5204
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
15 files changed:
tests/destructive/metadata-regeneration
tests/regression/kernel/test_callstack
tests/regression/kernel/test_clock_override
tests/regression/tools/clear/test_kernel
tests/regression/tools/clear/test_ust
tests/regression/tools/exclusion/test_exclusion
tests/regression/tools/metadata/test_kernel
tests/regression/tools/metadata/test_ust
tests/regression/tools/tracefile-limits/test_tracefile_count
tests/regression/ust/buffers-pid/test_buffers_pid
tests/regression/ust/clock-override/test_clock_override
tests/regression/ust/getcpu-override/test_getcpu_override
tests/regression/ust/low-throughput/test_low_throughput
tests/regression/ust/multi-session/test_multi_session
tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush

index dcae6bce0dfb901f318bd26bdc8012f0e7d51cc3..5daa21b168c8447a38c7c7cd6cc4e21e8cf1b376 100755 (executable)
@@ -46,7 +46,7 @@ function validate_trace_date
        local test_date=$1
        local trace_path=$2
 
-       res=$($BABELTRACE_BIN --clock-date "$trace_path" 2>/dev/null | head -1 | grep $test_date)
+       res=$(_run_babeltrace_cmd --clock-date "$trace_path" | head -1 | grep $test_date)
        if [ $? -eq 0 ]; then
                pass "Validate trace at date $test_date"
                ret=0
index 960bb8a44e1511f08ae425a675dc296c75dc4410..6131c251b86a52562ff812bc283e07dcd7ed5c17 100755 (executable)
@@ -76,7 +76,7 @@ function test_user_callstack()
 
        destroy_lttng_session_ok "$SESSION_NAME"
 
-       "$BABELTRACE_BIN" "$TRACE_PATH" | grep $EVENT_NAME | ./"$PARSE_CALLSTACK" --user "$TEST_APP_USERSPACE" $USER_CS_EXPECTED
+       "_run_babeltrace_cmd" "$TRACE_PATH" | grep $EVENT_NAME | ./"$PARSE_CALLSTACK" --user "$TEST_APP_USERSPACE" $USER_CS_EXPECTED
        ok $? "Validate userspace callstack"
 
        rm -rf "$TRACE_PATH"
@@ -114,7 +114,7 @@ function test_kernel_callstack()
 
        destroy_lttng_session_ok "$SESSION_NAME"
 
-       "$BABELTRACE_BIN" "$TRACE_PATH" | grep $EVENT_NAME | ./"$PARSE_CALLSTACK" --kernel $KERNEL_CS_EXPECTED
+       "_run_babeltrace_cmd" "$TRACE_PATH" | grep $EVENT_NAME | ./"$PARSE_CALLSTACK" --kernel $KERNEL_CS_EXPECTED
        ok $? "Validate kernel callstack"
 
        rm -rf "$TRACE_PATH"
index c3688d3599efa28aed83d8eab7483ba44934bd78..f9ece05b8d1fab2f26825799b7eec2b7ca787d02 100755 (executable)
@@ -87,7 +87,7 @@ function test_clock_override_metadata()
        local TRACE_METADATA_FILE_PATH="$(find "$TRACE_PATH" -name metadata -type f)"
        local TRACE_METADATA_DIR="$(dirname "$TRACE_METADATA_FILE_PATH")"
 
-       $BABELTRACE_BIN -o ctf-metadata -w $ctf_metadata_file $TRACE_METADATA_DIR
+       _run_babeltrace_cmd -o ctf-metadata -w $ctf_metadata_file $TRACE_METADATA_DIR
        ok $? "Metadata extraction from babeltrace"
 
        extract_clock_metadata $ctf_metadata_file $clock_metadata_file
@@ -126,7 +126,7 @@ function test_clock_override_timestamp()
 
        # Use Babeltrace with "-n all" to give a comma separated list for
        # easy extraction of timestamps.
-       unique_timestamps_count=$($BABELTRACE_BIN -n all $TRACE_PATH | \
+       unique_timestamps_count=$(_run_babeltrace_cmd -n all $TRACE_PATH | \
                cut -d, -f1 | uniq | wc -l)
        test $unique_timestamps_count -gt 1
        ok $? "Unique event timestamps without clock override: $unique_timestamps_count expect >1"
@@ -153,7 +153,7 @@ function test_clock_override_timestamp()
 
        # Use Babeltrace with "-n all" to give a comma separated list for
        # easy extraction of timestamps.
-       unique_timestamps_count=$($BABELTRACE_BIN -n all $TRACE_PATH | \
+       unique_timestamps_count=$(_run_babeltrace_cmd -n all $TRACE_PATH | \
                cut -d, -f1 | uniq | wc -l)
        test $unique_timestamps_count -eq 1
        ok $? "Unique event timestamps with clock override: $unique_timestamps_count expect 1"
index 2e383b8aa6c0971705831974fefcf0e2b644e776..2819c24bcdb4cdda2105046408e47158dd5008ed 100755 (executable)
@@ -214,7 +214,7 @@ function test_kernel_basic_streaming_live_viewer ()
        wait_live_trace_ready net://localhost
 
        # Connect a live viewer
-       $BABELTRACE_BIN -i lttng-live net://localhost/host/$remote_trace_path > $bt_output_path &
+       _run_babeltrace_cmd -i lttng-live net://localhost/host/$remote_trace_path > $bt_output_path &
        local viewer_pid=$!
 
        wait_live_viewer_connect net://localhost
@@ -260,7 +260,7 @@ function test_kernel_streaming_live_viewer ()
        wait_live_trace_ready net://localhost
 
        # Connect a live viewer
-       $BABELTRACE_BIN -i lttng-live net://localhost/host/$remote_trace_path > $bt_output_path &
+       _run_babeltrace_cmd -i lttng-live net://localhost/host/$remote_trace_path > $bt_output_path &
        local viewer_pid=$!
 
        wait_live_viewer_connect net://localhost
index 104753b98474ea57bf5a32538daee9f0bb5143b5..c916dd92189a054eb05bd54c58a1703ca4375910 100755 (executable)
@@ -247,7 +247,6 @@ function test_ust_basic_streaming_live_viewer ()
        local remote_trace_path="${HOSTNAME}/${SESSION_NAME}"
        local channel_name="chan"
        local bt_output_path=$(mktemp -u -t tmp.test_${FUNCNAME[0]}_bt_output_path.XXXXXX)
-       local bt_error_path=$(mktemp -t "tmp.${FUNCNAME[0]}_bt_error.XXXXXX")
        local file_sync_before_exit=$(mktemp -u -t tmp.test_${FUNCNAME[0]}_sync_before_exit.XXXXXX)
 
        diag "Test ust basic streaming live with viewer"
@@ -260,7 +259,7 @@ function test_ust_basic_streaming_live_viewer ()
        wait_live_trace_ready net://localhost
 
        # Connect a live viewer
-       $BABELTRACE_BIN -i lttng-live net://localhost/host/$remote_trace_path --params=session-not-found-action=end 1> $bt_output_path 2> "${bt_error_path}" &
+       _run_babeltrace_cmd -i lttng-live net://localhost/host/$remote_trace_path --params=session-not-found-action=end 1> $bt_output_path &
        local viewer_pid=$!
        local viewer_iter=0
 
@@ -292,7 +291,6 @@ function test_ust_basic_streaming_live_viewer ()
        pass "Wait for viewer to exit"
 
        rm -f $bt_output_path
-       clean_path "${bt_error_path}"
        rm -f $file_sync_before_exit
 }
 
@@ -306,7 +304,6 @@ function test_ust_streaming_live_viewer ()
        local remote_trace_path="${HOSTNAME}/${SESSION_NAME}"
        local channel_name="chan"
        local bt_output_path=$(mktemp -u -t tmp.test_${FUNCNAME[0]}_bt_output_path.XXXXXX)
-       local bt_error_path=$(mktemp -t "tmp.${FUNCNAME[0]}_bt_error.XXXXXX")
 
        diag "Test ust streaming live clear with viewer"
        diag "Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, buffer_type=$buffer_type"
@@ -318,7 +315,7 @@ function test_ust_streaming_live_viewer ()
        wait_live_trace_ready net://localhost
 
        # Connect a live viewer
-       $BABELTRACE_BIN -i lttng-live net://localhost/host/$remote_trace_path --params=session-not-found-action=end 1> $bt_output_path 2> "${bt_error_path}" &
+       _run_babeltrace_cmd -i lttng-live net://localhost/host/$remote_trace_path --params=session-not-found-action=end 1> $bt_output_path &
        local viewer_pid=$!
 
        wait_live_viewer_connect net://localhost
@@ -334,7 +331,6 @@ function test_ust_streaming_live_viewer ()
        pass "Wait for viewer to exit"
 
        clean_path $bt_output_path
-       clean_path "${bt_error_path}"
 }
 
 function test_ust_streaming_live_viewer_new_metadata_after_clear ()
@@ -348,7 +344,6 @@ function test_ust_streaming_live_viewer_new_metadata_after_clear ()
        local channel_name="chan"
 
        local bt_output_path=$(mktemp -t "tmp.${FUNCNAME[0]}_bt_output.XXXXXX")
-       local bt_error_path=$(mktemp -t "tmp.${FUNCNAME[0]}_bt_error.XXXXXX")
        local file_sync_before_exit=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_exit.XXXXXX")
 
        diag "Test ust streaming live clear with viewer with new metadata after clear"
@@ -368,7 +363,7 @@ function test_ust_streaming_live_viewer_new_metadata_after_clear ()
        wait_live_trace_ready net://localhost
 
        # Connect a live viewer
-       $BABELTRACE_BIN -i lttng-live "net://localhost/host/$remote_trace_path" --params=session-not-found-action=end 1> "$bt_output_path" 2> "$bt_error_path" &
+       _run_babeltrace_cmd -i lttng-live "net://localhost/host/$remote_trace_path" --params=session-not-found-action=end 1> "$bt_output_path" &
        local viewer_pid=$!
        local viewer_iter=0
 
@@ -428,7 +423,6 @@ function test_ust_streaming_live_viewer_new_metadata_after_clear ()
        pass "Wait for viewer to exit"
 
        clean_path "$bt_output_path"
-       clean_path "$bt_error_path"
        rm -f "$file_sync_before_exit"
 }
 
index 6b3a14fd476ffdb33771f470baecf75c188da12b..8f510f9c226787c5a707f8f52a119676ed3c49cb 100755 (executable)
@@ -54,7 +54,7 @@ function dry_run
        run_apps
        stop_lttng_tracing_ok $SESSION_NAME
 
-       nb_events=$("$BABELTRACE_BIN" $trace_path | wc -l)
+       nb_events=$("_run_babeltrace_cmd" $trace_path | wc -l)
        if [ "$nb_events" -ne "0" ]; then
                ok 0 "Events were found during the dry run without exclusion"
        else
@@ -87,7 +87,7 @@ function test_exclusion
        # Destroy session
        destroy_lttng_session_ok $SESSION_NAME
 
-       stats=$("$BABELTRACE_BIN" --plugin-path "${BT2_PLUGINS_DIR}" "${trace_path}" -c filter.lttngtest.event_name -p "names=[\"${event_name_expected_to_be_missing}\"]" -c sink.lttngtest.field_stats | grep -v index 2> /dev/null)
+       stats=$("_run_babeltrace_cmd" --plugin-path "${BT2_PLUGINS_DIR}" "${trace_path}" -c filter.lttngtest.event_name -p "names=[\"${event_name_expected_to_be_missing}\"]" -c sink.lttngtest.field_stats | grep -v index)
        if [ ! -z "$stats" ]; then
                fail "Excluded event \"$event_name_expected_to_be_missing\" was found in trace!"
        else
@@ -140,7 +140,7 @@ function test_exclusion_tracing_started
        # Destroy session
        destroy_lttng_session_ok $SESSION_NAME
 
-       stats=$("$BABELTRACE_BIN" --plugin-path "${BT2_PLUGINS_DIR}" "${trace_path}" -c filter.lttngtest.event_name -p "names=[\"${event_name_expected_to_be_missing}\"]" -c sink.lttngtest.field_stats | grep -v index 2> /dev/null)
+       stats=$("_run_babeltrace_cmd" --plugin-path "${BT2_PLUGINS_DIR}" "${trace_path}" -c filter.lttngtest.event_name -p "names=[\"${event_name_expected_to_be_missing}\"]" -c sink.lttngtest.field_stats | grep -v index)
        if [ ! -z "$stats" ]; then
                fail "Excluded event \"$event_name_expected_to_be_missing\" was found in trace!"
        else
index d38af841df2d009592f88a5ba23ed34529085398..1b0225ec53c9df81ca7a856d6122f970117142a0 100755 (executable)
@@ -47,7 +47,7 @@ function test_kernel ()
        metadata_path=$(find "${expected_path}/${session_name}"* -name "metadata")
        metadata_path=$(dirname "$metadata_path")
 
-       $BABELTRACE_BIN --output-format=ctf-metadata "${metadata_path}" > "$metadata"
+       _run_babeltrace_cmd --output-format=ctf-metadata "${metadata_path}" > "$metadata"
 
        # Extract "env" scope
        awk '/env {/,/};/' < "$metadata" > "$metadata_env"
index 05a2a8bec6771fc6a885ab74685d215615a1885c..fbcb519c69568d8c90dac3293ccddb6750ca7610 100755 (executable)
@@ -57,7 +57,7 @@ function test_per_uid ()
        metadata_path=$(find "${expected_path}/${session_name}"* -name "metadata")
        metadata_path=$(dirname "$metadata_path")
 
-       $BABELTRACE_BIN --output-format=ctf-metadata "${metadata_path}" > "$metadata"
+       _run_babeltrace_cmd --output-format=ctf-metadata "${metadata_path}" > "$metadata"
 
        # Extract "env" scope
        awk '/env {/,/};/' < "$metadata" > "$metadata_env"
@@ -156,7 +156,7 @@ function test_per_pid ()
        metadata_path=$(find "${expected_path}/${session_name}"* -name "metadata")
        metadata_path=$(dirname "$metadata_path")
 
-       $BABELTRACE_BIN --output-format=ctf-metadata "${metadata_path}" 1> "$metadata"
+       _run_babeltrace_cmd --output-format=ctf-metadata "${metadata_path}" 1> "$metadata"
 
        # Extract "env" scope
        awk '/env {/,/};/' < "$metadata" > "$metadata_env"
index 9253d3ec2fcc0afdb2b6abe7320bb6f086b51ed7..3d7d6abbc5282418340d5239596ee78edbfaf40e 100755 (executable)
@@ -140,7 +140,7 @@ function test_tracefile_count_limit ()
        [ "$(get_stream_file_count "$trace_path" "$stream_pattern")" -eq "$count_limit" ]
        ok $? "Stream meets the trace file limit of $count_limit"
 
-       stats=$("$BABELTRACE_BIN" --plugin-path "${BT2_PLUGINS_DIR}" convert $trace_path -c filter.lttngtest.event_name -p "names=[\"${event_name}\"]" -c sink.lttngtest.field_stats)
+       stats=$("_run_babeltrace_cmd" --plugin-path "${BT2_PLUGINS_DIR}" convert $trace_path -c filter.lttngtest.event_name -p "names=[\"${event_name}\"]" -c sink.lttngtest.field_stats)
 
        validate_min_max "$stats" "intfield" "[0-9]+" "$expected_max"
        ok $? "Trace validation - intfield"
index 9463d1a511f889daf739b94e90a9b1ea651a9af7..a18cdbf059a71ab8c00c4ac1fd135272556e06be 100755 (executable)
@@ -98,7 +98,7 @@ test_before_multiple_apps() {
                rm -f ${file_sync_before_last}_${i}
        done
 
-       out=$("$BABELTRACE_BIN" $TRACE_PATH | grep $EVENT_NAME | wc -l)
+       out=$("_run_babeltrace_cmd" $TRACE_PATH | grep $EVENT_NAME | wc -l)
        if [ $out -eq 0 ]; then
                fail "Trace validation"
                diag "No event(s) found. We are supposed to have at least one."
@@ -165,7 +165,7 @@ test_before_app() {
        rm -f ${file_sync_after_first}
        rm -f ${file_sync_before_last}
 
-       out=$("$BABELTRACE_BIN" $TRACE_PATH | grep $EVENT_NAME | wc -l)
+       out=$("_run_babeltrace_cmd" $TRACE_PATH | grep $EVENT_NAME | wc -l)
        if [ $out -eq 0 ]; then
                fail "Trace validation"
                diag "No event(s) found. We are supposed to have at least one."
index c7157720ecc7a8576ebba851eb6515e6cd8c40df..9cf4ebc5af703e892d5f7cfb6c04b81d3d735f0f 100755 (executable)
@@ -88,7 +88,7 @@ function test_getcpu_override_metadata()
        local TRACE_METADATA_FILE_PATH="$(find "$TRACE_PATH" -name metadata -type f)"
        local TRACE_METADATA_DIR="$(dirname "$TRACE_METADATA_FILE_PATH")"
 
-       $BABELTRACE_BIN -o ctf-metadata -w $ctf_metadata_file $TRACE_METADATA_DIR
+       _run_babeltrace_cmd -o ctf-metadata -w $ctf_metadata_file $TRACE_METADATA_DIR
        ok $? "Metadata extraction from babeltrace"
 
        extract_clock_metadata $ctf_metadata_file $clock_metadata_file
@@ -124,7 +124,7 @@ function test_getcpu_override_timestamp()
 
        # Use Babeltrace with "-n all" to give a comma separated list for
        # easy extraction of timestamps.
-       unique_timestamps_count=$($BABELTRACE_BIN -n all $TRACE_PATH | \
+       unique_timestamps_count=$(_run_babeltrace_cmd -n all $TRACE_PATH | \
                cut -d, -f1 | uniq | wc -l)
        test $unique_timestamps_count -gt 1
        ok $? "Unique event timestamps without clock override: $unique_timestamps_count expect >1"
@@ -146,7 +146,7 @@ function test_getcpu_override_timestamp()
 
        # Use Babeltrace with "-n all" to give a comma separated list for
        # easy extraction of timestamps.
-       unique_timestamps_count=$($BABELTRACE_BIN -n all $TRACE_PATH | \
+       unique_timestamps_count=$(_run_babeltrace_cmd -n all $TRACE_PATH | \
                cut -d, -f1 | uniq | wc -l)
        test $unique_timestamps_count -eq 1
        ok $? "Unique event timestamps with clock override: $unique_timestamps_count expect 1"
index 7723a76790417e111393a2816d51bc187de5d80b..f6a99a2745baf0580caf75cb04865295d3a54cd1 100755 (executable)
@@ -96,7 +96,7 @@ compare()
                                echo "$(( ${SEQUENCE_SEED[$i]} % $num_cpus))"
                        done
                        diag "Dumping trace"
-                       $BABELTRACE_BIN $TRACE_PATH | awk '{print "# " $0}'
+                       _run_babeltrace_cmd $TRACE_PATH | awk '{print "# " $0}'
                fi
        fi
 }
@@ -113,7 +113,7 @@ test_getcpu_override_fail()
        destroy_lttng_session_ok $SESSION_NAME
 
        # Move output to an array by using =($())
-       local cpuid_events=($($BABELTRACE_BIN $TRACE_PATH | sed -n 's/.*cpu_id = \([0-9]*\).*/\1/p'))
+       local cpuid_events=($(_run_babeltrace_cmd $TRACE_PATH | sed -n 's/.*cpu_id = \([0-9]*\).*/\1/p'))
        local num_events=${#cpuid_events[*]}
        test $num_events -eq $NUM_EVENT
        ok $? "Extraction without getcpu plugin have $num_events/$NUM_EVENT"
@@ -133,7 +133,7 @@ test_getcpu_override()
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
 
-       local cpuid_events=($($BABELTRACE_BIN $TRACE_PATH | sed -n 's/.*cpu_id = \([0-9]*\).*/\1/p'))
+       local cpuid_events=($(_run_babeltrace_cmd $TRACE_PATH | sed -n 's/.*cpu_id = \([0-9]*\).*/\1/p'))
        local num_events=${#cpuid_events[*]}
        test $num_events -eq $NUM_EVENT
        ok $? "Extraction with getcpu plugin have $num_events/$NUM_EVENT"
index 2861324f2d303b2d1c19aee2a60f28398d09988b..46008c474c5d37d785e1a97467fbf42b042a3534 100755 (executable)
@@ -49,7 +49,7 @@ stop_lttng_sessiond
 last_val=0
 out=0
 
-"$BABELTRACE_BIN" $TRACE_PATH | while read event;
+"_run_babeltrace_cmd" $TRACE_PATH | while read event;
 do
        val=$(echo $event | cut -f10 -d" ")
        val=${val%?}
index c0d1c307e7fbce5760db4e3822e3fb242611c5b5..e407859c455c1a6349cc5df781f2f10125cb3c9d 100755 (executable)
@@ -41,7 +41,7 @@ test_multi_session() {
        for i in $(seq 0 3); do
                stop_lttng_tracing_ok "$SESSION_NAME-$i"
                destroy_lttng_session_ok "$SESSION_NAME-$i"
-               out=$($BABELTRACE_BIN "$TRACE_PATH/$i" | grep -c "$EVENT_NAME$i")
+               out=$(_run_babeltrace_cmd "$TRACE_PATH/$i" | grep -c "$EVENT_NAME$i")
                if [ "$out" -ne $NR_ITER ]; then
                        fail "Trace validation of $SESSION_NAME-$i"
                        diag "No events found."
index f1132c2e49e9218b465f1688b037f146a1891713..3ddd654bbaada23919c01114b31be8c8d8ee82fa 100755 (executable)
@@ -68,7 +68,7 @@ function validate_trace()
 {
        local out
 
-       out=$("$BABELTRACE_BIN" "$TRACE_PATH" | grep -c $EVENT_NAME)
+       out=$("_run_babeltrace_cmd" "$TRACE_PATH" | grep -c $EVENT_NAME)
        if [ "$out" -eq 0 ]; then
                fail "Trace validation"
                diag "No event(s) found. We are supposed to have at least one."
This page took 0.037107 seconds and 4 git commands to generate.