tests: add check_skip_kernel_test to check root user and lttng kernel modules
[lttng-tools.git] / tests / regression / tools / wildcard / test_event_wildcard
index a15ff2af80243ddc47412cfde22a0899d3c390fc..8777424196e52169f02679e929d88bcbd2104e2e 100755 (executable)
@@ -14,6 +14,7 @@ TESTAPP_NAME="gen-ust-events"
 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 SESSION_NAME="wildcard"
 NR_ITER=100
+NR_USEC_WAIT=1
 NUM_GLOBAL_TESTS=2
 NUM_UST_TESTS=$(( 7 * 25 ))
 NUM_KERNEL_TESTS=$(( 7 * 25 ))
@@ -34,7 +35,7 @@ function run_kernel
 
 function test_event_wildcard()
 {
-       TRACE_PATH=$(mktemp -d)
+       TRACE_PATH=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
        DOMAIN="$1"
        FIND="$2"
        WILDCARD="$3"
@@ -68,7 +69,7 @@ function test_event_wildcard()
 
 function test_event_wildcard_fail()
 {
-       TRACE_PATH=$(mktemp -d)
+       TRACE_PATH=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
        DOMAIN="$1"
        WILDCARD="$2"
 
@@ -84,6 +85,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 start_lttng_sessiond
 
 diag "Test UST wildcard"
@@ -123,13 +126,7 @@ test_event_wildcard ust 1 'tp*tptest'
 test_event_wildcard ust 1 'tp**tptest'
 test_event_wildcard ust 1 'tp*test'
 
-if [ "$(id -u)" == "0" ]; then
-       isroot=1
-else
-       isroot=0
-fi
-
-skip $isroot "Root access is needed. Skipping all kernel wildcard tests." $NUM_KERNEL_TESTS ||
+check_skip_kernel_test "$NUM_KERNEL_TESTS" "Skipping kernel wildcard tests." ||
 {
        diag "Test kernel wildcards"
 
@@ -166,7 +163,7 @@ skip $isroot "Root access is needed. Skipping all kernel wildcard tests." $NUM_K
        test_event_wildcard kernel 1 'lttng*test*filter*event'
        test_event_wildcard kernel 1 '*lttng*test*filter*event*'
 
-       rmmod lttng-test
+       modprobe --remove lttng-test
 }
 
 stop_lttng_sessiond
This page took 0.024613 seconds and 4 git commands to generate.