Tests: use babeltrace2 for all tests
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 8 Oct 2021 13:41:04 +0000 (09:41 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 29 Oct 2021 21:12:19 +0000 (17:12 -0400)
- Change value of `BABELTRACE_BIN` to `babeltrace2`,
- Replace all direct calls to babeltrace with calls to `BABELTRACE_BIN`
  variable,
- Add `bail_out_if_no_babeltrace` bash function to fail the test if
  Babeltrace 2 is needed but not found.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ieeffe4977660f47561732223e94a1b8f5a00ef0e

55 files changed:
README.adoc
tests/destructive/metadata-regeneration
tests/regression/kernel/test_callstack
tests/regression/kernel/test_clock_override
tests/regression/tools/base-path/test_ust
tests/regression/tools/channel/test_channel
tests/regression/tools/clear/test_kernel
tests/regression/tools/clear/test_ust
tests/regression/tools/crash/test_crash
tests/regression/tools/exclusion/test_exclusion
tests/regression/tools/filtering/test_invalid_filter
tests/regression/tools/filtering/test_valid_filter
tests/regression/tools/live/test_lttng_ust
tests/regression/tools/metadata/test_kernel
tests/regression/tools/metadata/test_ust
tests/regression/tools/regen-metadata/test_ust
tests/regression/tools/regen-statedump/test_ust
tests/regression/tools/relayd-grouping/test_ust
tests/regression/tools/rotation/test_kernel
tests/regression/tools/rotation/test_ust
tests/regression/tools/snapshots/test_kernel
tests/regression/tools/snapshots/test_ust_streaming
tests/regression/tools/snapshots/ust_test
tests/regression/tools/streaming/test_high_throughput_limits
tests/regression/tools/streaming/test_ust
tests/regression/tools/tracefile-limits/test_tracefile_count
tests/regression/tools/tracefile-limits/test_tracefile_size
tests/regression/tools/tracker/test_event_tracker
tests/regression/tools/trigger/start-stop/test_start_stop
tests/regression/tools/wildcard/test_event_wildcard
tests/regression/ust/baddr-statedump/test_baddr-statedump.py
tests/regression/ust/before-after/test_before_after
tests/regression/ust/blocking/test_blocking
tests/regression/ust/buffers-pid/test_buffers_pid
tests/regression/ust/daemon/test_daemon.py
tests/regression/ust/exit-fast/test_exit-fast.py
tests/regression/ust/fork/test_fork.py
tests/regression/ust/getcpu-override/test_getcpu_override
tests/regression/ust/high-throughput/test_high_throughput
tests/regression/ust/java-jul/test_java_jul
tests/regression/ust/java-log4j/test_java_log4j
tests/regression/ust/libc-wrapper/test_libc-wrapper.py
tests/regression/ust/linking/test_linking.py
tests/regression/ust/low-throughput/test_low_throughput
tests/regression/ust/multi-lib/test_multi_lib
tests/regression/ust/namespaces/test_ns_contexts
tests/regression/ust/namespaces/test_ns_contexts_change
tests/regression/ust/overlap/test_overlap
tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush
tests/regression/ust/test_event_perf
tests/regression/ust/test_event_tracef
tests/regression/ust/type-declarations/test_type_declarations.py
tests/regression/ust/ust-dl/test_ust-dl.py
tests/utils/test_utils.py
tests/utils/utils.sh

index e9ff9a812312d3c3ded34b4f4ad83c766695f9b5..b9669d941302a26ce00cdbd1147095b699d5d57a 100644 (file)
@@ -73,7 +73,8 @@ Debian/Ubuntu package: `libxml2{nbh}dev`
 The following dependencies are optional:
 
 * **https://babeltrace.org/[Babeltrace{nbsp}2]**: default viewer
-  of the https://lttng.org/man/1/lttng-view/[`lttng view`] command.
+  of the https://lttng.org/man/1/lttng-view/[`lttng view`] command,
+  `make{nbsp}check` and tests.
 +
 Debian/Ubuntu package: `babeltrace2`
 
index b81e7af32d22d1c1614f8c55409392d61e28711f..449dc05be7749d4ecc0b1360b6a9e7f8153945c2 100755 (executable)
@@ -38,16 +38,14 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
+
 function validate_trace_date
 {
        local test_date=$1
        local trace_path=$2
 
-       which $BABELTRACE_BIN >/dev/null
-       if [ $? -ne 0 ]; then
-           skip 0 "Babeltrace binary not found. Skipping trace validation"
-       fi
-
        res=$($BABELTRACE_BIN --clock-date $trace_path 2>/dev/null | head -1 | grep $test_date)
        if [ $? -eq 0 ]; then
                pass "Validate trace at date $test_date"
index b5759d442d1670f158e01ec4603eca4a884cd13a..ad506b5534f603e67153d1d7a28fd3cc3bd0512f 100755 (executable)
@@ -134,6 +134,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 if [ "$(id -u)" == "0" ]; then
        isroot=1
 else
@@ -142,18 +144,13 @@ fi
 
 skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" ||
 {
-       which "$BABELTRACE_BIN" > /dev/null
-       test $? -ne 0
-       skip $? "Babeltrace binary not found. Skipping callstack tests" "$NUM_TESTS" ||
-       {
-               start_lttng_sessiond
+       start_lttng_sessiond
 
-               if test $RUN_USERSPACE_TEST == 1; then
-                       test_user_callstack
-               fi
+       if test $RUN_USERSPACE_TEST == 1; then
+               test_user_callstack
+       fi
 
-               test_kernel_callstack
+       test_kernel_callstack
 
-               stop_lttng_sessiond
-       }
+       stop_lttng_sessiond
 }
index cef30dc30dd048c9ccf001343b413049c4966630..9dcde73d821e2939ddb2efcf39370b71becca5af 100755 (executable)
@@ -164,6 +164,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 TESTS=(
        "test_clock_override_metadata"
        "test_clock_override_timestamp"
index fd1a67af8147d370e62eb21d8a18b2409a29e78d..38a0877531c8ea94ace15f2000140f40a5e0cda9 100755 (executable)
@@ -155,6 +155,7 @@ function ust_app_stream_base_path_via_load ()
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
 
 start_lttng_relayd "-o $TRACE_PATH"
 start_lttng_sessiond
index eaae3d9c1704505dea790a9c6523fe1066058d01..7244ac3c7d5f7e558dae133e21aae4cac5ded596 100755 (executable)
@@ -64,6 +64,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 
 if [ ! -x "$TESTAPP_BIN" ]; then
index c12a153c52dac980814981c97cddbaeed4b00b1b..0229f5f92d1defd72ca29f8cb73eda43a834c8e4 100755 (executable)
@@ -535,6 +535,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 if [ "$(id -u)" == "0" ]; then
        isroot=1
 else
index 8edc722928d2ee7ad4be88b4796a81be367cb5f1..27cd71fe9299b21f0778c407c4edc0f4f9a98b36 100755 (executable)
@@ -803,6 +803,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 streaming_tests=(test_ust_streaming
        test_ust_streaming_rotate_clear
        test_ust_streaming_clear_rotate
index 8201c56bc24b6cc96db736542481408386c63160..7570ba9b96864de9eeb43f7707222147d4e0e4ca 100755 (executable)
@@ -35,6 +35,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 function start_test_app()
 {
        local tmp_file=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}.XXXXXX")
index 00e364025e40655f216400dd1da47e6908746ca1..0c9bdc8294effaa40260f0e8a2d587135a92661f 100755 (executable)
@@ -53,7 +53,7 @@ function dry_run
        run_apps
        stop_lttng_tracing_ok $SESSION_NAME
 
-       nb_events=$(babeltrace $trace_path | wc -l)
+       nb_events=$("$BABELTRACE_BIN" $trace_path | wc -l)
        if [ "$nb_events" -ne "0" ]; then
                ok 0 "Events were found during the dry run without exclusion"
        else
@@ -86,7 +86,7 @@ function test_exclusion
        # Destroy session
        destroy_lttng_session_ok $SESSION_NAME
 
-       stats=`babeltrace $trace_path | $STATS_BIN --tracepoint "$event_name_expected_to_be_missing" | grep -v index 2> /dev/null`
+       stats=`"$BABELTRACE_BIN" $trace_path | $STATS_BIN --tracepoint "$event_name_expected_to_be_missing" | grep -v index 2> /dev/null`
        if [ ! -z "$stats" ]; then
                fail "Excluded event \"$event_name_expected_to_be_missing\" was found in trace!"
        else
@@ -139,7 +139,7 @@ function test_exclusion_tracing_started
        # Destroy session
        destroy_lttng_session_ok $SESSION_NAME
 
-       stats=$(babeltrace $trace_path | $STATS_BIN --tracepoint "$event_name_expected_to_be_missing" | grep -v index 2> /dev/null)
+       stats=$("$BABELTRACE_BIN" $trace_path | $STATS_BIN --tracepoint "$event_name_expected_to_be_missing" | grep -v index 2> /dev/null)
        if [ ! -z "$stats" ]; then
                fail "Excluded event \"$event_name_expected_to_be_missing\" was found in trace!"
        else
@@ -174,6 +174,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 
 diag "Enable event without exclusion"
index 7d9e524d986fad0a94426cf1eef6d46c0b706fed..01306123929a843e5531776deb400660e116c3f7 100755 (executable)
@@ -94,6 +94,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 OLDIFS="$IFS"
 IFS=$'\n'
 INVALID_FILTERS=(
index e76ffa25f2480998be378929cda20ef9dde369a4..7e764ca5d0caf10fc5ecee465dbca50ba719e932 100755 (executable)
@@ -112,7 +112,7 @@ function test_valid_filter
        # Destroy session
        destroy_lttng_session_ok $SESSION_NAME
 
-       stats=`babeltrace $trace_path | $STATS_BIN --tracepoint $event_name`
+       stats=`"$BABELTRACE_BIN" $trace_path | $STATS_BIN --tracepoint $event_name`
 
        rm -rf $trace_path
 
@@ -401,6 +401,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 issue_356_filter="intfield > 0 && intfield > 1 && "
 issue_356_filter+="intfield > 2 && intfield > 3 && "
 issue_356_filter+="intfield > 4 && intfield > 5 && "
index aceb08e415f5056b624afd29a18fae5a6b4a53f0..3aa1083b0518da95fe5d3e9f86dc2b3fa7ab71a8 100755 (executable)
@@ -32,6 +32,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 function test_custom_url()
 {
        # Create session with custom URL
index 57cace6eaac5a974b154baaf762f56a78e6833e2..08743008bccf339052669b31cca6756d0b8b1da6 100755 (executable)
@@ -90,6 +90,7 @@ function test_kernel ()
 plan_tests $NUM_TESTS
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
 
 if [ "$(id -u)" == "0" ]; then
        isroot=1
index 810a226cf9fd7e3ec26d9eecc508202d3fd5d428..6b17b02cf6439eed92c09057254a00d01755ae84 100755 (executable)
@@ -222,6 +222,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 # Use LTTNG_HOME since we want the complete "default" lttng directory hierarchy
 # with "<session_name>-<datetime>/...".
 LTTNG_HOME="$TRACE_PATH"
index cc3aed9cfcddd38364f6ff89fae1166461ff8e67..60735c3649c1e73a89ad0b1a6c31a95de61dff39 100755 (executable)
@@ -195,6 +195,7 @@ function test_ust_live ()
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
 
 start_lttng_relayd "-o $TRACE_PATH"
 start_lttng_sessiond
index 8572e254546b9cedc40d8ec039ec6a7c93d8d38a..29e1d1b9d2c1c84100dd141321448311336688d7 100755 (executable)
@@ -64,6 +64,7 @@ function test_ust_local ()
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
 
 start_lttng_sessiond
 
index 579881492123d31dd2f327bfdc3670749544b494..eecf952074e49a7c919bd4d0fe48abffca9cfe1d 100755 (executable)
@@ -642,6 +642,7 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
 
 tests=(
        test_ust_uid_live
index f5f1f5553ccc2d55fb7154e358b990e738dbf115..d4a66c50855fec9f3c1434d6dc7f6a4578cb096e 100755 (executable)
@@ -81,6 +81,7 @@ function test_kernel_streaming_timer ()
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
 
 if [ "$(id -u)" == "0" ]; then
        isroot=1
index 4d295d6e99151e21b4b2f21d25dc14f57406a0ec..278684d67d1fe78ef8a2b6ccf2d852f1bcddb238 100755 (executable)
@@ -187,6 +187,7 @@ function test_incompatible_sessions ()
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
 
 start_lttng_relayd "-o $TRACE_PATH"
 start_lttng_sessiond
index 8cac901e7dff69d0da3e6fc9fc5d651becbcdd55..c99802d547af98545821e37f2d3bf1dc4d5bcc80 100755 (executable)
@@ -215,6 +215,9 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
+
 if [ "$(id -u)" == "0" ]; then
        isroot=1
 else
index ed109abd4695f982a1056f1d505d8ab5c3c7f576..24e52c4161db2dd8de065ba084174860f883c4df 100755 (executable)
@@ -232,6 +232,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 if [ "$(id -u)" == "0" ]; then
        isroot=1
 else
index 54365c3eacde059d477581c4d0819568c367a8f1..e2e84b5c343017177f890a782d8d941f00ec9233 100755 (executable)
@@ -479,6 +479,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 tests=( test_ust_list_output
        test_ust_local_snapshot
index 2b9e3ad3942222eac8466448d9866addc0240b62..cd97dc7769ce8ae19913d6f2df3cd923b8e12937 100755 (executable)
@@ -129,8 +129,8 @@ function validate_event_count
        TEMP_FILE=$(mktemp --tmpdir tmp.streaming_high_throughput_limit_file1.XXXXXX)
        TEMP_FILE_2=$(mktemp --tmpdir tmp.streaming_high_throughput_limit_file2.XXXXXX)
 
-       traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l)
-       babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
+       traced=$("$BABELTRACE_BIN" $TRACE_PATH 2>/dev/null | wc -l)
+       "$BABELTRACE_BIN" $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
 
        cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE
 
@@ -170,6 +170,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 if [ "$(id -u)" == "0" ]; then
        isroot=1
 else
index 2e15bd4c6b28f88cfedc75b8336a4d5e2823c30e..b88e945f8e0cd43da0abc938a3239123ae7d99ed 100755 (executable)
@@ -79,6 +79,7 @@ function test_ust_after_start ()
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
 
 start_lttng_relayd "-o $TRACE_PATH"
 start_lttng_sessiond
index 244910dd680dfa1003678ed7a2ca71818e9eb0ba..5ca10ac231bc6e407a94983f4a56e7162d473200 100755 (executable)
@@ -134,7 +134,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 $trace_path | $STATS_BIN --tracepoint $event_name`
+       stats=`"$BABELTRACE_BIN" $trace_path | $STATS_BIN --tracepoint $event_name`
 
        validate_min_max "$stats" "intfield" "[0-9]+" "$expected_max"
        ok $? "Trace validation - intfield"
@@ -154,6 +154,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 
 for limit in "${LIMITS[@]}";
index bbfc27c9e01ff25c383f8787a0879ce34b3d47be..5d9f21b604de63f20b08d974e282356ca94bb246 100755 (executable)
@@ -164,6 +164,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 
 # Test with multiples of PAGE_SIZE
index cc0f698d2e45b05253889246ec07c1b28c551fbb..deecb8f8072ab7969a6608962781842c6e635ee4 100755 (executable)
@@ -395,6 +395,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 
 diag "Test UST tracker"
index c3a4e7fbd891be114f9752433ec682a3cf78198e..823fb27a8e8eeb6b83b4bd241fd08b2806f63426 100755 (executable)
@@ -148,6 +148,7 @@ function test_stop_session_action()
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
 
 start_lttng_sessiond_notap
 
index f69baffc430ac2e5d3d1e6df50136a5cbaa40958..c226461753b919759adc51239dbe614c998b8523 100755 (executable)
@@ -85,6 +85,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 
 diag "Test UST wildcard"
index 026f084445e8ec9d24e06854dfc021f96b8eb755..c145972bb7fe4071c435d2bbac71c42c0c84a47b 100644 (file)
@@ -44,9 +44,9 @@ stop_session(session_info)
 
 # Check for statedump events in the resulting trace
 try:
-    babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 except FileNotFoundError:
-    bail("Could not open babeltrace. Please make sure it is installed.", session_info)
+    bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN), session_info)
 
 start_event_found = False
 bin_info_event_found = False
index de07d31a4029d3b1140831d3651bbb4074bfb8aa..0c3ebec5485f3609e5802361a8d88017b04ac02b 100755 (executable)
@@ -80,6 +80,7 @@ function test_after_apps()
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
 
 start_lttng_sessiond
 
index 617d9a27833a901273735b255dabee9d29faaf78..ca864353248d29f1fbc603ddb5102d3c4cd40437 100755 (executable)
@@ -123,7 +123,7 @@ function test_ust_blocking_no_discard()
        destroy_lttng_session_ok $SESSION_NAME
        stop_lttng_sessiond
 
-       nr_events=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l)
+       nr_events=$("$BABELTRACE_BIN" $TRACE_PATH 2>/dev/null | wc -l)
 
        test $nr_events -eq $NUM_EVENT
        ok $? "No event lost with UST blocking mode: found $nr_events expect $NUM_EVENT"
@@ -133,6 +133,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 TESTS=(
        "test_ust_implicit_no_blocking"
        "test_ust_implicit_no_blocking_with_channel_blocking"
index 48c09538e84266d1a43acc0e37d3a8c04aff6d9e..982ee2d58dff73a25f7c0f4a41589634b317d601 100755 (executable)
@@ -98,7 +98,7 @@ test_before_multiple_apps() {
                rm -f ${file_sync_before_last}_${i}
        done
 
-       out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
+       out=$("$BABELTRACE_BIN" $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 $TRACE_PATH | grep $EVENT_NAME | wc -l)
+       out=$("$BABELTRACE_BIN" $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."
@@ -222,6 +222,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 TESTS=(
        "test_before_app"
        "test_after_app"
index 0351f1d21c1a239cbb235db7b6f538bd666636f8..46df102b9bb42284e1d124ab08763cffabf841d0 100644 (file)
@@ -57,9 +57,9 @@ if daemon_process_return_code != 0:
 stop_session(session_info)
 
 try:
-    babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE)
+    babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE)
 except FileNotFoundError:
-    bail("Could not open babeltrace. Please make sure it is installed.")
+    bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN))
 
 before_daemon_event_found = False
 before_daemon_event_pid = -1
index f61d540b344e2ec55f05d418761636e2cb09990a..aaacd4529049ac5a2d19ed27ca3d5d0125189ca9 100644 (file)
@@ -49,9 +49,9 @@ stop_session(session_info)
 
 # Check both events (normal exit and suicide messages) are present in the resulting trace
 try:
-    babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 except FileNotFoundError:
-    bail("Could not open babeltrace. Please make sure it is installed.")
+    bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN))
 
 event_lines = []
 for event_line in babeltrace_process.stdout:
index 4cb721f38ac6b4f0b44325c8d2c8b8bc15892602..3c9a2ea91e538e0d781fe6fb826754894dc94252 100644 (file)
@@ -52,9 +52,9 @@ stop_session(session_info)
 
 # Check both events (normal exit and suicide messages) are present in the resulting trace
 try:
-    babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 except FileNotFoundError:
-    bail("Could not open babeltrace. Please make sure it is installed.", session_info)
+    bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN))
 
 event_lines = []
 for event_line in babeltrace_process.stdout:
index 7553b685bb89f1de6fc796d1616ed6f70d43039c..124219a36757352c743d563ff5004cc8aef69745 100755 (executable)
@@ -147,6 +147,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 if [ ! -x "$CURDIR/.libs/lttng-ust-getcpu-override-test.so" ]; then
        skip 0 "No shared object generated. Skipping all tests." $NUM_TESTS && exit 0
 fi
index 1640e3994f49b795dd9f91dd35e20155f1382f7b..873646fa912ab77b7ea8c1fd11e42c3990bc7fdd 100755 (executable)
@@ -28,6 +28,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 
 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
@@ -53,8 +55,8 @@ stop_lttng_sessiond
 TEMP_FILE=$(mktemp --tmpdir tmp.test_high_throughput_tmp_file1.XXXXXX)
 TEMP_FILE_2=$(mktemp --tmpdir tmp.test_high_throughput_tmp_file2.XXXXXX)
 
-traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l)
-babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
+traced=$("$BABELTRACE_BIN" $TRACE_PATH 2>/dev/null | wc -l)
+"$BABELTRACE_BIN" $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
 
 cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE
 
index f2244cb7247bbde0e06d24c5e22f781280490063..90c1758e1131fabbf68ad5cba1e87bd1f353d207 100755 (executable)
@@ -662,6 +662,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 if [ ! -f "$TESTAPP_PATH.class" ]; then
        withapp=0
 else
index fc16e02d05c9304354090f801088cbb2ea41bcf1..ed4302879e5ac183f3de1b2e2d987773846e3ce1 100755 (executable)
@@ -661,6 +661,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 if [ ! -f "$TESTAPP_PATH.class" ]; then
        withapp=0
 else
index f56fa50def85e4aa8ac3bfafa2d233ceb9b7a2d1..f07152a28a97bd8aab0d7dd6e4b54878abba3bb7 100644 (file)
@@ -41,9 +41,9 @@ stop_session(session_info)
 
 # Check for malloc events in the resulting trace
 try:
-    babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 except FileNotFoundError:
-    bail("Could not open babeltrace. Please make sure it is installed.", session_info)
+    bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN), session_info)
 
 malloc_event_found = False
 free_event_found = False
index 21941f0d2d4918db1f19428a1b15d40bcfd71241..264747ea68aeca8f8742ad46cbc3d36ac89b280e 100644 (file)
@@ -133,9 +133,9 @@ for executable in test_executables:
         continue
 
     try:
-        babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     except FileNotFoundError:
-        bail("Could not open babeltrace. Please make sure it is installed.")
+        bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN))
 
     # We should find 8 events in the resulting trace
     event_entries = []
index 66ed8950fd73648a294ad68842d8b9e839b662ec..e03d9f01eff5f4ef8c171b8d9f6659e795244c4a 100755 (executable)
@@ -27,6 +27,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 
 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
@@ -47,7 +49,7 @@ stop_lttng_sessiond
 last_val=0
 out=0
 
-babeltrace $TRACE_PATH | while read event;
+"$BABELTRACE_BIN" $TRACE_PATH | while read event;
 do
        val=$(echo $event | cut -f10 -d" ")
        val=${val%?}
index 23821ed0f9699aba83865264cc03fddba36adcfa..94caee5dba02b78519e5aea1663822b39a802602 100755 (executable)
@@ -217,6 +217,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 TESTS=(
        "test_dlopen_same_provider_name_same_event"
        "test_dlopen_same_provider_name_different_event"
index be038eb28ecf734255fcf62ada37e56d57ec50fd..e65cc247598533bf2f2053f38d7687395ed756e3 100755 (executable)
@@ -76,6 +76,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 system_has_ns=0
 if [ -d "/proc/$$/ns" ]; then
        system_has_ns=1
index 8a4b62ce3a4ff2a04542ae062ee2686b325ce632..78fc37b5d1973b14a8d969fcbb2326f4fa256798 100755 (executable)
@@ -101,6 +101,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 isroot=0
 if [ "$(id -u)" == "0" ]; then
        isroot=1
index d10284e0660017a7e825137dba07d464a335712e..a942d066afae2fea9ef8ac99521711a421010219 100755 (executable)
@@ -602,6 +602,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 if [ -x "$CURDIR/demo/demo" ]; then
        foundbin=1
 else
index f9f4f1c950f83b8667bfb52f55991e093b8caf55..d81d475d47632efc57645e403ec94037ffeae803 100755 (executable)
@@ -68,7 +68,7 @@ function validate_trace()
 {
        local out
 
-       out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
+       out=$("$BABELTRACE_BIN" $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."
@@ -298,6 +298,7 @@ test_before_app_uid() {
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
 
 TESTS=(
        "test_before_app_uid"
index 33aab2981272beb8e9695f77c568660aa29aa1e9..01c137a19b23a3b3d72f32b11416d152e764822a 100755 (executable)
@@ -119,6 +119,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 if [ "$(id -u)" == "0" ]; then
         isroot=1
 else
index ca14c73f5f49d2c63184e5d78e945506b5684b93..2d7a6415492a07166be69af9a63a36c8d59dd04e 100755 (executable)
@@ -45,6 +45,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 
 TRACE_PATH=$(mktemp --tmpdir -d tmp.test_event_tracef_trace_path.XXXXXX)
index 62eda73a38a7492a93de02e186d3401420fcfbe8..bdb649b9a1f2400d1196f30aafa04ba6cdeab232 100644 (file)
@@ -43,9 +43,9 @@ stop_session(session_info)
 
 # Check event fields using type declarations are present
 try:
-    babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 except FileNotFoundError:
-    bail("Could not open babeltrace. Please make sure it is installed.")
+    bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN))
 
 event_lines = []
 for event_line in babeltrace_process.stdout:
index 96509c7cf798aeb15836d43ce9ce7b618a9f3aca..04903af260d02417a4814f1d964f807a966dbfb3 100644 (file)
@@ -52,9 +52,9 @@ stop_session(session_info)
 
 # Check for dl events in the resulting trace
 try:
-    babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 except FileNotFoundError:
-    bail("Could not open babeltrace. Please make sure it is installed.", session_info)
+    bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN), session_info)
 
 dlopen_event_found = 0
 dlmopen_event_found = 0
index afe066d7692610b2bf0b79638ff63c5ec8d883cd..ba9c2946e7654cea703f74cd43b23a872ec662b9 100644 (file)
@@ -22,6 +22,7 @@ sys.path.append(lttng_bindings_path)
 sys.path.append(lttng_bindings_libs_path)
 from lttng import *
 
+BABELTRACE_BIN="babeltrace2"
 
 class SessionInfo:
     def __init__(self, handle, session_name, tmp_directory, channel_name):
index 42d99444fc8e1c4d977f69aab80435da1a50043e..c6d627cef40134efdefd7e3c0c6b916215adf3a4 100644 (file)
@@ -12,7 +12,7 @@ CONSUMERD_MATCH=".*lttng-consumerd.*"
 RELAYD_BIN="lttng-relayd"
 RELAYD_MATCH=".*lttng-relayd.*"
 LTTNG_BIN="lttng"
-BABELTRACE_BIN="babeltrace"
+BABELTRACE_BIN="babeltrace2"
 OUTPUT_DEST=/dev/null
 ERROR_OUTPUT_DEST=/dev/null
 MI_XSD_MAJOR_VERSION=4
@@ -1841,6 +1841,14 @@ function wait_live_viewer_connect ()
        pass "Waiting for live viewers on url: $url"
 }
 
+function bail_out_if_no_babeltrace()
+{
+       which "$BABELTRACE_BIN" >/dev/null
+       if [ $? -ne 0 ]; then
+               LTTNG_BAIL_OUT "\"$BABELTRACE_BIN\" binary not found. Skipping tests"
+       fi
+}
+
 function validate_metadata_event ()
 {
        local event_name=$1
@@ -1850,8 +1858,7 @@ function validate_metadata_event ()
        local metadata_file=$(find $trace_path -name "metadata")
        local metadata_path=$(dirname $metadata_file)
 
-       which $BABELTRACE_BIN >/dev/null
-       skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches"
+       bail_out_if_no_babeltrace
 
        local count=$($BABELTRACE_BIN --output-format=ctf-metadata $metadata_path | grep $event_name | wc -l)
 
@@ -1870,8 +1877,7 @@ function trace_matches ()
        local nr_iter=$2
        local trace_path=$3
 
-       which $BABELTRACE_BIN >/dev/null
-       skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches"
+       bail_out_if_no_babeltrace
 
        local count=$($BABELTRACE_BIN $trace_path | grep $event_name | wc -l)
 
@@ -1889,8 +1895,9 @@ function trace_match_only()
        local nr_iter=$2
        local trace_path=$3
 
-       which $BABELTRACE_BIN >/dev/null
-       skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches"
+       bail_out_if_no_babeltrace
+       #which "$BABELTRACE_BIN" >/dev/null
+       #skip $? -ne 0 "\"$BABELTRACE_BIN\" binary not found. Skipping trace comparison"
 
        local count=$($BABELTRACE_BIN $trace_path | grep $event_name | wc -l)
        local total=$($BABELTRACE_BIN $trace_path | wc -l)
@@ -1908,10 +1915,7 @@ function validate_trace
        local event_name=$1
        local trace_path=$2
 
-       which $BABELTRACE_BIN >/dev/null
-       if [ $? -ne 0 ]; then
-           skip 0 "Babeltrace binary not found. Skipping trace validation"
-       fi
+       bail_out_if_no_babeltrace
 
        OLDIFS=$IFS
        IFS=","
@@ -1935,10 +1939,7 @@ function validate_trace_count
        local trace_path=$2
        local expected_count=$3
 
-       which $BABELTRACE_BIN >/dev/null
-       if [ $? -ne 0 ]; then
-           skip 0 "Babeltrace binary not found. Skipping trace validation"
-       fi
+       bail_out_if_no_babeltrace
 
        cnt=0
        OLDIFS=$IFS
@@ -1965,10 +1966,7 @@ function validate_trace_count_range_incl_min_excl_max
        local expected_min=$3
        local expected_max=$4
 
-       which $BABELTRACE_BIN >/dev/null
-       if [ $? -ne 0 ]; then
-           skip 0 "Babeltrace binary not found. Skipping trace validation"
-       fi
+       bail_out_if_no_babeltrace
 
        cnt=0
        OLDIFS=$IFS
@@ -1992,11 +1990,6 @@ function trace_first_line
 {
        local trace_path=$1
 
-       which $BABELTRACE_BIN >/dev/null
-       if [ $? -ne 0 ]; then
-           skip 0 "Babeltrace binary not found. Skipping trace validation"
-       fi
-
        $BABELTRACE_BIN $trace_path 2>/dev/null | head -n 1
 }
 
@@ -2005,8 +1998,7 @@ function validate_trace_exp()
        local event_exp=$1
        local trace_path=$2
 
-       which $BABELTRACE_BIN >/dev/null
-       skip $? -ne 0 "Babeltrace binary not found. Skipping trace validation"
+       bail_out_if_no_babeltrace
 
        traced=$($BABELTRACE_BIN $trace_path 2>/dev/null | grep --extended-regexp ${event_exp} | wc -l)
        if [ "$traced" -ne 0 ]; then
@@ -2024,8 +2016,7 @@ function validate_trace_only_exp()
        local event_exp=$1
        local trace_path=$2
 
-       which $BABELTRACE_BIN >/dev/null
-       skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches"
+       bail_out_if_no_babeltrace
 
        local count=$($BABELTRACE_BIN $trace_path | grep --extended-regexp ${event_exp} | wc -l)
        local total=$($BABELTRACE_BIN $trace_path | wc -l)
@@ -2044,10 +2035,7 @@ function validate_trace_empty()
 {
        local trace_path=$1
 
-       which $BABELTRACE_BIN >/dev/null
-       if [ $? -ne 0 ]; then
-           skip 0 "Babeltrace binary not found. Skipping trace validation"
-       fi
+       bail_out_if_no_babeltrace
 
        events=$($BABELTRACE_BIN $trace_path 2>/dev/null)
        ret=$?
This page took 0.047408 seconds and 4 git commands to generate.