port: add support for BSD mktemp
[lttng-tools.git] / tests / regression / tools / exclusion / test_exclusion
index 00e364025e40655f216400dd1da47e6908746ca1..47deede0604b2b5dc1d3e0e4795157ecef9a4dea 100755 (executable)
@@ -40,7 +40,7 @@ function run_apps
 # of our test suite to generate events.
 function dry_run
 {
-       local trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
+       local trace_path=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
 
        # Create session
        create_lttng_session_ok $SESSION_NAME $trace_path
@@ -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
@@ -70,7 +70,7 @@ function test_exclusion
 {
        local exclusions="$1"
        local event_name_expected_to_be_missing="$2"
-       local trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
+       local trace_path=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
 
        # Create session
        create_lttng_session_ok $SESSION_NAME $trace_path
@@ -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
@@ -99,9 +99,9 @@ function test_exclusion_tracing_started
 {
        local exclusions="$1"
        local event_name_expected_to_be_missing="$2"
-       local trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
-       local file_wait_before_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_first.XXXXXX")
-       local file_create_in_main=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_create_in_main.XXXXXX")
+       local trace_path=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
+       local file_wait_before_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_first.XXXXXX")
+       local file_create_in_main=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_create_in_main.XXXXXX")
 
        # Create session
        create_lttng_session_ok $SESSION_NAME $trace_path
@@ -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"
This page took 0.023891 seconds and 4 git commands to generate.