tests: add check_skip_kernel_test to check root user and lttng kernel modules
[lttng-tools.git] / tests / regression / tools / notification / test_notification_kernel_capture
index 88a3691eb6500ee568dadedf651230076757fb7c..b65310d8801a6a50c0261db12ad330ef7f6620a4 100755 (executable)
@@ -31,22 +31,21 @@ function test_basic_error_path
 }
 
 
-if [ "$(id -u)" == "0" ]; then
-       validate_lttng_modules_present
+check_skip_kernel_test &&
+{
+       plan_skip_all "Skipping all tests."
+       exit 0
+}
 
-       modprobe lttng-test
+validate_lttng_modules_present
 
-       start_lttng_sessiond_notap
+modprobe lttng-test
 
-       test_basic_error_path
+start_lttng_sessiond_notap
 
-       stop_lttng_sessiond_notap
-       rmmod lttng-test
+test_basic_error_path
 
-else
-       # Kernel tests are skipped.
-       plan_tests $NUM_TESTS
-       skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
-fi
+stop_lttng_sessiond_notap
+rmmod lttng-test
 
 rm -f "$TESTAPP_STATE_PATH"
This page took 0.023843 seconds and 4 git commands to generate.