tests: add check_skip_kernel_test to check root user and lttng kernel modules
[lttng-tools.git] / tests / regression / tools / filtering / test_valid_filter
index cfd8de3bfbe189b994f02e2bbdf0a76a866833f6..1d7b0db4726c25be78c1ab94b2cbd8a23636eb26 100755 (executable)
@@ -94,11 +94,10 @@ function test_valid_filter
        event_name="$3"
        filter="$4"
        validator="$5"
+       local trace_path=$(mktemp -d -t tmp.test_filtering_valid_filters_trace_path.XXXXXX)
 
        diag "Test valid $domain_name filter: $filter"
 
-       trace_path=$(mktemp -d)
-
        # Create session
        create_lttng_session_ok $SESSION_NAME $trace_path
 
@@ -111,9 +110,9 @@ function test_valid_filter
        stop_lttng_tracing_ok $SESSION_NAME
 
        # Destroy session
-       destroy_lttng_session_ok $SESSION_NAME
+       destroy_lttng_session_ok $SESSION_NAME --no-wait
 
-       stats=`babeltrace $trace_path | $STATS_BIN --tracepoint $event_name`
+       stats=`"$BABELTRACE_BIN" $trace_path | $STATS_BIN --tracepoint $event_name`
 
        rm -rf $trace_path
 
@@ -402,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 && "
@@ -1453,13 +1454,7 @@ KERNEL_FILTERS=(
 
 IFS=$OLDIFS
 
-if [ "$(id -u)" == "0" ]; then
-       isroot=1
-else
-       isroot=0
-fi
-
-skip $isroot "Root access is needed. Skipping all kernel valid filter tests." $NUM_KERNEL_TESTS ||
+check_skip_kernel_test "$NUM_KERNEL_TESTS" "Skipping kernel valid filter tests." ||
 {
        diag "Test kernel valid filters"
 
This page took 0.025243 seconds and 4 git commands to generate.