diff mbox series

lttng-tools: add a flag to test the userspace only

Message ID 20231201140430.792362-1-xiangyu.chen@eng.windriver.com
State New
Headers show
Series lttng-tools: add a flag to test the userspace only | expand

Commit Message

Xiangyu Chen Dec. 1, 2023, 2:04 p.m. UTC
From: Xiangyu Chen <xiangyu.chen@windriver.com>

The current tests will run both userspace and kernel testing.
Some of use cases only use lttng for one kind of tracing (e.g. userspace).
If the lttng modules(.ko files) is not present during the test,
it would end up with lots of failing.

This commit separate the tests by allowing a flag to be passed
and marked the kernel related tests as SKIP instead of FAIL
if the modules is not presented.

If running the userspace test, just raise an environment variant
"export SKIP_KERNEL_TEST=1" before running the ptest, it would skip
lttng modules related test. Without SKIP_KERNEL_TEST=1, the ptest
would run all test cases.

Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
---
 ...d-flags-to-test-lttng-userspace-only.patch | 862 ++++++++++++++++++
 .../lttng/lttng-tools_2.13.11.bb              |   1 +
 2 files changed, 863 insertions(+)
 create mode 100644 meta/recipes-kernel/lttng/lttng-tools/0001-Tests-Add-flags-to-test-lttng-userspace-only.patch

Comments

Ross Burton Dec. 13, 2023, 10:56 a.m. UTC | #1
On 1 Dec 2023, at 14:04, Xiangyu Chen via lists.openembedded.org <xiangyu.chen=eng.windriver.com@lists.openembedded.org> wrote:
> If running the userspace test, just raise an environment variant
> "export SKIP_KERNEL_TEST=1" before running the ptest, it would skip
> lttng modules related test. Without SKIP_KERNEL_TEST=1, the ptest
> would run all test cases.

Is this something we want to automatically do?  Checking if the module can be loaded before running the ptest, or something.

Cheers,
Ross
Xiangyu Chen Dec. 14, 2023, 1:43 a.m. UTC | #2
Hi Ross,


On 12/13/23 18:56, Ross Burton wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On 1 Dec 2023, at 14:04, Xiangyu Chen via lists.openembedded.org <xiangyu.chen=eng.windriver.com@lists.openembedded.org> wrote:
>> If running the userspace test, just raise an environment variant
>> "export SKIP_KERNEL_TEST=1" before running the ptest, it would skip
>> lttng modules related test. Without SKIP_KERNEL_TEST=1, the ptest
>> would run all test cases.
> Is this something we want to automatically do?  Checking if the module can be loaded before running the ptest, or something.

How about make the kernel module detection as an function encapsulation 
in testing script instead of

export environment variant by manual? Calling the kernel module detector 
function before

testing kernel related features in test scripts, if kernel module is 
normal run the test, otherwise, skip it.

That can keep ptest automatically to test both all cases and userspace 
cases only.


Thanks,

Xiangyu


>
> Cheers,
> Ross
Ross Burton Dec. 14, 2023, 10:43 a.m. UTC | #3
On 14 Dec 2023, at 01:43, Xiangyu Chen <xiangyu.chen@eng.windriver.com> wrote:
> 
> Hi Ross,
> 
> 
> On 12/13/23 18:56, Ross Burton wrote:
>> CAUTION: This email comes from a non Wind River email account!
>> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>> 
>> On 1 Dec 2023, at 14:04, Xiangyu Chen via lists.openembedded.org <xiangyu.chen=eng.windriver.com@lists.openembedded.org> wrote:
>>> If running the userspace test, just raise an environment variant
>>> "export SKIP_KERNEL_TEST=1" before running the ptest, it would skip
>>> lttng modules related test. Without SKIP_KERNEL_TEST=1, the ptest
>>> would run all test cases.
>> Is this something we want to automatically do?  Checking if the module can be loaded before running the ptest, or something.
> 
> How about make the kernel module detection as an function encapsulation in testing script instead of
> 
> export environment variant by manual? Calling the kernel module detector function before
> 
> testing kernel related features in test scripts, if kernel module is normal run the test, otherwise, skip it.
> 
> That can keep ptest automatically to test both all cases and userspace cases only.

Yeah, that would also work.  Ideally work with upstream to solve the as much of the problem there so we’re having to carry the smallest amount of extra logic or patches.

Ross
diff mbox series

Patch

diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-Tests-Add-flags-to-test-lttng-userspace-only.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-Tests-Add-flags-to-test-lttng-userspace-only.patch
new file mode 100644
index 0000000000..4678348347
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-tools/0001-Tests-Add-flags-to-test-lttng-userspace-only.patch
@@ -0,0 +1,862 @@ 
+From 747c8ff5eac97533ee21fe50618fa4bfc575d533 Mon Sep 17 00:00:00 2001
+From: Xiangyu Chen <xiangyu.chen@windriver.com>
+Date: Wed, 29 Nov 2023 08:16:23 +0000
+Subject: [PATCH] Tests: Add flags to test lttng userspace only
+
+The current tests will run both userspace and kernel testing.
+Some of use cases only use lttng for one kind of tracing on an embedded device (e.g. userspace)
+If the lttng modules(.ko files) is not present during the test, it would end up with lots
+of failing.
+
+This commit separate the tests by allowing a flag to be passed and marked the kernel related
+tests as SKIP instead of FAIL if the modules is not presented.
+
+e.g. before running the tests with make, add a flag to environment like "export SKIP_KERNEL_TEST=1"
+the test cases would skip kernel test.
+
+Tested with this commit under a local setup, the result as below:
+
+====================================================
+lttng-tools 2.13.11: tests/unit/test-suite.log
+====================================================
+     TOTAL: 1032
+     PASS:  1032
+     SKIP:  0
+     XFAIL: 0
+     FAIL:  0
+     XPASS: 0
+     ERROR: 0
+    .. contents:: :depth: 2
+==========================================================
+lttng-tools 2.13.11: tests/regression/test-suite.log
+==========================================================
+     TOTAL: 11091
+     PASS:  7243
+     SKIP:  3848
+     XFAIL: 0
+     FAIL:  0
+     XPASS: 0
+     ERROR: 0
+    .. contents:: :depth: 2
+    PASS: tools/filtering/test_valid_filter
+=======================================
+
+Upstream-Status: Submitted [https://github.com/lttng/lttng-tools/pull/166]
+
+Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
+---
+ tests/destructive/metadata-regeneration       |  1 +
+ tests/perf/test_perf_raw.in                   |  1 +
+ tests/regression/kernel/test_all_events       |  5 +++
+ tests/regression/kernel/test_callstack        |  5 +++
+ tests/regression/kernel/test_channel          |  5 +++
+ tests/regression/kernel/test_clock_override   |  5 +++
+ tests/regression/kernel/test_event_basic      |  5 +++
+ tests/regression/kernel/test_kernel_function  |  5 +++
+ tests/regression/kernel/test_lttng_logger     |  5 +++
+ tests/regression/kernel/test_ns_contexts      |  4 ++
+ .../regression/kernel/test_ns_contexts_change |  4 ++
+ .../kernel/test_rotation_destroy_flush        |  5 +++
+ .../regression/kernel/test_select_poll_epoll  |  5 +++
+ tests/regression/kernel/test_syscall          |  5 +++
+ tests/regression/kernel/test_userspace_probe  |  5 +++
+ tests/regression/tools/clear/test_kernel      |  5 +++
+ .../tools/filtering/test_valid_filter         |  6 +++
+ tests/regression/tools/health/test_thread_ok  |  7 +++
+ tests/regression/tools/live/test_kernel       |  5 +++
+ tests/regression/tools/live/test_lttng_kernel |  5 +++
+ tests/regression/tools/metadata/test_kernel   |  5 +++
+ .../test_notification_kernel_buffer_usage     | 43 +++++++++++--------
+ .../test_notification_kernel_capture          | 32 ++++++++------
+ .../test_notification_kernel_error            | 32 ++++++++------
+ .../test_notification_kernel_instrumentation  | 33 ++++++++------
+ .../notification/test_notification_multi_app  | 28 +++++++-----
+ ...test_notification_notifier_discarded_count |  5 +++
+ .../tools/regen-metadata/test_kernel          |  5 +++
+ .../tools/regen-statedump/test_kernel         |  5 +++
+ tests/regression/tools/rotation/test_kernel   |  5 +++
+ tests/regression/tools/snapshots/test_kernel  |  5 +++
+ .../tools/tracker/test_event_tracker          |  6 +++
+ .../tools/trigger/test_add_trigger_cli        |  9 ++++
+ .../tools/trigger/test_list_triggers_cli      |  6 ++-
+ .../tools/wildcard/test_event_wildcard        |  6 +++
+ .../test_rotation_destroy_flush               |  5 +++
+ 36 files changed, 259 insertions(+), 64 deletions(-)
+
+diff --git a/tests/destructive/metadata-regeneration b/tests/destructive/metadata-regeneration
+index b81e7af32..91d7df589 100755
+--- a/tests/destructive/metadata-regeneration
++++ b/tests/destructive/metadata-regeneration
+@@ -197,6 +197,7 @@ if ! destructive_tests_enabled ; then
+ 	exit 0
+ fi
+ 
++skip $SKIP_KERNEL_TEST -ne 0 "SKIP_KERNEL_TEST was enabled. Skipping all tests." $NUM_TESTS ||
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	start_lttng_relayd "-o $TRACE_PATH"
+diff --git a/tests/perf/test_perf_raw.in b/tests/perf/test_perf_raw.in
+index f293ccd71..4b61cc927 100644
+--- a/tests/perf/test_perf_raw.in
++++ b/tests/perf/test_perf_raw.in
+@@ -154,6 +154,7 @@ have_libpfm
+ 
+ test_ust_raw
+ 
++skip $SKIP_KERNEL_TEST -ne 0 "SKIP_KERNEL_TEST was enabled, skipping." 9 ||
+ skip $isroot "Root access is needed for kernel testing, skipping." 9 ||
+ {
+ 	modprobe lttng-test
+diff --git a/tests/regression/kernel/test_all_events b/tests/regression/kernel/test_all_events
+index 2e20888df..3dc8102ae 100755
+--- a/tests/regression/kernel/test_all_events
++++ b/tests/regression/kernel/test_all_events
+@@ -49,6 +49,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/kernel/test_callstack b/tests/regression/kernel/test_callstack
+index a4477fd7c..934e504df 100755
+--- a/tests/regression/kernel/test_callstack
++++ b/tests/regression/kernel/test_callstack
+@@ -140,6 +140,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/kernel/test_channel b/tests/regression/kernel/test_channel
+index 9cc74c4e8..b8f9835a5 100755
+--- a/tests/regression/kernel/test_channel
++++ b/tests/regression/kernel/test_channel
+@@ -53,6 +53,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	start_lttng_sessiond
+diff --git a/tests/regression/kernel/test_clock_override b/tests/regression/kernel/test_clock_override
+index 72892898b..63c0e6350 100755
+--- a/tests/regression/kernel/test_clock_override
++++ b/tests/regression/kernel/test_clock_override
+@@ -178,6 +178,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++	skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++	exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/kernel/test_event_basic b/tests/regression/kernel/test_event_basic
+index ac9ec0549..5e57f15d4 100755
+--- a/tests/regression/kernel/test_event_basic
++++ b/tests/regression/kernel/test_event_basic
+@@ -79,6 +79,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/kernel/test_kernel_function b/tests/regression/kernel/test_kernel_function
+index b1d5491fc..9865c8b55 100755
+--- a/tests/regression/kernel/test_kernel_function
++++ b/tests/regression/kernel/test_kernel_function
+@@ -49,6 +49,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++	skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++	exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	start_lttng_sessiond_notap
+diff --git a/tests/regression/kernel/test_lttng_logger b/tests/regression/kernel/test_lttng_logger
+index b8f7ded82..6f691aee3 100755
+--- a/tests/regression/kernel/test_lttng_logger
++++ b/tests/regression/kernel/test_lttng_logger
+@@ -116,6 +116,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/kernel/test_ns_contexts b/tests/regression/kernel/test_ns_contexts
+index 0c8718d78..ce358bfbc 100755
+--- a/tests/regression/kernel/test_ns_contexts
++++ b/tests/regression/kernel/test_ns_contexts
+@@ -115,6 +115,10 @@ fi
+ 
+ skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 0
++fi
+ 
+ system_has_ns=0
+ if [ -d "/proc/$$/ns" ]; then
+diff --git a/tests/regression/kernel/test_ns_contexts_change b/tests/regression/kernel/test_ns_contexts_change
+index 42a61276b..de4045ed5 100755
+--- a/tests/regression/kernel/test_ns_contexts_change
++++ b/tests/regression/kernel/test_ns_contexts_change
+@@ -170,6 +170,10 @@ fi
+ 
+ skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
+ 
+ system_has_ns=0
+ if [ -d "/proc/$$/ns" ]; then
+diff --git a/tests/regression/kernel/test_rotation_destroy_flush b/tests/regression/kernel/test_rotation_destroy_flush
+index cb773d7df..d06b04229 100755
+--- a/tests/regression/kernel/test_rotation_destroy_flush
++++ b/tests/regression/kernel/test_rotation_destroy_flush
+@@ -126,6 +126,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++	skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++	exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/kernel/test_select_poll_epoll b/tests/regression/kernel/test_select_poll_epoll
+index d8245a0e7..1372fe930 100755
+--- a/tests/regression/kernel/test_select_poll_epoll
++++ b/tests/regression/kernel/test_select_poll_epoll
+@@ -380,6 +380,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/kernel/test_syscall b/tests/regression/kernel/test_syscall
+index 401a18a8d..b3b8e5e98 100755
+--- a/tests/regression/kernel/test_syscall
++++ b/tests/regression/kernel/test_syscall
+@@ -670,6 +670,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/kernel/test_userspace_probe b/tests/regression/kernel/test_userspace_probe
+index 1091ee65e..17582f909 100755
+--- a/tests/regression/kernel/test_userspace_probe
++++ b/tests/regression/kernel/test_userspace_probe
+@@ -821,6 +821,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/tools/clear/test_kernel b/tests/regression/tools/clear/test_kernel
+index 06fb1c368..46de64d88 100755
+--- a/tests/regression/tools/clear/test_kernel
++++ b/tests/regression/tools/clear/test_kernel
+@@ -563,6 +563,11 @@ snapshot_tests=(test_kernel_streaming_snapshot
+ 	test_kernel_local_snapshot
+ )
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
+ {
+ 	trap signal_cleanup SIGTERM SIGINT
+diff --git a/tests/regression/tools/filtering/test_valid_filter b/tests/regression/tools/filtering/test_valid_filter
+index e76ffa25f..b3aa3d07f 100755
+--- a/tests/regression/tools/filtering/test_valid_filter
++++ b/tests/regression/tools/filtering/test_valid_filter
+@@ -1458,6 +1458,12 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_KERNEL_TESTS
++        stop_lttng_sessiond
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all kernel valid filter tests." $NUM_KERNEL_TESTS ||
+ {
+ 	diag "Test kernel valid filters"
+diff --git a/tests/regression/tools/health/test_thread_ok b/tests/regression/tools/health/test_thread_ok
+index e84adb611..baaa40bf9 100755
+--- a/tests/regression/tools/health/test_thread_ok
++++ b/tests/regression/tools/health/test_thread_ok
+@@ -67,6 +67,7 @@ function test_thread_ok
+ 	$CURDIR/$HEALTH_CHECK_BIN > ${STDOUT_PATH} 2> ${STDERR_PATH}
+ 	report_errors
+ 
++	skip $ist_skip "SKIP_KERNEL_TEST was enabled. Skipping kernel consumer health check test." "5" ||
+ 	skip $isroot "Root access is needed. Skipping kernel consumer health check test." "5" ||
+ 	{
+ 		diag "With kernel consumer daemon"
+@@ -122,6 +123,12 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++	ist_skip=0
++else
++	ist_skip=1
++fi
++
+ test_thread_ok
+ 
+ rm -rf ${HEALTH_PATH}
+diff --git a/tests/regression/tools/live/test_kernel b/tests/regression/tools/live/test_kernel
+index b622b5214..275aa19bc 100755
+--- a/tests/regression/tools/live/test_kernel
++++ b/tests/regression/tools/live/test_kernel
+@@ -39,6 +39,11 @@ function clean_live_tracing()
+ 	rm -rf $TRACE_PATH
+ }
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++	plan_skip_all "SKIP_KERNEL_TEST was enabled. Skipping all tests."
++	exit 0
++fi
++
+ # Need root access for kernel tracing.
+ if [ "$(id -u)" == "0" ]; then
+ 	isroot=1
+diff --git a/tests/regression/tools/live/test_lttng_kernel b/tests/regression/tools/live/test_lttng_kernel
+index a23d9373a..d028e03f3 100755
+--- a/tests/regression/tools/live/test_lttng_kernel
++++ b/tests/regression/tools/live/test_lttng_kernel
+@@ -51,6 +51,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
+ {
+ 	modprobe lttng-test
+diff --git a/tests/regression/tools/metadata/test_kernel b/tests/regression/tools/metadata/test_kernel
+index 57cace6ea..d56838f43 100755
+--- a/tests/regression/tools/metadata/test_kernel
++++ b/tests/regression/tools/metadata/test_kernel
+@@ -97,6 +97,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all kernel metadata tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/tools/notification/test_notification_kernel_buffer_usage b/tests/regression/tools/notification/test_notification_kernel_buffer_usage
+index 76e69a77e..b17d73ca0 100755
+--- a/tests/regression/tools/notification/test_notification_kernel_buffer_usage
++++ b/tests/regression/tools/notification/test_notification_kernel_buffer_usage
+@@ -60,29 +60,38 @@ function test_buffer_usage_notification
+ 	wait $APP_PID 2> /dev/null
+ }
+ 
+-if [ "$(id -u)" == "0" ]; then
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skiptest=0
++else
++        skiptest=1
++fi
+ 
+-	validate_lttng_modules_present
++skip $skiptest "SKIP_KERNEL_TEST was enabled. Skipping all tests." $NUM_TESTS ||
++{
++	if [ "$(id -u)" == "0" ]; then
+ 
++		validate_lttng_modules_present
+ 
+-	modprobe lttng-test
+ 
+-	# Used on sessiond launch.
+-	LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 \
+-		CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} \
+-		LD_PRELOAD=${TESTPOINT}"
+-	start_lttng_sessiond_notap
++		modprobe lttng-test
+ 
+-	test_buffer_usage_notification
++		# Used on sessiond launch.
++		LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 \
++			CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} \
++			LD_PRELOAD=${TESTPOINT}"
++		start_lttng_sessiond_notap
+ 
+-	stop_lttng_sessiond_notap
+-	rmmod lttng-test
++		test_buffer_usage_notification
+ 
+-	rm -rf "${consumerd_pipe[@]}" 2> /dev/null
+-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 -rf "${consumerd_pipe[@]}" 2> /dev/null
++	else
++		# Kernel tests are skipped.
++		plan_tests $NUM_TESTS
++		skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
++	fi
++}
+ 
+ rm -rf "$TEST_TMPDIR"
+diff --git a/tests/regression/tools/notification/test_notification_kernel_capture b/tests/regression/tools/notification/test_notification_kernel_capture
+index 88f123d3d..e99825194 100755
+--- a/tests/regression/tools/notification/test_notification_kernel_capture
++++ b/tests/regression/tools/notification/test_notification_kernel_capture
+@@ -30,23 +30,31 @@ function test_basic_error_path
+ 	wait $APP_PID 2> /dev/null
+ }
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skiptest=0
++else
++        skiptest=1
++fi
+ 
+-if [ "$(id -u)" == "0" ]; then
+-	validate_lttng_modules_present
++skip $skiptest "SKIP_KERNEL_TEST was enabled. Skipping all tests." $NUM_TESTS ||
++{
++	if [ "$(id -u)" == "0" ]; then
++		validate_lttng_modules_present
+ 
+-	modprobe lttng-test
++		modprobe lttng-test
+ 
+-	start_lttng_sessiond_notap
++		start_lttng_sessiond_notap
+ 
+-	test_basic_error_path
++		test_basic_error_path
+ 
+-	stop_lttng_sessiond_notap
+-	rmmod lttng-test
++		stop_lttng_sessiond_notap
++		rmmod lttng-test
+ 
+-else
+-	# Kernel tests are skipped.
+-	plan_tests $NUM_TESTS
+-	skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
+-fi
++	else
++		# Kernel tests are skipped.
++		plan_tests $NUM_TESTS
++		skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
++	fi
++}
+ 
+ rm -f "$TESTAPP_STATE_PATH"
+diff --git a/tests/regression/tools/notification/test_notification_kernel_error b/tests/regression/tools/notification/test_notification_kernel_error
+index 80fe6e5b5..ef1abf97e 100755
+--- a/tests/regression/tools/notification/test_notification_kernel_error
++++ b/tests/regression/tools/notification/test_notification_kernel_error
+@@ -30,23 +30,31 @@ function test_basic_error_path
+ 	wait $APP_PID 2> /dev/null
+ }
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++	skiptest=0
++else
++	skiptest=1
++fi
+ 
+-if [ "$(id -u)" == "0" ]; then
+-	validate_lttng_modules_present
++skip $skiptest "SKIP_KERNEL_TEST was enabled. Skipping all tests." $NUM_TESTS ||
++{
++	if [ "$(id -u)" == "0" ]; then
++		validate_lttng_modules_present
+ 
+-	modprobe lttng-test
++		modprobe lttng-test
+ 
+-	start_lttng_sessiond_notap
++		start_lttng_sessiond_notap
+ 
+-	test_basic_error_path
++		test_basic_error_path
+ 
+-	stop_lttng_sessiond_notap
+-	rmmod lttng-test
++		stop_lttng_sessiond_notap
++		rmmod lttng-test
+ 
+-else
+-	# Kernel tests are skipped.
+-	plan_tests $NUM_TESTS
+-	skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
+-fi
++	else
++		# Kernel tests are skipped.
++		plan_tests $NUM_TESTS
++		skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
++	fi
++}
+ 
+ rm -f "$TESTAPP_STATE_PATH"
+diff --git a/tests/regression/tools/notification/test_notification_kernel_instrumentation b/tests/regression/tools/notification/test_notification_kernel_instrumentation
+index 90545a541..6750475d9 100755
+--- a/tests/regression/tools/notification/test_notification_kernel_instrumentation
++++ b/tests/regression/tools/notification/test_notification_kernel_instrumentation
+@@ -28,22 +28,31 @@ function test_kernel_instrumentation_notification
+ 	wait $APP_PID 2> /dev/null
+ }
+ 
+-if [ "$(id -u)" == "0" ]; then
+-	validate_lttng_modules_present
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skiptest=0
++else
++        skiptest=1
++fi
+ 
+-	modprobe lttng-test
++skip $skiptest "SKIP_KERNEL_TEST was enabled. Skipping all tests." $NUM_TESTS ||
++{
++	if [ "$(id -u)" == "0" ]; then
++		validate_lttng_modules_present
+ 
+-	start_lttng_sessiond_notap
++		modprobe lttng-test
+ 
+-	test_kernel_instrumentation_notification
++		start_lttng_sessiond_notap
+ 
+-	stop_lttng_sessiond_notap
+-	rmmod lttng-test
++		test_kernel_instrumentation_notification
+ 
+-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
++
++	else
++		# Kernel tests are skipped.
++		plan_tests $NUM_TESTS
++		skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
++	fi
++}
+ 
+ rm -f "$TESTAPP_STATE_PATH"
+diff --git a/tests/regression/tools/notification/test_notification_multi_app b/tests/regression/tools/notification/test_notification_multi_app
+index d8b639225..1ccbd109e 100755
+--- a/tests/regression/tools/notification/test_notification_multi_app
++++ b/tests/regression/tools/notification/test_notification_multi_app
+@@ -427,16 +427,24 @@ else
+         skip 0 "Root access is needed. Skipping all kernel multi-app notification tests." $NUM_TEST_KERNEL
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skiptest=0
++else
++        skiptest=1
++fi
+ 
+-for fct_test in ${TESTS[@]};
+-do
+-	TRACE_PATH=$(mktemp --tmpdir -d tmp.test_notification_multi_app_trace_path.XXXXXX)
++skip $skiptest "SKIP_KERNEL_TEST was enabled. Skipping all tests." $NUM_TEST_KERNEL ||
++{
++	for fct_test in ${TESTS[@]};
++	do
++		TRACE_PATH=$(mktemp --tmpdir -d tmp.test_notification_multi_app_trace_path.XXXXXX)
+ 
+-	${fct_test}
+-	if [ $? -ne 0 ]; then
+-		break;
+-	fi
++		${fct_test}
++		if [ $? -ne 0 ]; then
++			break;
++		fi
+ 
+-	# Only delete if successful
+-	rm -rf $TRACE_PATH
+-done
++		# Only delete if successful
++		rm -rf $TRACE_PATH
++	done
++}
+diff --git a/tests/regression/tools/notification/test_notification_notifier_discarded_count b/tests/regression/tools/notification/test_notification_notifier_discarded_count
+index c9235393e..9798e72c1 100755
+--- a/tests/regression/tools/notification/test_notification_notifier_discarded_count
++++ b/tests/regression/tools/notification/test_notification_notifier_discarded_count
+@@ -391,6 +391,11 @@ function test_ust_notifier_discarded_regardless_trigger_owner
+ test_ust_notifier_discarded_count
+ test_ust_notifier_discarded_count_max_bucket
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $KERNEL_NUM_TESTS
++        exit 1
++fi
++
+ if [ "$(id -u)" == "0" ]; then
+ 
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/tools/regen-metadata/test_kernel b/tests/regression/tools/regen-metadata/test_kernel
+index 49eea32a7..7bb884c8e 100755
+--- a/tests/regression/tools/regen-metadata/test_kernel
++++ b/tests/regression/tools/regen-metadata/test_kernel
+@@ -105,6 +105,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/tools/regen-statedump/test_kernel b/tests/regression/tools/regen-statedump/test_kernel
+index 8a261355d..5248af0be 100755
+--- a/tests/regression/tools/regen-statedump/test_kernel
++++ b/tests/regression/tools/regen-statedump/test_kernel
+@@ -45,6 +45,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/tools/rotation/test_kernel b/tests/regression/tools/rotation/test_kernel
+index f5f1f5553..a687a305f 100755
+--- a/tests/regression/tools/rotation/test_kernel
++++ b/tests/regression/tools/rotation/test_kernel
+@@ -88,6 +88,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
+ {
+ 	validate_lttng_modules_present
+diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel
+index abb243563..eecad7cef 100755
+--- a/tests/regression/tools/snapshots/test_kernel
++++ b/tests/regression/tools/snapshots/test_kernel
+@@ -223,6 +223,11 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all kernel snapshot tests" $NUM_TESTS ||
+ {
+ 
+diff --git a/tests/regression/tools/tracker/test_event_tracker b/tests/regression/tools/tracker/test_event_tracker
+index cc0f698d2..070cb4607 100755
+--- a/tests/regression/tools/tracker/test_event_tracker
++++ b/tests/regression/tools/tracker/test_event_tracker
+@@ -472,6 +472,12 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_KERNEL_TESTS
++        stop_lttng_sessiond
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all kernel tracker tests." $NUM_KERNEL_TESTS ||
+ {
+ 	diag "Test kernel tracker"
+diff --git a/tests/regression/tools/trigger/test_add_trigger_cli b/tests/regression/tools/trigger/test_add_trigger_cli
+index 98ecf6272..d756d5a74 100755
+--- a/tests/regression/tools/trigger/test_add_trigger_cli
++++ b/tests/regression/tools/trigger/test_add_trigger_cli
+@@ -40,6 +40,12 @@ else
+ 	ist_root=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        ist_skip=0
++else
++        ist_skip=1
++fi
++
+ function test_success ()
+ {
+ 	local test_name="$1"
+@@ -223,6 +229,7 @@ test_success "--exclude-name two" "trigger5" \
+ 	--condition event-rule-matches --type=user --name='jean-*' --exclude-name jean-chretien -x jean-charest \
+ 	--action notify
+ 
++skip $ist_skip "SKIP_KERNEL_TEST: skipping kprobe tests" 18 ||
+ skip $ist_root "non-root user: skipping kprobe tests" 18 || {
+ 	i=0
+ 
+@@ -262,6 +269,7 @@ skip $ist_root "non-root user: skipping kprobe tests" 18 || {
+ 	done
+ }
+ 
++skip $ist_skip "SKIP_KERNEL_TEST: skipping uprobe tests" 6 ||
+ skip $ist_root "non-root user: skipping uprobe tests" 6 || {
+ 	test_success "--condition event-rule-matches uprobe" "uprobe-trigger-0" \
+ 		--name="uprobe-trigger-0" \
+@@ -274,6 +282,7 @@ skip $ist_root "non-root user: skipping uprobe tests" 6 || {
+ 		--action notify
+ }
+ 
++skip $ist_skip "SKIP_KERNEL_TEST: skipping syscall tests" 30 ||
+ skip $ist_root "non-root user: skipping syscall tests" 30 || {
+ 	test_success "--condition event-rule-matches one syscall" "syscall-trigger-0" \
+ 		--name="syscall-trigger-0" \
+diff --git a/tests/regression/tools/trigger/test_list_triggers_cli b/tests/regression/tools/trigger/test_list_triggers_cli
+index a04018013..659ac4bde 100755
+--- a/tests/regression/tools/trigger/test_list_triggers_cli
++++ b/tests/regression/tools/trigger/test_list_triggers_cli
+@@ -51,7 +51,6 @@ else
+ 	hast_sdt_binary=0
+ fi
+ 
+-
+ test_top_level_options ()
+ {
+ 	diag "Listing top level options"
+@@ -2690,6 +2689,11 @@ test_notify_action ()
+ 
+ plan_tests $NUM_TESTS
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 0
++fi
++
+ # shellcheck disable=SC2119
+ start_lttng_sessiond_notap
+ 
+diff --git a/tests/regression/tools/wildcard/test_event_wildcard b/tests/regression/tools/wildcard/test_event_wildcard
+index f69baffc4..584d97923 100755
+--- a/tests/regression/tools/wildcard/test_event_wildcard
++++ b/tests/regression/tools/wildcard/test_event_wildcard
+@@ -130,6 +130,12 @@ else
+ 	isroot=0
+ fi
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_KERNEL_TESTS
++        stop_lttng_sessiond
++        exit 1
++fi
++
+ skip $isroot "Root access is needed. Skipping all kernel wildcard tests." $NUM_KERNEL_TESTS ||
+ {
+ 	diag "Test kernel wildcards"
+diff --git a/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush b/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush
+index 8ef4f0d8c..96522f024 100755
+--- a/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush
++++ b/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush
+@@ -126,6 +126,11 @@ TESTS=(
+ TEST_COUNT=${#TESTS[@]}
+ i=0
+ 
++if [ "$SKIP_KERNEL_TEST" == "1" ]; then
++        skip 0 "SKIP_KERNEL_TEST was enabled, skipping." $NUM_TESTS
++        exit 1
++fi
++
+ while [ "$i" -lt "$TEST_COUNT" ]; do
+ 
+ 	trap signal_cleanup SIGTERM SIGINT
+-- 
+2.25.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-tools_2.13.11.bb b/meta/recipes-kernel/lttng/lttng-tools_2.13.11.bb
index 44415fbf2d..1e247189d2 100644
--- a/meta/recipes-kernel/lttng/lttng-tools_2.13.11.bb
+++ b/meta/recipes-kernel/lttng/lttng-tools_2.13.11.bb
@@ -37,6 +37,7 @@  SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
            file://lttng-sessiond.service \
            file://disable-tests.patch \
            file://0001-compat-Define-off64_t-as-off_t-on-linux.patch \
+           file://0001-Tests-Add-flags-to-test-lttng-userspace-only.patch \
            "
 
 SRC_URI[sha256sum] = "ac5baeef9fa690936b1ca01ecd1742da762c2c08511ff1b4e923938d94d0f979"