Hi Lakshmi, I'd like to encourage once again to review the bug reporting guidelines at https://lttng.org/community/ and include all the necessary information including steps to reproduce the issue. Thank you. On 3/12/24 1:51 PM, Lakshmi Deverkonda wrote: > Hi, > > We see that python3 based lttng is continuously crashing on debian-12. > Kernel Version is 6.1.0. Is there some special handling that has to be > taken care for debian-12? > To the best of my knowledge there are no special cases for Debian 12 in upstream lttng-ust. The Debian source package carries two minor patches from what I can see, neither of which seem directly related to the python agent. > Following is the core decode. Could you install the relevant "-dbgsym" packages for libc and liblttng-ust or fetch the debug symbols from debuginfod so that the addresses are resolved into meaningful symbols? > Program terminated with signal SIGABRT, Aborted. > #0 0x00007fb95dac9e2c in ?? () from /lib/x86_64-linux-gnu/libc.so.6 > [Current thread is 1 (Thread 0x7fb95d96c040 (LWP 19426))] > (gdb) bt > #0 0x00007fb95dac9e2c in ?? () from /lib/x86_64-linux-gnu/libc.so.6 > #1 0x00007fb95da7afb2 in raise () from /lib/x86_64-linux-gnu/libc.so.6 > #2 0x00007fb95da65472 in abort () from /lib/x86_64-linux-gnu/libc.so.6 > #3 0x00007fb95da65395 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 > #4 0x00007fb95da73eb2 in __assert_fail () from > /lib/x86_64-linux-gnu/libc.so.6 > #5 0x00007fb95d9efbbf in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 > #6 0x00007fb95d9f0f23 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 > #7 0x00007fb95d9ece2f in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 > #8 0x00007fb95d9dc537 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 > #9 0x00007fb95d9c73c2 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 > #10 0x00007fb95d9c8003 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 > #11 0x00007fb95d9c8003 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 > #12 0x00007fb95d9c8003 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 > #13 0x00007fb95d9c8fce in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 > #14 0x00007fb95d9c2408 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 > #15 0x00007fb95dd6812a in ?? () from /lib64/ld-linux-x86-64.so.2 > #16 0x00007fb95dd6b764 in ?? () from /lib64/ld-linux-x86-64.so.2 > #17 0x00007fb95da7d55d in ?? () from /lib/x86_64-linux-gnu/libc.so.6 > #18 0x00007fb95da7d69a in exit () from /lib/x86_64-linux-gnu/libc.so.6 > #19 0x00007fb95da66251 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 > #20 0x00007fb95da66305 in __libc_start_main () from > /lib/x86_64-linux-gnu/libc.so.6 > #21 0x0000000000627461 in _start () > > Regards, > Lakshmi thanks, kienan _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
[-- Attachment #1.1: Type: text/plain, Size: 2033 bytes --] Hi, We see that python3 based lttng is continuously crashing on debian-12. Kernel Version is 6.1.0. Is there some special handling that has to be taken care for debian-12? Following is the core decode. Program terminated with signal SIGABRT, Aborted. #0 0x00007fb95dac9e2c in ?? () from /lib/x86_64-linux-gnu/libc.so.6 [Current thread is 1 (Thread 0x7fb95d96c040 (LWP 19426))] (gdb) bt #0 0x00007fb95dac9e2c in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007fb95da7afb2 in raise () from /lib/x86_64-linux-gnu/libc.so.6 #2 0x00007fb95da65472 in abort () from /lib/x86_64-linux-gnu/libc.so.6 #3 0x00007fb95da65395 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #4 0x00007fb95da73eb2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6 #5 0x00007fb95d9efbbf in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 #6 0x00007fb95d9f0f23 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 #7 0x00007fb95d9ece2f in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 #8 0x00007fb95d9dc537 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 #9 0x00007fb95d9c73c2 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 #10 0x00007fb95d9c8003 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 #11 0x00007fb95d9c8003 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 #12 0x00007fb95d9c8003 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 #13 0x00007fb95d9c8fce in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 #14 0x00007fb95d9c2408 in ?? () from /lib/x86_64-linux-gnu/liblttng-ust.so.1 #15 0x00007fb95dd6812a in ?? () from /lib64/ld-linux-x86-64.so.2 #16 0x00007fb95dd6b764 in ?? () from /lib64/ld-linux-x86-64.so.2 #17 0x00007fb95da7d55d in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #18 0x00007fb95da7d69a in exit () from /lib/x86_64-linux-gnu/libc.so.6 #19 0x00007fb95da66251 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #20 0x00007fb95da66305 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6 #21 0x0000000000627461 in _start () Regards, Lakshmi [-- Attachment #1.2: Type: text/html, Size: 6952 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Hi, we are trying to use LTTng in an application that will be dumped and restored across reboots with CRIU. The problem is that CRIU is unable to restore the unix sockets used to communicate with lttng-sessiond and would try to restore the lttng-ust-wait-8 shared memories to the contents they had when the application was dumped. The good thing is that our application knows when it will be dumped by CRIU and could tell liblttng-ust to prepare for that. I see two possibilities: 1. Drop the connection to lttng-sessiond and catch the thread with a mutex or semaphore when it wants to access wait_shm_mmap. Temporarily unmap the shared memory and let CRIU do its work before allowing the thread to continue 2. Cause the threads to terminate. Do the steps done in lttng_ust_after_fork_child, but allow CRIU to be called before lttng_ust_ctor is called again. I suspect the two ust_listener_thread instances will be in one of two states most of the time. Either there is a connection to lttng-sessiond and the thread is waiting inside ustcomm_recv_unix_sock or there is no connection and the thread is doing FUTEX_WAIT on the shared memory. We can make it stop waiting inside ustcomm_recv_unix_sock by using shutdown() with SHUT_RD on the socket from another thread. The only way to interrupt FUTEX_WAIT without writing to the shared memory is probably to send a signal. I have seen warnings in the code advising against pthread_join, but I think with shutdown() and pthread_kill we can make the thread reevaluate lttng_ust_comm_should_quit in a safe way (or cause it to reacquire the mutex/semaphore mentioned above in possibility 1). Any thoughts on this? Which direction looks more promising? Is there any chance to get helper functions like this accepted into liblttng-ust? Best regards, Daniel -- Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11, Berliner Straße 12, 37073 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 Geschäftsführung: Heike Jordan, Dr. Uwe Kracke Ust-IdNr.: DE 205 198 055 emlix - your embedded linux partner _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
[-- Attachment #1.1: Type: text/plain, Size: 1255 bytes --] Hi Kienan, Thank you very much ! Best regards, Zvika On Mon, Mar 4, 2024 at 5:11 PM Kienan Stewart <kstewart@efficios.com> wrote: > Hi Zvika, > > To share a sessiond the LTTng home and run directories, and the shared > memory should be shared between the containers. > > Eg. > https://github.com/mjeanson/gcloud-lttng/blob/master/pods/demo1.yaml.in > > In a scenario with multiple sessionds (eg. one per container), the > traces could be combined in post using babeltrace. > > thanks, > kienan > > > On 3/2/24 12:31 AM, Zvi Vered via lttng-dev wrote: > > Hello, > > > > I have an application working with multiple dockers. > > Each docker is a fedora O.S running an application. > > The host is centos 8.5. This host will be upgraded to RHEL 9.2 in the > > near future. > > Is it possible that all traces from multiple dockers will all be written > > to one metadata ? > > > > versions: > > lttng-tools-latest-2.13.tar.bz2 > > lttng-ust-latest-2.13.tar.bz2 > > userspace-rcu-latest-0.14.tar.bz2 > > > > Thank you, > > Zvika > > > > _______________________________________________ > > lttng-dev mailing list > > lttng-dev@lists.lttng.org > > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev > [-- Attachment #1.2: Type: text/html, Size: 2018 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
To those concerned, After years of development, the DiaMon Workgroup announces that it will publish the official specification of the Common Trace Format, version 2 based on its latest release candidate, CTF2-SPECRC-9.0 [1]. Indeed, we now possess sufficient implementation code to be very confident that CTF2-SPECRC-9.0 does not contain any major errors or omissions, taking into account the goals of the format. Consequently, we will publish the CTF2-SPEC-2.0 document in two weeks, barring any significant and justified objection in response to this email. Although its form may change in the future, for instance to add examples or to make them interactive, its content shall remain as is in perpetuity. In other words, we do not anticipate to publish CTF2-SPEC-2.1: any additions or changes, which we will document as part of new DiaMon documents, will be made through the new metadata stream attribute [2] or extension [3] instruments. [1]: https://diamon.org/ctf/files/CTF2-SPECRC-9.0rA.html [2]: https://diamon.org/ctf/files/CTF2-SPECRC-9.0rA.html#attrs [3]: https://diamon.org/ctf/files/CTF2-SPECRC-9.0rA.html#ext I hope you have a very good day, Philippe Proulx EfficiOS Inc. _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Hi Zvika, To share a sessiond the LTTng home and run directories, and the shared memory should be shared between the containers. Eg. https://github.com/mjeanson/gcloud-lttng/blob/master/pods/demo1.yaml.in In a scenario with multiple sessionds (eg. one per container), the traces could be combined in post using babeltrace. thanks, kienan On 3/2/24 12:31 AM, Zvi Vered via lttng-dev wrote: > Hello, > > I have an application working with multiple dockers. > Each docker is a fedora O.S running an application. > The host is centos 8.5. This host will be upgraded to RHEL 9.2 in the > near future. > Is it possible that all traces from multiple dockers will all be written > to one metadata ? > > versions: > lttng-tools-latest-2.13.tar.bz2 > lttng-ust-latest-2.13.tar.bz2 > userspace-rcu-latest-0.14.tar.bz2 > > Thank you, > Zvika > > _______________________________________________ > lttng-dev mailing list > lttng-dev@lists.lttng.org > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
[-- Attachment #1.1: Type: text/plain, Size: 412 bytes --] Hello, I have an application working with multiple dockers. Each docker is a fedora O.S running an application. The host is centos 8.5. This host will be upgraded to RHEL 9.2 in the near future. Is it possible that all traces from multiple dockers will all be written to one metadata ? versions: lttng-tools-latest-2.13.tar.bz2 lttng-ust-latest-2.13.tar.bz2 userspace-rcu-latest-0.14.tar.bz2 Thank you, Zvika [-- Attachment #1.2: Type: text/html, Size: 597 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
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 on an embedded device (e.g. userspace), so in this scenario, the kernel modules might not install to target rootfs, the test cases would be fail and exit. Add LTTNG_TOOLS_DISABLE_KERNEL_TESTS to skip the lttng kernel features test, this flag can be set via "make": make check LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1 When this flag was set, all kernel related testcases would be marked as SKIP in result. Since the the LTTNG_TOOLS_DISABLE_KERNEL_TESTS was checked in function check_skip_kernel_test, lots of testcases also need to check root permission, so merging the root permission checking into check_skip_kernel_test. Change-Id: I0ced8d6bd3c0e496f0ac71b8b84f64e04ea60730 Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com> --- tests/destructive/metadata-regeneration | 8 +--- tests/perf/test_perf_raw.in | 8 +--- tests/regression/kernel/test_all_events | 8 +--- tests/regression/kernel/test_callstack | 8 +--- tests/regression/kernel/test_channel | 8 +--- tests/regression/kernel/test_clock_override | 8 +--- tests/regression/kernel/test_event_basic | 8 +--- tests/regression/kernel/test_kernel_function | 8 +--- tests/regression/kernel/test_lttng_logger | 7 +--- tests/regression/kernel/test_ns_contexts | 8 +--- .../regression/kernel/test_ns_contexts_change | 9 +--- .../kernel/test_rotation_destroy_flush | 8 +--- .../regression/kernel/test_select_poll_epoll | 8 +--- tests/regression/kernel/test_syscall | 8 +--- tests/regression/kernel/test_userspace_probe | 8 +--- tests/regression/tools/clear/test_kernel | 8 +--- .../tools/filtering/test_invalid_filter | 8 +--- .../tools/filtering/test_unsupported_op | 8 +--- .../tools/filtering/test_valid_filter | 8 +--- tests/regression/tools/health/test_health.sh | 10 +---- tests/regression/tools/health/test_thread_ok | 9 +--- tests/regression/tools/live/test_kernel | 10 ++--- tests/regression/tools/live/test_lttng_kernel | 8 +--- tests/regression/tools/metadata/test_kernel | 8 +--- .../test_notification_kernel_buffer_usage | 36 ++++++++-------- .../test_notification_kernel_capture | 23 +++++------ .../test_notification_kernel_error | 23 +++++------ .../test_notification_kernel_instrumentation | 23 +++++------ .../test_notification_kernel_syscall | 19 ++++----- .../test_notification_kernel_userspace_probe | 20 ++++----- .../notification/test_notification_multi_app | 41 +++++++++---------- ...test_notification_notifier_discarded_count | 9 ++-- .../tools/regen-metadata/test_kernel | 8 +--- .../tools/regen-statedump/test_kernel | 8 +--- tests/regression/tools/rotation/test_kernel | 8 +--- .../regression/tools/rotation/test_ust_kernel | 8 +--- tests/regression/tools/snapshots/test_kernel | 9 +--- .../tools/snapshots/test_kernel_streaming | 8 +--- .../tools/snapshots/test_ust_streaming | 6 --- .../streaming/test_high_throughput_limits | 8 +--- tests/regression/tools/streaming/test_kernel | 8 +--- .../tools/tracker/test_event_tracker | 8 +--- .../tools/trigger/test_add_trigger_cli | 12 ++---- .../tools/trigger/test_list_triggers_cli | 21 ++++------ .../tools/wildcard/test_event_wildcard | 8 +--- .../test_relayd_working_directory | 4 +- .../ust/namespaces/test_ns_contexts_change | 7 +--- tests/regression/ust/test_event_perf | 8 +--- tests/utils/utils.sh | 33 +++++++++++++++ 49 files changed, 178 insertions(+), 385 deletions(-) diff --git a/tests/destructive/metadata-regeneration b/tests/destructive/metadata-regeneration index 048c601b6..457f0b9dd 100755 --- a/tests/destructive/metadata-regeneration +++ b/tests/destructive/metadata-regeneration @@ -189,12 +189,6 @@ function test_ust_streaming () rm -f "${file_sync_before_last}" } -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - if ! destructive_tests_enabled ; then echo 'Please make sure that ntp is not running while executing this test' skip 0 "You need to set the LTTNG_ENABLE_DESTRUCTIVE_TESTS environment variable to \"will-break-my-system\" to run this test" $NUM_TESTS @@ -202,7 +196,7 @@ if ! destructive_tests_enabled ; then exit 0 fi -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test $NUM_TESTS || { original_date=$(date) start_lttng_relayd "-o $TRACE_PATH" diff --git a/tests/perf/test_perf_raw.in b/tests/perf/test_perf_raw.in index 0a451ce63..00cdebc55 100644 --- a/tests/perf/test_perf_raw.in +++ b/tests/perf/test_perf_raw.in @@ -137,12 +137,6 @@ function test_kernel_raw() rm -rf $TRACE_PATH } -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - # MUST set TESTDIR before calling those functions plan_tests $NUM_TESTS @@ -154,7 +148,7 @@ have_libpfm test_ust_raw -skip $isroot "Root access is needed for kernel testing, skipping." 9 || +check_skip_kernel_test 9 || { modprobe lttng-test test_kernel_raw diff --git a/tests/regression/kernel/test_all_events b/tests/regression/kernel/test_all_events index 2fb2f611d..636469dea 100755 --- a/tests/regression/kernel/test_all_events +++ b/tests/regression/kernel/test_all_events @@ -43,13 +43,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_callstack b/tests/regression/kernel/test_callstack index cf39089af..1467e7942 100755 --- a/tests/regression/kernel/test_callstack +++ b/tests/regression/kernel/test_callstack @@ -136,13 +136,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_channel b/tests/regression/kernel/test_channel index 5525564d2..f399f5038 100755 --- a/tests/regression/kernel/test_channel +++ b/tests/regression/kernel/test_channel @@ -47,13 +47,7 @@ function test_channel_buffer_too_large() plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { start_lttng_sessiond diff --git a/tests/regression/kernel/test_clock_override b/tests/regression/kernel/test_clock_override index 524c3c3bb..53c75d3a5 100755 --- a/tests/regression/kernel/test_clock_override +++ b/tests/regression/kernel/test_clock_override @@ -174,13 +174,7 @@ TESTS=( TEST_COUNT=${#TESTS[@]} i=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present trap signal_cleanup SIGTERM SIGINT diff --git a/tests/regression/kernel/test_event_basic b/tests/regression/kernel/test_event_basic index 9f22d7db8..20215a11f 100755 --- a/tests/regression/kernel/test_event_basic +++ b/tests/regression/kernel/test_event_basic @@ -73,13 +73,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test $NUM_TESTS || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_kernel_function b/tests/regression/kernel/test_kernel_function index 131c1c70b..bfdf0091a 100755 --- a/tests/regression/kernel/test_kernel_function +++ b/tests/regression/kernel/test_kernel_function @@ -43,13 +43,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { start_lttng_sessiond_notap validate_lttng_modules_present diff --git a/tests/regression/kernel/test_lttng_logger b/tests/regression/kernel/test_lttng_logger index 849428807..d1b9567ee 100755 --- a/tests/regression/kernel/test_lttng_logger +++ b/tests/regression/kernel/test_lttng_logger @@ -110,13 +110,8 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_ns_contexts b/tests/regression/kernel/test_ns_contexts index 98b673c98..9ada1655a 100755 --- a/tests/regression/kernel/test_ns_contexts +++ b/tests/regression/kernel/test_ns_contexts @@ -108,13 +108,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -isroot=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 - +check_skip_kernel_test "$NUM_TESTS" && exit 0 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 715c67cc8..d2826ba88 100755 --- a/tests/regression/kernel/test_ns_contexts_change +++ b/tests/regression/kernel/test_ns_contexts_change @@ -162,14 +162,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" - -isroot=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 - +check_skip_kernel_test "$NUM_TESTS" && exit 0 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 6e568afda..b2df95811 100755 --- a/tests/regression/kernel/test_rotation_destroy_flush +++ b/tests/regression/kernel/test_rotation_destroy_flush @@ -120,13 +120,7 @@ TESTS=( TEST_COUNT=${#TESTS[@]} i=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present trap signal_cleanup SIGTERM SIGINT diff --git a/tests/regression/kernel/test_select_poll_epoll b/tests/regression/kernel/test_select_poll_epoll index cdde1ea4f..1f457be21 100755 --- a/tests/regression/kernel/test_select_poll_epoll +++ b/tests/regression/kernel/test_select_poll_epoll @@ -363,15 +363,9 @@ if test $? != 0; then exit 0 fi -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - diag "Supported syscalls are $SUPPORTED_SYSCALLS_LIST" -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/kernel/test_syscall b/tests/regression/kernel/test_syscall index f9b490858..20130dde9 100755 --- a/tests/regression/kernel/test_syscall +++ b/tests/regression/kernel/test_syscall @@ -664,13 +664,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_userspace_probe b/tests/regression/kernel/test_userspace_probe index bfa260e47..8e9002e2b 100755 --- a/tests/regression/kernel/test_userspace_probe +++ b/tests/regression/kernel/test_userspace_probe @@ -815,13 +815,7 @@ fi plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/tools/clear/test_kernel b/tests/regression/tools/clear/test_kernel index ce76f85d2..5f86ae386 100755 --- a/tests/regression/tools/clear/test_kernel +++ b/tests/regression/tools/clear/test_kernel @@ -538,12 +538,6 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - streaming_tests=(test_kernel_streaming test_kernel_streaming_rotate_clear test_kernel_streaming_clear_rotate @@ -565,7 +559,7 @@ snapshot_tests=(test_kernel_streaming_snapshot test_kernel_local_snapshot ) -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { trap signal_cleanup SIGTERM SIGINT diff --git a/tests/regression/tools/filtering/test_invalid_filter b/tests/regression/tools/filtering/test_invalid_filter index 8dfbe9eb5..839d6aff8 100755 --- a/tests/regression/tools/filtering/test_invalid_filter +++ b/tests/regression/tools/filtering/test_invalid_filter @@ -170,13 +170,7 @@ done test_bytecode_limit -u -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel invalid filter tests." $NUM_KERNEL_TESTS || +check_skip_kernel_test "$NUM_KERNEL_TESTS" || { diag "Test kernel filters" i=0 diff --git a/tests/regression/tools/filtering/test_unsupported_op b/tests/regression/tools/filtering/test_unsupported_op index dc76f99a6..e8101bdda 100755 --- a/tests/regression/tools/filtering/test_unsupported_op +++ b/tests/regression/tools/filtering/test_unsupported_op @@ -103,13 +103,7 @@ while [ "$i" -lt "$OP_COUNT" ]; do let "i++" done -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel unsupported filter operations tests." $NUM_KERNEL_TESTS || +check_skip_kernel_test $NUM_KERNEL_TESTS || { diag "Test kernel unsupported filter operations" diff --git a/tests/regression/tools/filtering/test_valid_filter b/tests/regression/tools/filtering/test_valid_filter index cd5b1a3b9..f8d3abc0b 100755 --- a/tests/regression/tools/filtering/test_valid_filter +++ b/tests/regression/tools/filtering/test_valid_filter @@ -1454,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" || { diag "Test kernel valid filters" diff --git a/tests/regression/tools/health/test_health.sh b/tests/regression/tools/health/test_health.sh index b4b416f92..85810d8e9 100644 --- a/tests/regression/tools/health/test_health.sh +++ b/tests/regression/tools/health/test_health.sh @@ -82,7 +82,7 @@ function test_health diag "With UST consumer daemons" enable_ust_lttng_event_ok $SESSION_NAME $UST_EVENT_NAME $CHANNEL_NAME - skip $isroot "Root access is needed. Skipping kernel consumer health check test." "1" || + check_skip_kernel_test "1" || { diag "With kernel consumer daemon" lttng_enable_kernel_event $SESSION_NAME $KERNEL_EVENT_NAME $CHANNEL_NAME @@ -113,7 +113,7 @@ function test_health if [ ${test_needs_root} -eq 1 ]; then - skip ${isroot} "Root access needed for test \"${test_thread_name}\"." "1" || + check_skip_kernel_test "1" || { report_errors "${test_thread_error_string}" "${test_relayd}" } @@ -271,12 +271,6 @@ STDERR_PATH=$(mktemp -t tmp.test_health_stderr_path.XXXXXX) TRACE_PATH=$(mktemp -d -t tmp.test_health_trace_path.XXXXXX) HEALTH_PATH=$(mktemp -d -t tmp.test_health_trace_path.XXXXXX) -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - THREAD_COUNT=${#THREAD[@]} i=0 while [ "$i" -lt "$THREAD_COUNT" ]; do diff --git a/tests/regression/tools/health/test_thread_ok b/tests/regression/tools/health/test_thread_ok index 663b7e4cb..475a319c7 100755 --- a/tests/regression/tools/health/test_thread_ok +++ b/tests/regression/tools/health/test_thread_ok @@ -67,7 +67,7 @@ function test_thread_ok $CURDIR/$HEALTH_CHECK_BIN > ${STDOUT_PATH} 2> ${STDERR_PATH} report_errors - skip $isroot "Root access is needed. Skipping kernel consumer health check test." "5" || + check_skip_kernel_test "5" || { diag "With kernel consumer daemon" create_lttng_session_no_output $SESSION_NAME @@ -115,13 +115,6 @@ STDERR_PATH=$(mktemp -t tmp.test_thread_ok_stderr_path.XXXXXX) TRACE_PATH=$(mktemp -d -t tmp.test_thread_ok_trace_path.XXXXXX) HEALTH_PATH=$(mktemp -d -t tmp.test_thread_ok_trace_path.XXXXXX) -# The manage kernel thread is only spawned if we are root -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -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 1be703aac..df30fcf56 100755 --- a/tests/regression/tools/live/test_kernel +++ b/tests/regression/tools/live/test_kernel @@ -39,13 +39,11 @@ function clean_live_tracing() rm -rf $TRACE_PATH } -# Need root access for kernel tracing. -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - plan_skip_all "Root access is needed. Skipping all tests." +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." exit 0 -fi +} modprobe lttng-test diff --git a/tests/regression/tools/live/test_lttng_kernel b/tests/regression/tools/live/test_lttng_kernel index ae8c57e6b..91f526ceb 100755 --- a/tests/regression/tools/live/test_lttng_kernel +++ b/tests/regression/tools/live/test_lttng_kernel @@ -45,13 +45,7 @@ function clean_live_tracing() } # Need root access for kernel tracing. -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { modprobe lttng-test diff --git a/tests/regression/tools/metadata/test_kernel b/tests/regression/tools/metadata/test_kernel index 9e1e81232..01053541d 100755 --- a/tests/regression/tools/metadata/test_kernel +++ b/tests/regression/tools/metadata/test_kernel @@ -98,13 +98,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel metadata tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present modprobe lttng-test diff --git a/tests/regression/tools/notification/test_notification_kernel_buffer_usage b/tests/regression/tools/notification/test_notification_kernel_buffer_usage index 5a87583dc..fe92c7337 100755 --- a/tests/regression/tools/notification/test_notification_kernel_buffer_usage +++ b/tests/regression/tools/notification/test_notification_kernel_buffer_usage @@ -63,29 +63,27 @@ function test_buffer_usage_notification wait $APP_PID 2> /dev/null } -if [ "$(id -u)" == "0" ]; then - - validate_lttng_modules_present - +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + rm -rf "$TEST_TMPDIR" + exit 0 +} - modprobe lttng-test +validate_lttng_modules_present - # 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 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 88a3691eb..b65310d88 100755 --- a/tests/regression/tools/notification/test_notification_kernel_capture +++ b/tests/regression/tools/notification/test_notification_kernel_capture @@ -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" diff --git a/tests/regression/tools/notification/test_notification_kernel_error b/tests/regression/tools/notification/test_notification_kernel_error index 891146747..dac70ad27 100755 --- a/tests/regression/tools/notification/test_notification_kernel_error +++ b/tests/regression/tools/notification/test_notification_kernel_error @@ -30,23 +30,22 @@ function test_basic_error_path wait $APP_PID 2> /dev/null } +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + exit 0 +} -if [ "$(id -u)" == "0" ]; then - validate_lttng_modules_present +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 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 b8f0c7eb8..599cc9aa3 100755 --- a/tests/regression/tools/notification/test_notification_kernel_instrumentation +++ b/tests/regression/tools/notification/test_notification_kernel_instrumentation @@ -28,22 +28,21 @@ function test_kernel_instrumentation_notification wait $APP_PID 2> /dev/null } -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_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 rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_kernel_syscall b/tests/regression/tools/notification/test_notification_kernel_syscall index ba12716fd..c9a40d077 100755 --- a/tests/regression/tools/notification/test_notification_kernel_syscall +++ b/tests/regression/tools/notification/test_notification_kernel_syscall @@ -31,19 +31,18 @@ function test_kernel_syscall_notification wait $APP_PID 2> /dev/null } -if [ "$(id -u)" == "0" ]; then - validate_lttng_modules_present +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + exit 0 +} - start_lttng_sessiond_notap +validate_lttng_modules_present - test_kernel_syscall_notification +start_lttng_sessiond_notap - stop_lttng_sessiond_notap +test_kernel_syscall_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 rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_kernel_userspace_probe b/tests/regression/tools/notification/test_notification_kernel_userspace_probe index 065e66add..38f5a5f41 100755 --- a/tests/regression/tools/notification/test_notification_kernel_userspace_probe +++ b/tests/regression/tools/notification/test_notification_kernel_userspace_probe @@ -29,18 +29,18 @@ function test_kernel_userspace_probe_notification wait $APP_PID 2> /dev/null } -if [ "$(id -u)" == "0" ]; then - validate_lttng_modules_present +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + exit 0 +} + +validate_lttng_modules_present - start_lttng_sessiond_notap +start_lttng_sessiond_notap - test_kernel_userspace_probe_notification +test_kernel_userspace_probe_notification - stop_lttng_sessiond_notap -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 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 85d863804..b8b36f93a 100755 --- a/tests/regression/tools/notification/test_notification_multi_app +++ b/tests/regression/tools/notification/test_notification_multi_app @@ -411,32 +411,31 @@ function test_on_register_evaluation () rm -rf "$output_dir" } +check_skip_kernel_test "$NUM_TEST_KERNEL" || { + + TESTS=( + test_multi_app_ust + test_on_register_evaluation_ust + ) -TESTS=( - test_multi_app_ust - test_on_register_evaluation_ust -) -if [ "$(id -u)" == "0" ]; then validate_lttng_modules_present TESTS+=( - test_multi_app_kernel - test_on_register_evaluation_kernel -) -else - skip 0 "Root access is needed. Skipping all kernel multi-app notification tests." $NUM_TEST_KERNEL -fi + test_multi_app_kernel + test_on_register_evaluation_kernel + ) -for fct_test in ${TESTS[@]}; -do - TRACE_PATH=$(mktemp -d -t tmp.test_notification_multi_app_trace_path.XXXXXX) + for fct_test in ${TESTS[@]}; + do + TRACE_PATH=$(mktemp -d -t 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 1eb960d02..73dfa831f 100755 --- a/tests/regression/tools/notification/test_notification_notifier_discarded_count +++ b/tests/regression/tools/notification/test_notification_notifier_discarded_count @@ -394,7 +394,8 @@ function test_ust_notifier_discarded_regardless_trigger_owner test_ust_notifier_discarded_count test_ust_notifier_discarded_count_max_bucket -if [ "$(id -u)" == "0" ]; then +check_skip_kernel_test "$KERNEL_NUM_TESTS" || +{ validate_lttng_modules_present @@ -416,9 +417,7 @@ if [ "$(id -u)" == "0" ]; then modprobe --remove lttng-test rm -rf "${sessiond_pipe[@]}" 2> /dev/null -else - # Kernel tests are skipped. - skip 0 "Root access is needed. Skipping all kernel notification tests." $KERNEL_NUM_TESTS -fi + +} rm -rf "$TEST_TMPDIR" diff --git a/tests/regression/tools/regen-metadata/test_kernel b/tests/regression/tools/regen-metadata/test_kernel index 7c4191a47..eb37783d2 100755 --- a/tests/regression/tools/regen-metadata/test_kernel +++ b/tests/regression/tools/regen-metadata/test_kernel @@ -99,13 +99,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$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 cb0c0ad5e..d33bdf478 100755 --- a/tests/regression/tools/regen-statedump/test_kernel +++ b/tests/regression/tools/regen-statedump/test_kernel @@ -39,13 +39,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/tools/rotation/test_kernel b/tests/regression/tools/rotation/test_kernel index 817019036..92903c3cc 100755 --- a/tests/regression/tools/rotation/test_kernel +++ b/tests/regression/tools/rotation/test_kernel @@ -107,13 +107,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/rotation/test_ust_kernel b/tests/regression/tools/rotation/test_ust_kernel index 2f19e807a..c6d9373e7 100755 --- a/tests/regression/tools/rotation/test_ust_kernel +++ b/tests/regression/tools/rotation/test_ust_kernel @@ -85,13 +85,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel index 870c437b2..f30ead382 100755 --- a/tests/regression/tools/snapshots/test_kernel +++ b/tests/regression/tools/snapshots/test_kernel @@ -221,14 +221,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace - -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel snapshot tests" $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/snapshots/test_kernel_streaming b/tests/regression/tools/snapshots/test_kernel_streaming index 2abd838e7..5a1eb3a42 100755 --- a/tests/regression/tools/snapshots/test_kernel_streaming +++ b/tests/regression/tools/snapshots/test_kernel_streaming @@ -145,13 +145,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests" $NUM_TESTS || +check_skip_kernel_test $NUM_TESTS || { validate_lttng_modules_present diff --git a/tests/regression/tools/snapshots/test_ust_streaming b/tests/regression/tools/snapshots/test_ust_streaming index 3104afb3b..1278605dc 100755 --- a/tests/regression/tools/snapshots/test_ust_streaming +++ b/tests/regression/tools/snapshots/test_ust_streaming @@ -234,12 +234,6 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - start_lttng_relayd "-o $TRACE_PATH" start_lttng_sessiond diff --git a/tests/regression/tools/streaming/test_high_throughput_limits b/tests/regression/tools/streaming/test_high_throughput_limits index 50c21df4d..a7d4317b4 100755 --- a/tests/regression/tools/streaming/test_high_throughput_limits +++ b/tests/regression/tools/streaming/test_high_throughput_limits @@ -174,13 +174,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed to set bandwith limits. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { # Catch sigint and try to cleanup limits diff --git a/tests/regression/tools/streaming/test_kernel b/tests/regression/tools/streaming/test_kernel index aef1e11bc..2beb4b015 100755 --- a/tests/regression/tools/streaming/test_kernel +++ b/tests/regression/tools/streaming/test_kernel @@ -47,13 +47,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/tracker/test_event_tracker b/tests/regression/tools/tracker/test_event_tracker index 98ca990fc..3840b4676 100755 --- a/tests/regression/tools/tracker/test_event_tracker +++ b/tests/regression/tools/tracker/test_event_tracker @@ -468,13 +468,7 @@ test_event_track_untrack ust 0 "${EVENT_NAME}" "--pid --all" # backward compat test_event_tracker ust 1 "${EVENT_NAME}" "--pid --all" # backward compat test_event_pid_tracker ust 1 "${EVENT_NAME}" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel tracker tests." $NUM_KERNEL_TESTS || +check_skip_kernel_test "$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 9ba8c22f0..0dc4c6b2f 100755 --- a/tests/regression/tools/trigger/test_add_trigger_cli +++ b/tests/regression/tools/trigger/test_add_trigger_cli @@ -34,12 +34,6 @@ tmp_stdout=$(mktemp -t test_parse_cli_trigger_stdout.XXXXXX) tmp_stderr=$(mktemp -t test_parse_cli_trigger_stderr.XXXXXX) uprobe_elf_binary="${TESTDIR}/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary" -if [ "$(id -u)" == "0" ]; then - ist_root=1 -else - ist_root=0 -fi - function test_success () { local test_name="$1" @@ -223,7 +217,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_root "non-root user: skipping kprobe tests" 18 || { +check_skip_kernel_test 18 || { i=0 for type in kprobe kernel:kprobe; do @@ -262,7 +256,7 @@ skip $ist_root "non-root user: skipping kprobe tests" 18 || { done } -skip $ist_root "non-root user: skipping uprobe tests" 6 || { +check_skip_kernel_test 6 || { test_success "--condition event-rule-matches uprobe" "uprobe-trigger-0" \ --name="uprobe-trigger-0" \ --condition event-rule-matches --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe \ @@ -274,7 +268,7 @@ skip $ist_root "non-root user: skipping uprobe tests" 6 || { --action notify } -skip $ist_root "non-root user: skipping syscall tests" 30 || { +check_skip_kernel_test 30 || { test_success "--condition event-rule-matches one syscall" "syscall-trigger-0" \ --name="syscall-trigger-0" \ --condition event-rule-matches --type=syscall --name=open \ diff --git a/tests/regression/tools/trigger/test_list_triggers_cli b/tests/regression/tools/trigger/test_list_triggers_cli index 6194b8891..57ce440b0 100755 --- a/tests/regression/tools/trigger/test_list_triggers_cli +++ b/tests/regression/tools/trigger/test_list_triggers_cli @@ -38,20 +38,13 @@ register_some_triggers_bin=$(realpath "${CURDIR}/utils/register-some-triggers") uid=$(id --user) gid=$(id --group) -if [ "$uid" == "0" ]; then - ist_root=1 - ls "$uprobe_sdt_binary" >/dev/null 2>&1 - if test $? == 0; then - hast_sdt_binary=1 - else - hast_sdt_binary=0 - fi +ls "$uprobe_sdt_binary" >/dev/null 2>&1 +if test $? == 0; then + hast_sdt_binary=1 else - ist_root=0 hast_sdt_binary=0 fi - test_top_level_options () { diag "Listing top level options" @@ -2695,10 +2688,10 @@ start_lttng_sessiond_notap test_top_level_options test_event_rule_matches_tracepoint -skip $ist_root "non-root user: skipping kprobe tests" 13 || test_event_rule_matches_probe -skip $ist_root "non-root user: skipping uprobe tests" 9 || test_event_rule_matches_userspace_probe_elf -skip $(($ist_root && $hast_sdt_binary)) "skipping userspace probe SDT tests" 9 || test_event_rule_matches_userspace_probe_sdt -skip $ist_root "non-root user: skipping syscall tests" 17 || test_event_rule_matches_syscall +check_skip_kernel_test 13 || test_event_rule_matches_probe +check_skip_kernel_test 9 || test_event_rule_matches_userspace_probe_elf +check_skip_kernel_test 9 || skip $hast_sdt_binary "skipping userspace probe SDT tests" 9 || test_event_rule_matches_userspace_probe_sdt +check_skip_kernel_test 17 || test_event_rule_matches_syscall test_session_consumed_size_condition test_buffer_usage_conditions test_session_rotation_conditions diff --git a/tests/regression/tools/wildcard/test_event_wildcard b/tests/regression/tools/wildcard/test_event_wildcard index 36e669b32..1bc61991d 100755 --- a/tests/regression/tools/wildcard/test_event_wildcard +++ b/tests/regression/tools/wildcard/test_event_wildcard @@ -126,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" || { diag "Test kernel wildcards" diff --git a/tests/regression/tools/working-directory/test_relayd_working_directory b/tests/regression/tools/working-directory/test_relayd_working_directory index c196a059e..db44120e7 100755 --- a/tests/regression/tools/working-directory/test_relayd_working_directory +++ b/tests/regression/tools/working-directory/test_relayd_working_directory @@ -145,9 +145,9 @@ function test_relayd_debug_permission() diag "Test lttng-relayd change working directory on non writable directory" if [ "$(id -u)" == "0" ]; then - is_user=0 + is_user=0 else - is_user=1 + is_user=1 fi skip $is_user "Skipping permission debug output test; operation can't fail as root" 6 || diff --git a/tests/regression/ust/namespaces/test_ns_contexts_change b/tests/regression/ust/namespaces/test_ns_contexts_change index fd1621630..e2c30659a 100755 --- a/tests/regression/ust/namespaces/test_ns_contexts_change +++ b/tests/regression/ust/namespaces/test_ns_contexts_change @@ -103,12 +103,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -isroot=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 +check_skip_kernel_test "$NUM_TESTS" && exit 0 system_has_ns=0 if [ -d "/proc/$$/ns" ]; then diff --git a/tests/regression/ust/test_event_perf b/tests/regression/ust/test_event_perf index 9b2de4de2..551ea407c 100755 --- a/tests/regression/ust/test_event_perf +++ b/tests/regression/ust/test_event_perf @@ -121,17 +121,11 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - start_lttng_sessiond test_parsing_raw -skip $isroot "Root access is needed. Skipping UST perf tests." 8 || +check_skip_kernel_test 8 || { test_event_basic } diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 44b3f167a..758db8bdd 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -323,6 +323,39 @@ function conf_proc_count() echo } +# Usage: +# check_skip_kernel_test [NB_TESTS] +# Return 0 if disable kernel test was set or current user is not a root user +# If NB_TESTS passes to function, it would call the skip() to skip number of tests. +# If NB_TESTS is empty, function just output a reason + +function check_skip_kernel_test () +{ + local num_tests="$1" + + # Check for skip test kernel flag + if [ "$LTTNG_TOOLS_DISABLE_KERNEL_TESTS" == "1" ]; then + if ! test -z "$num_tests"; then + skip 0 "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set. Skipping all tests." "$num_tests" + else + diag "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set" + fi + return 0 + fi + + # Check if we are running as root + if [ "$(id -u)" != "0" ]; then + if ! test -z "$num_tests"; then + skip 0 "Root access is needed for kernel testing, skipping." "$num_tests" + else + diag "Root access is needed for kernel testing" + fi + return 0 + fi + + return 1 +} + # Check if base lttng-modules are present. # Bail out on failure function validate_lttng_modules_present () -- 2.35.5 _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
On 2/23/24 11:54, Mathieu Desnoyers wrote: ... > So this sched_process_exit placement was actually decided > by Karim Yaghmour back in the LTT days (2001). I don't think > he will mind us moving it around some 23 years later. ;) Gee ... the shadows are longer than I thought :) It's all yours. You guys have been doing a fantastic job and I'm happy to be on the consumer side of it all these days :D Cheers, -- Karim Yaghmour CEO - Opersys inc. / www.opersys.com http://twitter.com/karimyaghmour _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
On Fri, 23 Feb 2024 11:54:30 -0500 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote: > So this sched_process_exit placement was actually decided > by Karim Yaghmour back in the LTT days (2001). I don't think > he will mind us moving it around some 23 years later. ;) And I wonder how many people are involved in this that are younger than that change :-p I'm starting to feel really old. -- Steve _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
On 2024-02-23 09:26, Steven Rostedt wrote: > On Mon, 19 Feb 2024 13:01:16 -0500 > Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote: > >> Between "sched_process_exit" and "sched_process_free", the task can still be >> observed by a trace analysis looking at sched and signal events: it's a zombie at >> that stage. > > Looking at the history of this tracepoint, it was added in 2008 by commit > 0a16b60758433 ("tracing, sched: LTTng instrumentation - scheduler"). > Hmm, LLTng? I wonder who the author was? [ common typo: LLTng -> LTTng ;-) ] > > Author: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> > > :-D > > Mathieu, I would say it's your call on where the tracepoint can be located. > You added it, you own it! Wow! that's now 16 years ago :) I've checked with Matthew Khouzam (maintainer of Trace Compass) which care about this tracepoint, and we have not identified any significant impact of moving it on its model of the scheduler, other than slightly changing its timing. I've also checked quickly in lttng-analyses and have not found any code that care about its specific placement. So I would say go ahead and move it earlier in do_exit(), it's fine by me. If you are interested in a bit of archeology, "sched_process_free" originated from my ltt-experimental 0.1.99.13 kernel patch against 2.6.12-rc4-mm2 back in September 2005 (that's 19 years ago). It was a precursor to the LTTng 0.x kernel patchset. https://lttng.org/files/ltt-experimental/patch-2.6.12-rc4-mm2-ltt-exp-0.1.99.13.gz Index: kernel/exit.c =================================================================== --- a/kernel/exit.c (.../trunk/kernel/linux-2.6.12-rc4-mm2) (revision 41) +++ b/kernel/exit.c (.../branches/mathieu/linux-2.6.12-rc4-mm2) (revision 41) @@ -4,6 +4,7 @@ * Copyright (C) 1991, 1992 Linus Torvalds */ +#include <linux/ltt/ltt-facility-process.h> #include <linux/config.h> #include <linux/mm.h> #include <linux/slab.h> @@ -55,6 +56,7 @@ static void __unhash_process(struct task } REMOVE_LINKS(p); + trace_process_free(p->pid); } void release_task(struct task_struct * p) @@ -832,6 +834,8 @@ fastcall NORET_TYPE void do_exit(long co } exit_mm(tsk); + trace_process_exit(tsk->pid); + exit_sem(tsk); __exit_files(tsk); __exit_fs(tsk); This was a significant improvement over the prior LTT which only had the equivalent of "sched_process_exit", which caused issues with the Linux scheduler model in LTTV due to zombie processes. Here is where it appeared in LTT back in 1999: http://www.opersys.com/ftp/pub/LTT/TracePackage-0.9.0.tgz patch-ltt-2.2.13-991118 diff -urN linux/kernel/exit.c linux-2.2.13/kernel/exit.c --- linux/kernel/exit.c Tue Oct 19 20:14:02 1999 +++ linux-2.2.13/kernel/exit.c Sun Nov 7 23:49:17 1999 @@ -14,6 +14,8 @@ #include <linux/acct.h> #endif +#include <linux/trace.h> + #include <asm/uaccess.h> #include <asm/pgtable.h> #include <asm/mmu_context.h> @@ -386,6 +388,8 @@ del_timer(&tsk->real_timer); end_bh_atomic(); + TRACE_PROCESS(TRACE_EV_PROCESS_EXIT, 0, 0); + lock_kernel(); fake_volatile: #ifdef CONFIG_BSD_PROCESS_ACCT And it was moved to its current location (after exit_mm()) a bit later (2001): http://www.opersys.com/ftp/pub/LTT/TraceToolkit-0.9.5pre2.tgz Patches/patch-ltt-linux-2.4.5-vanilla-010909-1.10 diff -urN linux/kernel/exit.c /ext2/home/karym/kernel/linux-2.4.5/kernel/exit.c --- linux/kernel/exit.c Fri May 4 17:44:06 2001 +++ /ext2/home/karym/kernel/linux-2.4.5/kernel/exit.c Wed Jun 20 12:39:24 2001 @@ -14,6 +14,8 @@ #include <linux/acct.h> #endif +#include <linux/trace.h> + #include <asm/uaccess.h> #include <asm/pgtable.h> #include <asm/mmu_context.h> @@ -439,6 +441,8 @@ #endif __exit_mm(tsk); + TRACE_PROCESS(TRACE_EV_PROCESS_EXIT, 0, 0); + lock_kernel(); sem_exit(); __exit_files(tsk); So this sched_process_exit placement was actually decided by Karim Yaghmour back in the LTT days (2001). I don't think he will mind us moving it around some 23 years later. ;) Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Hi Lakshmi, On 2/20/24 10:24 AM, Lakshmi Deverkonda wrote: > Hi, > > Sorry, I could not reply on this thread. We tried to handle these issues > in our application code. > One query, what is the write way to delete the lttng logger to stop > logging the events(from the code). I think that the design of LTTng-UST agents is such that tracing is not meant to be tightly controlled by the traced applications themselves. To stop emitting events: * disable the python events for the session(s): `lttng disable-event --python --all-events --session=<session name> --channel=<channel name>` * stop the tracing session(s)`lttng stop <session name>` * quit the `sessiond` Note: the agent thread(s) in the python application will continue to run, but not emit events. If you want to do things from within the application, there are some options: * Implement your own logic to stop calling `self.lttng_logger.log()` * Add a filter to the `lttngust.loghandler._Handler` objects on the root logger * Forcibly remove the `lttngust.loghandler._Handler` handler(s) from root logger (this really isn't meant to be done) * Use liblttngctl to perform one of the above actions (disable the python event(s), stopping the tracing sessions(s), ...) thanks, kienan > > > Regards, > Lakshmi > ------------------------------------------------------------------------ > *From:* Kienan Stewart <kstewart@efficios.com> > *Sent:* 16 February 2024 22:11 > *To:* Lakshmi Deverkonda <laksd@nvidia.com>; lttng-dev@lists.lttng.org > <lttng-dev@lists.lttng.org> > *Subject:* Re: [lttng-dev] Crash in application due to watchdog timeout > with python3 lttng > External email: Use caution opening links or attachments > > > Hi Lakshmi, > > On 2/16/24 09:33, Lakshmi Deverkonda wrote: >> This is how, we have created the logger. So the first logger is for file >> logging where is as the second one is for lttng. >> >> self.logger = logging.getLogger('cd') >> self.lttng_logger = logging.getLogger('cd-lttng') >> >> It seems like at the instant exactly when lttng is logging some data on >> a particular thread and the same instant we receive SIGTERM for the >> application, >> we are unable to join that particular thread. Can you please help. >> > > This doesn't constitute a usable reproducer for us. You are also > omitting information on the setup and usage of lttng on your system. > > I get the impression you are not in a position to share your code. > EfficiOS offers support contracts with NDAs that could allow us to work > with you to analyze and improve your use of LTTng. For more info, please > feel free to contact sales@efficios.com. > >> Also we see that performance of lttng is not that good for python3. My >> application has around 24 threads and when logging is enabled for each >> of the threads, >> there is a delay upto 24s for processing the external events. >> Please suggest how to proceed further on these issues. > > Could you describe what you mean by 'processing external events'? > > Which system(s) are involved in processing the events? > > Are the 'external events' the events emitted by invoking > `self.lttng_logger.info('...')`, for example? > > What versions of lttng-tools, lttng-ust, urcu, babeltrace, and python3 > are you using? Are you using a relay-daemon at any point? > > How are your lttng sessions configured? Eg. memory allocation, blocking > settings, behaviour on full buffers, etc. The commands you use to create > the session, enable the channels, and activate the events would be great > information to have. > > While performing the logging is the system under heavy load from other > sources? What resources on the system face the most contention (CPU, IO, > memory, ...)? > > We'd be more than happy to analyze the performance of python-lttngust > and work to make improvements so it can meet your needs under a > development contract. For more information, please reach out to > sales@efficios.com. > >> >> Regards, >> Lakshmi > > I have taken the time to invent a fictitious example based on the few > details you have given: > https://gist.github.com/kienanstewart/879bd3bf19d852653b70a3c42caef361 <https://gist.github.com/kienanstewart/879bd3bf19d852653b70a3c42caef361> > which spawns a number of python threads using the threading module. > > I am using lttng-tools master, lttng-ust master at > 47bc09f338f3c1199a878f77b7b18be8d2a224f6, urcu master at > 81270292c23ff28aba1abd9a65f0624b657de82b, and babeltrace2 master at > b93af5a2d22e36cf547da1739d60e19791daccbd. My system is running Debian > sid with python 3.11.8. > > To set up a recording session I do the following: > > ``` > lttng create > lttng enable-event --python 'tp' > lttng start > ``` > > To run the application, I do the following: > > ``` > time python3 ./main.py > ``` > > To quit the application, I send sigterm using the following command > > ``` > killall $(pgrep -f 'python3 ./main.py') > ``` > > After the application terminates, I stop the session and view the events > > ``` > lttng stop > lttng view > lttng view | wc -l > ``` > > In a 25s run of the application on my 4-thread laptop, I recorded > 1010748 events. > > thanks, > kienan > >> >> ------------------------------------------------------------------------ >> *From:* Lakshmi Deverkonda <laksd@nvidia.com> >> *Sent:* 13 February 2024 21:05 >> *To:* Kienan Stewart <kstewart@efficios.com>; lttng-dev@lists.lttng.org >> <lttng-dev@lists.lttng.org> >> *Subject:* Re: [lttng-dev] Crash in application due to watchdog timeout >> with python3 lttng >> Yes. We are trying to join only the threads related to the application. >> The timeout is happening while trying to join the threads started by the >> application. >> >> Regards, >> Lakshmi >> ------------------------------------------------------------------------ >> *From:* Kienan Stewart <kstewart@efficios.com> >> *Sent:* 13 February 2024 20:50 >> *To:* Lakshmi Deverkonda <laksd@nvidia.com>; lttng-dev@lists.lttng.org >> <lttng-dev@lists.lttng.org> >> *Subject:* Re: [lttng-dev] Crash in application due to watchdog timeout >> with python3 lttng >> External email: Use caution opening links or attachments >> >> >> Hi Lakshmi, >> >> when the lttngust python agent starts, it attempts to connect to one or >> more session daemons[1]. >> >> Each connection starts a thread that loops forever, retrying the >> registration in case an exception occurs[2]. >> >> I don't think the it's designed to have `join()` called on those >> threads, which I assume is happening in some of the code you or your >> team have written. >> >> My initial thought is that you should `join()` only the threads that >> pertinent to your application, ignoring the lttngust agent threads and >> then exit the application as normal. >> >> [1]: >> https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334 <https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334> <https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334 <https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334>> >> [2]: >> https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83 <https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83> <https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83 <https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83>> >> >> thanks, >> kienan >> >> On 2/13/24 09:23, Lakshmi Deverkonda via lttng-dev wrote: >>> Hi, >>> >>> We are able to integrate python3 lttng module in our application(python3 >>> based). However, we are seeing that whenever the application terminates, >>> there is watchdog timeout due to timeout in joining the threads. What >>> could be the reason for this ? Does lttng module hold any thread event >>> locks ? >>> We are completely blocked on this issue. Could you please help ? >>> >>> Here is the snippet of the core dump >>> >>> (gdb) py-bt >>> Traceback (most recent call first): >>> File "/usr/lib/python3.7/threading.py", line 1048, in >>> _wait_for_tstate_lock >>> elif lock.acquire(block, timeout): >>> File "/usr/lib/python3.7/threading.py", line 1032, in join >>> self._wait_for_tstate_lock() >>> File "/usr/lib/python3/dist-packages/h.py", line 231, in JoinThreads >>> self.TT.join() >>> File "/usr/sbin/c", line 1466, in do_exit >>> H.JoinThreads() >>> File "/usr/sbin/c", line 7201, in main >>> do_exit(nlm, status) >>> File "/usr/sbin/c", line 7233, in <module> >>> main() >>> (gdb) >>> >>> On a parallel note, thanks to Kienan who has been trying to provide >>> pointers on various issues reported so far. >>> >>> Need help on this issue as well. >>> Thanks in advance, >>> >>> Regards, >>> Lakshmi >>> >>> >>> >>> _______________________________________________ >>> lttng-dev mailing list >>> lttng-dev@lists.lttng.org >>> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev <https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev> <https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev <https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev>> _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Hi, we are just exploring the field, so asking here is probably good idea. We are currently using bucketed heaps for TTL-based expiration of DNS records in BIND 9. This doesn't scale that well and has other problems, so I was thinking that we might be able to replace this with something better. Anyone heard or read about good lock-free / wait-free priority queues preferably based on URCU? :) Cheers, -- Ondřej Surý (He/Him) ondrej@sury.org _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
[-- Attachment #1.1: Type: text/plain, Size: 10953 bytes --] Hi, Sorry, I could not reply on this thread. We tried to handle these issues in our application code. One query, what is the write way to delete the lttng logger to stop logging the events(from the code). Regards, Lakshmi ________________________________ From: Kienan Stewart <kstewart@efficios.com> Sent: 16 February 2024 22:11 To: Lakshmi Deverkonda <laksd@nvidia.com>; lttng-dev@lists.lttng.org <lttng-dev@lists.lttng.org> Subject: Re: [lttng-dev] Crash in application due to watchdog timeout with python3 lttng External email: Use caution opening links or attachments Hi Lakshmi, On 2/16/24 09:33, Lakshmi Deverkonda wrote: > This is how, we have created the logger. So the first logger is for file > logging where is as the second one is for lttng. > > self.logger = logging.getLogger('cd') > self.lttng_logger = logging.getLogger('cd-lttng') > > It seems like at the instant exactly when lttng is logging some data on > a particular thread and the same instant we receive SIGTERM for the > application, > we are unable to join that particular thread. Can you please help. > This doesn't constitute a usable reproducer for us. You are also omitting information on the setup and usage of lttng on your system. I get the impression you are not in a position to share your code. EfficiOS offers support contracts with NDAs that could allow us to work with you to analyze and improve your use of LTTng. For more info, please feel free to contact sales@efficios.com. > Also we see that performance of lttng is not that good for python3. My > application has around 24 threads and when logging is enabled for each > of the threads, > there is a delay upto 24s for processing the external events. > Please suggest how to proceed further on these issues. Could you describe what you mean by 'processing external events'? Which system(s) are involved in processing the events? Are the 'external events' the events emitted by invoking `self.lttng_logger.info('...')`, for example? What versions of lttng-tools, lttng-ust, urcu, babeltrace, and python3 are you using? Are you using a relay-daemon at any point? How are your lttng sessions configured? Eg. memory allocation, blocking settings, behaviour on full buffers, etc. The commands you use to create the session, enable the channels, and activate the events would be great information to have. While performing the logging is the system under heavy load from other sources? What resources on the system face the most contention (CPU, IO, memory, ...)? We'd be more than happy to analyze the performance of python-lttngust and work to make improvements so it can meet your needs under a development contract. For more information, please reach out to sales@efficios.com. > > Regards, > Lakshmi I have taken the time to invent a fictitious example based on the few details you have given: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fkienanstewart%2F879bd3bf19d852653b70a3c42caef361&data=05%7C02%7Claksd%40nvidia.com%7C41cb3fd667944d89cab708dc2f0e2a78%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638436985100994598%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=W%2Fb94D39McorSr2ztImThxlyb%2FsFcAgTrnb22Ymo50Q%3D&reserved=0<https://gist.github.com/kienanstewart/879bd3bf19d852653b70a3c42caef361> which spawns a number of python threads using the threading module. I am using lttng-tools master, lttng-ust master at 47bc09f338f3c1199a878f77b7b18be8d2a224f6, urcu master at 81270292c23ff28aba1abd9a65f0624b657de82b, and babeltrace2 master at b93af5a2d22e36cf547da1739d60e19791daccbd. My system is running Debian sid with python 3.11.8. To set up a recording session I do the following: ``` lttng create lttng enable-event --python 'tp' lttng start ``` To run the application, I do the following: ``` time python3 ./main.py ``` To quit the application, I send sigterm using the following command ``` killall $(pgrep -f 'python3 ./main.py') ``` After the application terminates, I stop the session and view the events ``` lttng stop lttng view lttng view | wc -l ``` In a 25s run of the application on my 4-thread laptop, I recorded 1010748 events. thanks, kienan > > ------------------------------------------------------------------------ > *From:* Lakshmi Deverkonda <laksd@nvidia.com> > *Sent:* 13 February 2024 21:05 > *To:* Kienan Stewart <kstewart@efficios.com>; lttng-dev@lists.lttng.org > <lttng-dev@lists.lttng.org> > *Subject:* Re: [lttng-dev] Crash in application due to watchdog timeout > with python3 lttng > Yes. We are trying to join only the threads related to the application. > The timeout is happening while trying to join the threads started by the > application. > > Regards, > Lakshmi > ------------------------------------------------------------------------ > *From:* Kienan Stewart <kstewart@efficios.com> > *Sent:* 13 February 2024 20:50 > *To:* Lakshmi Deverkonda <laksd@nvidia.com>; lttng-dev@lists.lttng.org > <lttng-dev@lists.lttng.org> > *Subject:* Re: [lttng-dev] Crash in application due to watchdog timeout > with python3 lttng > External email: Use caution opening links or attachments > > > Hi Lakshmi, > > when the lttngust python agent starts, it attempts to connect to one or > more session daemons[1]. > > Each connection starts a thread that loops forever, retrying the > registration in case an exception occurs[2]. > > I don't think the it's designed to have `join()` called on those > threads, which I assume is happening in some of the code you or your > team have written. > > My initial thought is that you should `join()` only the threads that > pertinent to your application, ignoring the lttngust agent threads and > then exit the application as normal. > > [1]: > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flttng%2Flttng-ust%2Fblob%2F3287f48be61ef3491aff0a80b7185ac57b3d8a5d%2Fsrc%2Fpython-lttngust%2Flttngust%2Fagent.py%23L334&data=05%7C02%7Claksd%40nvidia.com%7C41cb3fd667944d89cab708dc2f0e2a78%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638436985101003000%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=mZjN5F0W%2BHNWslQAULblQHefyQIT5cpSNFylxAY2kAk%3D&reserved=0<https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flttng%2Flttng-ust%2Fblob%2F3287f48be61ef3491aff0a80b7185ac57b3d8a5d%2Fsrc%2Fpython-lttngust%2Flttngust%2Fagent.py%23L334&data=05%7C02%7Claksd%40nvidia.com%7C41cb3fd667944d89cab708dc2f0e2a78%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638436985101009055%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=JypI4VvwxEZzTGG9621hNAvonem63ljMZiXaqvJhIQw%3D&reserved=0<https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334>> > [2]: > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flttng%2Flttng-ust%2Fblob%2F3287f48be61ef3491aff0a80b7185ac57b3d8a5d%2Fsrc%2Fpython-lttngust%2Flttngust%2Fagent.py%23L83&data=05%7C02%7Claksd%40nvidia.com%7C41cb3fd667944d89cab708dc2f0e2a78%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638436985101015117%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=ZTbmTvR2uY1QoS9qKA6HqwXRKFd3pY%2F39kw2qwjaaVM%3D&reserved=0<https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flttng%2Flttng-ust%2Fblob%2F3287f48be61ef3491aff0a80b7185ac57b3d8a5d%2Fsrc%2Fpython-lttngust%2Flttngust%2Fagent.py%23L83&data=05%7C02%7Claksd%40nvidia.com%7C41cb3fd667944d89cab708dc2f0e2a78%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638436985101021691%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=%2B6JlJyEJVLlfwCMv8eHWwnQwr298L%2Fsk3vGNUuhaAMU%3D&reserved=0<https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83>> > > thanks, > kienan > > On 2/13/24 09:23, Lakshmi Deverkonda via lttng-dev wrote: >> Hi, >> >> We are able to integrate python3 lttng module in our application(python3 >> based). However, we are seeing that whenever the application terminates, >> there is watchdog timeout due to timeout in joining the threads. What >> could be the reason for this ? Does lttng module hold any thread event >> locks ? >> We are completely blocked on this issue. Could you please help ? >> >> Here is the snippet of the core dump >> >> (gdb) py-bt >> Traceback (most recent call first): >> File "/usr/lib/python3.7/threading.py", line 1048, in >> _wait_for_tstate_lock >> elif lock.acquire(block, timeout): >> File "/usr/lib/python3.7/threading.py", line 1032, in join >> self._wait_for_tstate_lock() >> File "/usr/lib/python3/dist-packages/h.py", line 231, in JoinThreads >> self.TT.join() >> File "/usr/sbin/c", line 1466, in do_exit >> H.JoinThreads() >> File "/usr/sbin/c", line 7201, in main >> do_exit(nlm, status) >> File "/usr/sbin/c", line 7233, in <module> >> main() >> (gdb) >> >> On a parallel note, thanks to Kienan who has been trying to provide >> pointers on various issues reported so far. >> >> Need help on this issue as well. >> Thanks in advance, >> >> Regards, >> Lakshmi >> >> >> >> _______________________________________________ >> lttng-dev mailing list >> lttng-dev@lists.lttng.org >> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.lttng.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Flttng-dev&data=05%7C02%7Claksd%40nvidia.com%7C41cb3fd667944d89cab708dc2f0e2a78%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638436985101026830%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=mB2APfDsn7BObrStEEWtfOHkxa3zC8LOnk%2FsuKdL9%2F0%3D&reserved=0<https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.lttng.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Flttng-dev&data=05%7C02%7Claksd%40nvidia.com%7C41cb3fd667944d89cab708dc2f0e2a78%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638436985101031212%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=LEnpdupFl2tg8vh0cV3YlRpSBXAnfaW9oW40eVXzBfI%3D&reserved=0<https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev>> [-- Attachment #1.2: Type: text/html, Size: 14781 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Hi Lakshmi, On 2/16/24 09:33, Lakshmi Deverkonda wrote: > This is how, we have created the logger. So the first logger is for file > logging where is as the second one is for lttng. > > self.logger = logging.getLogger('cd') > self.lttng_logger = logging.getLogger('cd-lttng') > > It seems like at the instant exactly when lttng is logging some data on > a particular thread and the same instant we receive SIGTERM for the > application, > we are unable to join that particular thread. Can you please help. > This doesn't constitute a usable reproducer for us. You are also omitting information on the setup and usage of lttng on your system. I get the impression you are not in a position to share your code. EfficiOS offers support contracts with NDAs that could allow us to work with you to analyze and improve your use of LTTng. For more info, please feel free to contact sales@efficios.com. > Also we see that performance of lttng is not that good for python3. My > application has around 24 threads and when logging is enabled for each > of the threads, > there is a delay upto 24s for processing the external events. > Please suggest how to proceed further on these issues. Could you describe what you mean by 'processing external events'? Which system(s) are involved in processing the events? Are the 'external events' the events emitted by invoking `self.lttng_logger.info('...')`, for example? What versions of lttng-tools, lttng-ust, urcu, babeltrace, and python3 are you using? Are you using a relay-daemon at any point? How are your lttng sessions configured? Eg. memory allocation, blocking settings, behaviour on full buffers, etc. The commands you use to create the session, enable the channels, and activate the events would be great information to have. While performing the logging is the system under heavy load from other sources? What resources on the system face the most contention (CPU, IO, memory, ...)? We'd be more than happy to analyze the performance of python-lttngust and work to make improvements so it can meet your needs under a development contract. For more information, please reach out to sales@efficios.com. > > Regards, > Lakshmi I have taken the time to invent a fictitious example based on the few details you have given: https://gist.github.com/kienanstewart/879bd3bf19d852653b70a3c42caef361 which spawns a number of python threads using the threading module. I am using lttng-tools master, lttng-ust master at 47bc09f338f3c1199a878f77b7b18be8d2a224f6, urcu master at 81270292c23ff28aba1abd9a65f0624b657de82b, and babeltrace2 master at b93af5a2d22e36cf547da1739d60e19791daccbd. My system is running Debian sid with python 3.11.8. To set up a recording session I do the following: ``` lttng create lttng enable-event --python 'tp' lttng start ``` To run the application, I do the following: ``` time python3 ./main.py ``` To quit the application, I send sigterm using the following command ``` killall $(pgrep -f 'python3 ./main.py') ``` After the application terminates, I stop the session and view the events ``` lttng stop lttng view lttng view | wc -l ``` In a 25s run of the application on my 4-thread laptop, I recorded 1010748 events. thanks, kienan > > ------------------------------------------------------------------------ > *From:* Lakshmi Deverkonda <laksd@nvidia.com> > *Sent:* 13 February 2024 21:05 > *To:* Kienan Stewart <kstewart@efficios.com>; lttng-dev@lists.lttng.org > <lttng-dev@lists.lttng.org> > *Subject:* Re: [lttng-dev] Crash in application due to watchdog timeout > with python3 lttng > Yes. We are trying to join only the threads related to the application. > The timeout is happening while trying to join the threads started by the > application. > > Regards, > Lakshmi > ------------------------------------------------------------------------ > *From:* Kienan Stewart <kstewart@efficios.com> > *Sent:* 13 February 2024 20:50 > *To:* Lakshmi Deverkonda <laksd@nvidia.com>; lttng-dev@lists.lttng.org > <lttng-dev@lists.lttng.org> > *Subject:* Re: [lttng-dev] Crash in application due to watchdog timeout > with python3 lttng > External email: Use caution opening links or attachments > > > Hi Lakshmi, > > when the lttngust python agent starts, it attempts to connect to one or > more session daemons[1]. > > Each connection starts a thread that loops forever, retrying the > registration in case an exception occurs[2]. > > I don't think the it's designed to have `join()` called on those > threads, which I assume is happening in some of the code you or your > team have written. > > My initial thought is that you should `join()` only the threads that > pertinent to your application, ignoring the lttngust agent threads and > then exit the application as normal. > > [1]: > https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334 <https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334> > [2]: > https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83 <https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83> > > thanks, > kienan > > On 2/13/24 09:23, Lakshmi Deverkonda via lttng-dev wrote: >> Hi, >> >> We are able to integrate python3 lttng module in our application(python3 >> based). However, we are seeing that whenever the application terminates, >> there is watchdog timeout due to timeout in joining the threads. What >> could be the reason for this ? Does lttng module hold any thread event >> locks ? >> We are completely blocked on this issue. Could you please help ? >> >> Here is the snippet of the core dump >> >> (gdb) py-bt >> Traceback (most recent call first): >> File "/usr/lib/python3.7/threading.py", line 1048, in >> _wait_for_tstate_lock >> elif lock.acquire(block, timeout): >> File "/usr/lib/python3.7/threading.py", line 1032, in join >> self._wait_for_tstate_lock() >> File "/usr/lib/python3/dist-packages/h.py", line 231, in JoinThreads >> self.TT.join() >> File "/usr/sbin/c", line 1466, in do_exit >> H.JoinThreads() >> File "/usr/sbin/c", line 7201, in main >> do_exit(nlm, status) >> File "/usr/sbin/c", line 7233, in <module> >> main() >> (gdb) >> >> On a parallel note, thanks to Kienan who has been trying to provide >> pointers on various issues reported so far. >> >> Need help on this issue as well. >> Thanks in advance, >> >> Regards, >> Lakshmi >> >> >> >> _______________________________________________ >> lttng-dev mailing list >> lttng-dev@lists.lttng.org >> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev <https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev> _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
[-- Attachment #1.1: Type: text/plain, Size: 5359 bytes --] This is how, we have created the logger. So the first logger is for file logging where is as the second one is for lttng. self.logger = logging.getLogger('cd') self.lttng_logger = logging.getLogger('cd-lttng') It seems like at the instant exactly when lttng is logging some data on a particular thread and the same instant we receive SIGTERM for the application, we are unable to join that particular thread. Can you please help. Also we see that performance of lttng is not that good for python3. My application has around 24 threads and when logging is enabled for each of the threads, there is a delay upto 24s for processing the external events. Please suggest how to proceed further on these issues. Regards, Lakshmi ________________________________ From: Lakshmi Deverkonda <laksd@nvidia.com> Sent: 13 February 2024 21:05 To: Kienan Stewart <kstewart@efficios.com>; lttng-dev@lists.lttng.org <lttng-dev@lists.lttng.org> Subject: Re: [lttng-dev] Crash in application due to watchdog timeout with python3 lttng Yes. We are trying to join only the threads related to the application. The timeout is happening while trying to join the threads started by the application. Regards, Lakshmi ________________________________ From: Kienan Stewart <kstewart@efficios.com> Sent: 13 February 2024 20:50 To: Lakshmi Deverkonda <laksd@nvidia.com>; lttng-dev@lists.lttng.org <lttng-dev@lists.lttng.org> Subject: Re: [lttng-dev] Crash in application due to watchdog timeout with python3 lttng External email: Use caution opening links or attachments Hi Lakshmi, when the lttngust python agent starts, it attempts to connect to one or more session daemons[1]. Each connection starts a thread that loops forever, retrying the registration in case an exception occurs[2]. I don't think the it's designed to have `join()` called on those threads, which I assume is happening in some of the code you or your team have written. My initial thought is that you should `join()` only the threads that pertinent to your application, ignoring the lttngust agent threads and then exit the application as normal. [1]: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flttng%2Flttng-ust%2Fblob%2F3287f48be61ef3491aff0a80b7185ac57b3d8a5d%2Fsrc%2Fpython-lttngust%2Flttngust%2Fagent.py%23L334&data=05%7C02%7Claksd%40nvidia.com%7Cbdf064d348474249f14a08dc2ca755c9%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638434344447867621%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=7tmpFtjl7RkTVgYLr2YjdlPs2oM1F%2FXOg6W51mHDCws%3D&reserved=0<https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334> [2]: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flttng%2Flttng-ust%2Fblob%2F3287f48be61ef3491aff0a80b7185ac57b3d8a5d%2Fsrc%2Fpython-lttngust%2Flttngust%2Fagent.py%23L83&data=05%7C02%7Claksd%40nvidia.com%7Cbdf064d348474249f14a08dc2ca755c9%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638434344447874777%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=PKb8rKDWFKmuuVB4YQEL8ZtAP%2B%2BYfTniUuLN9fFBctc%3D&reserved=0<https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83> thanks, kienan On 2/13/24 09:23, Lakshmi Deverkonda via lttng-dev wrote: > Hi, > > We are able to integrate python3 lttng module in our application(python3 > based). However, we are seeing that whenever the application terminates, > there is watchdog timeout due to timeout in joining the threads. What > could be the reason for this ? Does lttng module hold any thread event > locks ? > We are completely blocked on this issue. Could you please help ? > > Here is the snippet of the core dump > > (gdb) py-bt > Traceback (most recent call first): > File "/usr/lib/python3.7/threading.py", line 1048, in > _wait_for_tstate_lock > elif lock.acquire(block, timeout): > File "/usr/lib/python3.7/threading.py", line 1032, in join > self._wait_for_tstate_lock() > File "/usr/lib/python3/dist-packages/h.py", line 231, in JoinThreads > self.TT.join() > File "/usr/sbin/c", line 1466, in do_exit > H.JoinThreads() > File "/usr/sbin/c", line 7201, in main > do_exit(nlm, status) > File "/usr/sbin/c", line 7233, in <module> > main() > (gdb) > > On a parallel note, thanks to Kienan who has been trying to provide > pointers on various issues reported so far. > > Need help on this issue as well. > Thanks in advance, > > Regards, > Lakshmi > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev@lists.lttng.org > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.lttng.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Flttng-dev&data=05%7C02%7Claksd%40nvidia.com%7Cbdf064d348474249f14a08dc2ca755c9%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638434344447880631%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=2iVi8xLrTS1Dj%2FcF3V30q0OjCvMP4kTpOUSthJvnZI0%3D&reserved=0<https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev> [-- Attachment #1.2: Type: text/html, Size: 11919 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Hi Lakshmi, On 2/13/24 10:35, Lakshmi Deverkonda wrote: > Yes. We are trying to join only the threads related to the application. > The timeout is happening while trying to join the threads started by the > application. In that case, I suspect that the issue is not related to lttngust. I can't help with your internal application code. If you're able to produce a minimal example that reproduces an issue wherein you have deadlock when lttngust is imported, but not when it's omitted I think that would be very interesting. I would also recommend reviewing the bug reporting guidelines at https://lttng.org/community/ to ensure that all the necessary information is present. thanks, kienan > > Regards, > Lakshmi > ------------------------------------------------------------------------ > *From:* Kienan Stewart <kstewart@efficios.com> > *Sent:* 13 February 2024 20:50 > *To:* Lakshmi Deverkonda <laksd@nvidia.com>; lttng-dev@lists.lttng.org > <lttng-dev@lists.lttng.org> > *Subject:* Re: [lttng-dev] Crash in application due to watchdog timeout > with python3 lttng > External email: Use caution opening links or attachments > > > Hi Lakshmi, > > when the lttngust python agent starts, it attempts to connect to one or > more session daemons[1]. > > Each connection starts a thread that loops forever, retrying the > registration in case an exception occurs[2]. > > I don't think the it's designed to have `join()` called on those > threads, which I assume is happening in some of the code you or your > team have written. > > My initial thought is that you should `join()` only the threads that > pertinent to your application, ignoring the lttngust agent threads and > then exit the application as normal. > > [1]: > https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334 <https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334> > [2]: > https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83 <https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83> > > thanks, > kienan > > On 2/13/24 09:23, Lakshmi Deverkonda via lttng-dev wrote: >> Hi, >> >> We are able to integrate python3 lttng module in our application(python3 >> based). However, we are seeing that whenever the application terminates, >> there is watchdog timeout due to timeout in joining the threads. What >> could be the reason for this ? Does lttng module hold any thread event >> locks ? >> We are completely blocked on this issue. Could you please help ? >> >> Here is the snippet of the core dump >> >> (gdb) py-bt >> Traceback (most recent call first): >> File "/usr/lib/python3.7/threading.py", line 1048, in >> _wait_for_tstate_lock >> elif lock.acquire(block, timeout): >> File "/usr/lib/python3.7/threading.py", line 1032, in join >> self._wait_for_tstate_lock() >> File "/usr/lib/python3/dist-packages/h.py", line 231, in JoinThreads >> self.TT.join() >> File "/usr/sbin/c", line 1466, in do_exit >> H.JoinThreads() >> File "/usr/sbin/c", line 7201, in main >> do_exit(nlm, status) >> File "/usr/sbin/c", line 7233, in <module> >> main() >> (gdb) >> >> On a parallel note, thanks to Kienan who has been trying to provide >> pointers on various issues reported so far. >> >> Need help on this issue as well. >> Thanks in advance, >> >> Regards, >> Lakshmi >> >> >> >> _______________________________________________ >> lttng-dev mailing list >> lttng-dev@lists.lttng.org >> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev <https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev> _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
[-- Attachment #1.1: Type: text/plain, Size: 4311 bytes --] Yes. We are trying to join only the threads related to the application. The timeout is happening while trying to join the threads started by the application. Regards, Lakshmi ________________________________ From: Kienan Stewart <kstewart@efficios.com> Sent: 13 February 2024 20:50 To: Lakshmi Deverkonda <laksd@nvidia.com>; lttng-dev@lists.lttng.org <lttng-dev@lists.lttng.org> Subject: Re: [lttng-dev] Crash in application due to watchdog timeout with python3 lttng External email: Use caution opening links or attachments Hi Lakshmi, when the lttngust python agent starts, it attempts to connect to one or more session daemons[1]. Each connection starts a thread that loops forever, retrying the registration in case an exception occurs[2]. I don't think the it's designed to have `join()` called on those threads, which I assume is happening in some of the code you or your team have written. My initial thought is that you should `join()` only the threads that pertinent to your application, ignoring the lttngust agent threads and then exit the application as normal. [1]: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flttng%2Flttng-ust%2Fblob%2F3287f48be61ef3491aff0a80b7185ac57b3d8a5d%2Fsrc%2Fpython-lttngust%2Flttngust%2Fagent.py%23L334&data=05%7C02%7Claksd%40nvidia.com%7Cbdf064d348474249f14a08dc2ca755c9%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638434344447867621%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=7tmpFtjl7RkTVgYLr2YjdlPs2oM1F%2FXOg6W51mHDCws%3D&reserved=0<https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334> [2]: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flttng%2Flttng-ust%2Fblob%2F3287f48be61ef3491aff0a80b7185ac57b3d8a5d%2Fsrc%2Fpython-lttngust%2Flttngust%2Fagent.py%23L83&data=05%7C02%7Claksd%40nvidia.com%7Cbdf064d348474249f14a08dc2ca755c9%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638434344447874777%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=PKb8rKDWFKmuuVB4YQEL8ZtAP%2B%2BYfTniUuLN9fFBctc%3D&reserved=0<https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83> thanks, kienan On 2/13/24 09:23, Lakshmi Deverkonda via lttng-dev wrote: > Hi, > > We are able to integrate python3 lttng module in our application(python3 > based). However, we are seeing that whenever the application terminates, > there is watchdog timeout due to timeout in joining the threads. What > could be the reason for this ? Does lttng module hold any thread event > locks ? > We are completely blocked on this issue. Could you please help ? > > Here is the snippet of the core dump > > (gdb) py-bt > Traceback (most recent call first): > File "/usr/lib/python3.7/threading.py", line 1048, in > _wait_for_tstate_lock > elif lock.acquire(block, timeout): > File "/usr/lib/python3.7/threading.py", line 1032, in join > self._wait_for_tstate_lock() > File "/usr/lib/python3/dist-packages/h.py", line 231, in JoinThreads > self.TT.join() > File "/usr/sbin/c", line 1466, in do_exit > H.JoinThreads() > File "/usr/sbin/c", line 7201, in main > do_exit(nlm, status) > File "/usr/sbin/c", line 7233, in <module> > main() > (gdb) > > On a parallel note, thanks to Kienan who has been trying to provide > pointers on various issues reported so far. > > Need help on this issue as well. > Thanks in advance, > > Regards, > Lakshmi > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev@lists.lttng.org > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.lttng.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Flttng-dev&data=05%7C02%7Claksd%40nvidia.com%7Cbdf064d348474249f14a08dc2ca755c9%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638434344447880631%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=2iVi8xLrTS1Dj%2FcF3V30q0OjCvMP4kTpOUSthJvnZI0%3D&reserved=0<https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev> [-- Attachment #1.2: Type: text/html, Size: 6425 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Hi Lakshmi, when the lttngust python agent starts, it attempts to connect to one or more session daemons[1]. Each connection starts a thread that loops forever, retrying the registration in case an exception occurs[2]. I don't think the it's designed to have `join()` called on those threads, which I assume is happening in some of the code you or your team have written. My initial thought is that you should `join()` only the threads that pertinent to your application, ignoring the lttngust agent threads and then exit the application as normal. [1]: https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L334 [2]: https://github.com/lttng/lttng-ust/blob/3287f48be61ef3491aff0a80b7185ac57b3d8a5d/src/python-lttngust/lttngust/agent.py#L83 thanks, kienan On 2/13/24 09:23, Lakshmi Deverkonda via lttng-dev wrote: > Hi, > > We are able to integrate python3 lttng module in our application(python3 > based). However, we are seeing that whenever the application terminates, > there is watchdog timeout due to timeout in joining the threads. What > could be the reason for this ? Does lttng module hold any thread event > locks ? > We are completely blocked on this issue. Could you please help ? > > Here is the snippet of the core dump > > (gdb) py-bt > Traceback (most recent call first): > File "/usr/lib/python3.7/threading.py", line 1048, in > _wait_for_tstate_lock > elif lock.acquire(block, timeout): > File "/usr/lib/python3.7/threading.py", line 1032, in join > self._wait_for_tstate_lock() > File "/usr/lib/python3/dist-packages/h.py", line 231, in JoinThreads > self.TT.join() > File "/usr/sbin/c", line 1466, in do_exit > H.JoinThreads() > File "/usr/sbin/c", line 7201, in main > do_exit(nlm, status) > File "/usr/sbin/c", line 7233, in <module> > main() > (gdb) > > On a parallel note, thanks to Kienan who has been trying to provide > pointers on various issues reported so far. > > Need help on this issue as well. > Thanks in advance, > > Regards, > Lakshmi > > > > _______________________________________________ > lttng-dev mailing list > lttng-dev@lists.lttng.org > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
[-- Attachment #1.1: Type: text/plain, Size: 1163 bytes --] Hi, We are able to integrate python3 lttng module in our application(python3 based). However, we are seeing that whenever the application terminates, there is watchdog timeout due to timeout in joining the threads. What could be the reason for this ? Does lttng module hold any thread event locks ? We are completely blocked on this issue. Could you please help ? Here is the snippet of the core dump (gdb) py-bt Traceback (most recent call first): File "/usr/lib/python3.7/threading.py", line 1048, in _wait_for_tstate_lock elif lock.acquire(block, timeout): File "/usr/lib/python3.7/threading.py", line 1032, in join self._wait_for_tstate_lock() File "/usr/lib/python3/dist-packages/h.py", line 231, in JoinThreads self.TT.join() File "/usr/sbin/c", line 1466, in do_exit H.JoinThreads() File "/usr/sbin/c", line 7201, in main do_exit(nlm, status) File "/usr/sbin/c", line 7233, in <module> main() (gdb) On a parallel note, thanks to Kienan who has been trying to provide pointers on various issues reported so far. Need help on this issue as well. Thanks in advance, Regards, Lakshmi [-- Attachment #1.2: Type: text/html, Size: 6827 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
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 on an embedded device (e.g. userspace), so in this scenario, the kernel modules might not install to target rootfs, the test cases would be fail and exit. Add LTTNG_TOOLS_DISABLE_KERNEL_TESTS to skip the lttng kernel features test, this flag can be set via "make": make check LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1 When this flag was set, all kernel related testcases would be marked as SKIP in result. Since the the LTTNG_TOOLS_DISABLE_KERNEL_TESTS was checked in function check_skip_kernel_test, lots of testcases also need to check root permission, so merging the root permission checking into check_skip_kernel_test. Change-Id: I0ced8d6bd3c0e496f0ac71b8b84f64e04ea60730 Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com> --- tests/destructive/metadata-regeneration | 8 +--- tests/perf/test_perf_raw.in | 8 +--- tests/regression/kernel/test_all_events | 8 +--- tests/regression/kernel/test_callstack | 8 +--- tests/regression/kernel/test_channel | 8 +--- tests/regression/kernel/test_clock_override | 8 +--- tests/regression/kernel/test_event_basic | 8 +--- tests/regression/kernel/test_kernel_function | 8 +--- tests/regression/kernel/test_lttng_logger | 7 +--- tests/regression/kernel/test_ns_contexts | 8 +--- .../regression/kernel/test_ns_contexts_change | 9 +--- .../kernel/test_rotation_destroy_flush | 8 +--- .../regression/kernel/test_select_poll_epoll | 8 +--- tests/regression/kernel/test_syscall | 8 +--- tests/regression/kernel/test_userspace_probe | 8 +--- tests/regression/tools/clear/test_kernel | 8 +--- .../tools/filtering/test_invalid_filter | 8 +--- .../tools/filtering/test_unsupported_op | 8 +--- .../tools/filtering/test_valid_filter | 8 +--- tests/regression/tools/health/test_health.sh | 10 +---- tests/regression/tools/health/test_thread_ok | 9 +--- tests/regression/tools/live/test_kernel | 10 ++--- tests/regression/tools/live/test_lttng_kernel | 8 +--- tests/regression/tools/metadata/test_kernel | 8 +--- .../test_notification_kernel_buffer_usage | 36 ++++++++-------- .../test_notification_kernel_capture | 23 +++++------ .../test_notification_kernel_error | 23 +++++------ .../test_notification_kernel_instrumentation | 23 +++++------ .../test_notification_kernel_syscall | 19 ++++----- .../test_notification_kernel_userspace_probe | 20 ++++----- .../notification/test_notification_multi_app | 41 +++++++++---------- ...test_notification_notifier_discarded_count | 9 ++-- .../tools/regen-metadata/test_kernel | 8 +--- .../tools/regen-statedump/test_kernel | 8 +--- tests/regression/tools/rotation/test_kernel | 8 +--- .../regression/tools/rotation/test_ust_kernel | 8 +--- tests/regression/tools/snapshots/test_kernel | 9 +--- .../tools/snapshots/test_kernel_streaming | 8 +--- .../tools/snapshots/test_ust_streaming | 6 --- .../streaming/test_high_throughput_limits | 8 +--- tests/regression/tools/streaming/test_kernel | 8 +--- .../tools/tracker/test_event_tracker | 8 +--- .../tools/trigger/test_add_trigger_cli | 12 ++---- .../tools/trigger/test_list_triggers_cli | 21 ++++------ .../tools/wildcard/test_event_wildcard | 8 +--- .../test_relayd_working_directory | 4 +- .../ust/namespaces/test_ns_contexts_change | 7 +--- tests/regression/ust/test_event_perf | 8 +--- tests/utils/utils.sh | 33 +++++++++++++++ 49 files changed, 178 insertions(+), 385 deletions(-) diff --git a/tests/destructive/metadata-regeneration b/tests/destructive/metadata-regeneration index 048c601b6..457f0b9dd 100755 --- a/tests/destructive/metadata-regeneration +++ b/tests/destructive/metadata-regeneration @@ -189,12 +189,6 @@ function test_ust_streaming () rm -f "${file_sync_before_last}" } -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - if ! destructive_tests_enabled ; then echo 'Please make sure that ntp is not running while executing this test' skip 0 "You need to set the LTTNG_ENABLE_DESTRUCTIVE_TESTS environment variable to \"will-break-my-system\" to run this test" $NUM_TESTS @@ -202,7 +196,7 @@ if ! destructive_tests_enabled ; then exit 0 fi -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test $NUM_TESTS || { original_date=$(date) start_lttng_relayd "-o $TRACE_PATH" diff --git a/tests/perf/test_perf_raw.in b/tests/perf/test_perf_raw.in index 0a451ce63..00cdebc55 100644 --- a/tests/perf/test_perf_raw.in +++ b/tests/perf/test_perf_raw.in @@ -137,12 +137,6 @@ function test_kernel_raw() rm -rf $TRACE_PATH } -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - # MUST set TESTDIR before calling those functions plan_tests $NUM_TESTS @@ -154,7 +148,7 @@ have_libpfm test_ust_raw -skip $isroot "Root access is needed for kernel testing, skipping." 9 || +check_skip_kernel_test 9 || { modprobe lttng-test test_kernel_raw diff --git a/tests/regression/kernel/test_all_events b/tests/regression/kernel/test_all_events index 2fb2f611d..636469dea 100755 --- a/tests/regression/kernel/test_all_events +++ b/tests/regression/kernel/test_all_events @@ -43,13 +43,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_callstack b/tests/regression/kernel/test_callstack index cf39089af..1467e7942 100755 --- a/tests/regression/kernel/test_callstack +++ b/tests/regression/kernel/test_callstack @@ -136,13 +136,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_channel b/tests/regression/kernel/test_channel index 5525564d2..f399f5038 100755 --- a/tests/regression/kernel/test_channel +++ b/tests/regression/kernel/test_channel @@ -47,13 +47,7 @@ function test_channel_buffer_too_large() plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { start_lttng_sessiond diff --git a/tests/regression/kernel/test_clock_override b/tests/regression/kernel/test_clock_override index 524c3c3bb..53c75d3a5 100755 --- a/tests/regression/kernel/test_clock_override +++ b/tests/regression/kernel/test_clock_override @@ -174,13 +174,7 @@ TESTS=( TEST_COUNT=${#TESTS[@]} i=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present trap signal_cleanup SIGTERM SIGINT diff --git a/tests/regression/kernel/test_event_basic b/tests/regression/kernel/test_event_basic index 9f22d7db8..20215a11f 100755 --- a/tests/regression/kernel/test_event_basic +++ b/tests/regression/kernel/test_event_basic @@ -73,13 +73,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test $NUM_TESTS || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_kernel_function b/tests/regression/kernel/test_kernel_function index 131c1c70b..bfdf0091a 100755 --- a/tests/regression/kernel/test_kernel_function +++ b/tests/regression/kernel/test_kernel_function @@ -43,13 +43,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { start_lttng_sessiond_notap validate_lttng_modules_present diff --git a/tests/regression/kernel/test_lttng_logger b/tests/regression/kernel/test_lttng_logger index 849428807..d1b9567ee 100755 --- a/tests/regression/kernel/test_lttng_logger +++ b/tests/regression/kernel/test_lttng_logger @@ -110,13 +110,8 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_ns_contexts b/tests/regression/kernel/test_ns_contexts index 98b673c98..9ada1655a 100755 --- a/tests/regression/kernel/test_ns_contexts +++ b/tests/regression/kernel/test_ns_contexts @@ -108,13 +108,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -isroot=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 - +check_skip_kernel_test "$NUM_TESTS" && exit 0 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 715c67cc8..d2826ba88 100755 --- a/tests/regression/kernel/test_ns_contexts_change +++ b/tests/regression/kernel/test_ns_contexts_change @@ -162,14 +162,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" - -isroot=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 - +check_skip_kernel_test "$NUM_TESTS" && exit 0 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 6e568afda..b2df95811 100755 --- a/tests/regression/kernel/test_rotation_destroy_flush +++ b/tests/regression/kernel/test_rotation_destroy_flush @@ -120,13 +120,7 @@ TESTS=( TEST_COUNT=${#TESTS[@]} i=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present trap signal_cleanup SIGTERM SIGINT diff --git a/tests/regression/kernel/test_select_poll_epoll b/tests/regression/kernel/test_select_poll_epoll index cdde1ea4f..1f457be21 100755 --- a/tests/regression/kernel/test_select_poll_epoll +++ b/tests/regression/kernel/test_select_poll_epoll @@ -363,15 +363,9 @@ if test $? != 0; then exit 0 fi -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - diag "Supported syscalls are $SUPPORTED_SYSCALLS_LIST" -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/kernel/test_syscall b/tests/regression/kernel/test_syscall index f9b490858..20130dde9 100755 --- a/tests/regression/kernel/test_syscall +++ b/tests/regression/kernel/test_syscall @@ -664,13 +664,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_userspace_probe b/tests/regression/kernel/test_userspace_probe index bfa260e47..8e9002e2b 100755 --- a/tests/regression/kernel/test_userspace_probe +++ b/tests/regression/kernel/test_userspace_probe @@ -815,13 +815,7 @@ fi plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/tools/clear/test_kernel b/tests/regression/tools/clear/test_kernel index ce76f85d2..5f86ae386 100755 --- a/tests/regression/tools/clear/test_kernel +++ b/tests/regression/tools/clear/test_kernel @@ -538,12 +538,6 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - streaming_tests=(test_kernel_streaming test_kernel_streaming_rotate_clear test_kernel_streaming_clear_rotate @@ -565,7 +559,7 @@ snapshot_tests=(test_kernel_streaming_snapshot test_kernel_local_snapshot ) -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { trap signal_cleanup SIGTERM SIGINT diff --git a/tests/regression/tools/filtering/test_invalid_filter b/tests/regression/tools/filtering/test_invalid_filter index 8dfbe9eb5..839d6aff8 100755 --- a/tests/regression/tools/filtering/test_invalid_filter +++ b/tests/regression/tools/filtering/test_invalid_filter @@ -170,13 +170,7 @@ done test_bytecode_limit -u -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel invalid filter tests." $NUM_KERNEL_TESTS || +check_skip_kernel_test "$NUM_KERNEL_TESTS" || { diag "Test kernel filters" i=0 diff --git a/tests/regression/tools/filtering/test_unsupported_op b/tests/regression/tools/filtering/test_unsupported_op index dc76f99a6..e8101bdda 100755 --- a/tests/regression/tools/filtering/test_unsupported_op +++ b/tests/regression/tools/filtering/test_unsupported_op @@ -103,13 +103,7 @@ while [ "$i" -lt "$OP_COUNT" ]; do let "i++" done -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel unsupported filter operations tests." $NUM_KERNEL_TESTS || +check_skip_kernel_test $NUM_KERNEL_TESTS || { diag "Test kernel unsupported filter operations" diff --git a/tests/regression/tools/filtering/test_valid_filter b/tests/regression/tools/filtering/test_valid_filter index cd5b1a3b9..f8d3abc0b 100755 --- a/tests/regression/tools/filtering/test_valid_filter +++ b/tests/regression/tools/filtering/test_valid_filter @@ -1454,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" || { diag "Test kernel valid filters" diff --git a/tests/regression/tools/health/test_health.sh b/tests/regression/tools/health/test_health.sh index b4b416f92..85810d8e9 100644 --- a/tests/regression/tools/health/test_health.sh +++ b/tests/regression/tools/health/test_health.sh @@ -82,7 +82,7 @@ function test_health diag "With UST consumer daemons" enable_ust_lttng_event_ok $SESSION_NAME $UST_EVENT_NAME $CHANNEL_NAME - skip $isroot "Root access is needed. Skipping kernel consumer health check test." "1" || + check_skip_kernel_test "1" || { diag "With kernel consumer daemon" lttng_enable_kernel_event $SESSION_NAME $KERNEL_EVENT_NAME $CHANNEL_NAME @@ -113,7 +113,7 @@ function test_health if [ ${test_needs_root} -eq 1 ]; then - skip ${isroot} "Root access needed for test \"${test_thread_name}\"." "1" || + check_skip_kernel_test "1" || { report_errors "${test_thread_error_string}" "${test_relayd}" } @@ -271,12 +271,6 @@ STDERR_PATH=$(mktemp -t tmp.test_health_stderr_path.XXXXXX) TRACE_PATH=$(mktemp -d -t tmp.test_health_trace_path.XXXXXX) HEALTH_PATH=$(mktemp -d -t tmp.test_health_trace_path.XXXXXX) -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - THREAD_COUNT=${#THREAD[@]} i=0 while [ "$i" -lt "$THREAD_COUNT" ]; do diff --git a/tests/regression/tools/health/test_thread_ok b/tests/regression/tools/health/test_thread_ok index 663b7e4cb..475a319c7 100755 --- a/tests/regression/tools/health/test_thread_ok +++ b/tests/regression/tools/health/test_thread_ok @@ -67,7 +67,7 @@ function test_thread_ok $CURDIR/$HEALTH_CHECK_BIN > ${STDOUT_PATH} 2> ${STDERR_PATH} report_errors - skip $isroot "Root access is needed. Skipping kernel consumer health check test." "5" || + check_skip_kernel_test "5" || { diag "With kernel consumer daemon" create_lttng_session_no_output $SESSION_NAME @@ -115,13 +115,6 @@ STDERR_PATH=$(mktemp -t tmp.test_thread_ok_stderr_path.XXXXXX) TRACE_PATH=$(mktemp -d -t tmp.test_thread_ok_trace_path.XXXXXX) HEALTH_PATH=$(mktemp -d -t tmp.test_thread_ok_trace_path.XXXXXX) -# The manage kernel thread is only spawned if we are root -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -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 1be703aac..df30fcf56 100755 --- a/tests/regression/tools/live/test_kernel +++ b/tests/regression/tools/live/test_kernel @@ -39,13 +39,11 @@ function clean_live_tracing() rm -rf $TRACE_PATH } -# Need root access for kernel tracing. -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - plan_skip_all "Root access is needed. Skipping all tests." +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." exit 0 -fi +} modprobe lttng-test diff --git a/tests/regression/tools/live/test_lttng_kernel b/tests/regression/tools/live/test_lttng_kernel index ae8c57e6b..91f526ceb 100755 --- a/tests/regression/tools/live/test_lttng_kernel +++ b/tests/regression/tools/live/test_lttng_kernel @@ -45,13 +45,7 @@ function clean_live_tracing() } # Need root access for kernel tracing. -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { modprobe lttng-test diff --git a/tests/regression/tools/metadata/test_kernel b/tests/regression/tools/metadata/test_kernel index 9e1e81232..01053541d 100755 --- a/tests/regression/tools/metadata/test_kernel +++ b/tests/regression/tools/metadata/test_kernel @@ -98,13 +98,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel metadata tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present modprobe lttng-test diff --git a/tests/regression/tools/notification/test_notification_kernel_buffer_usage b/tests/regression/tools/notification/test_notification_kernel_buffer_usage index 5a87583dc..fe92c7337 100755 --- a/tests/regression/tools/notification/test_notification_kernel_buffer_usage +++ b/tests/regression/tools/notification/test_notification_kernel_buffer_usage @@ -63,29 +63,27 @@ function test_buffer_usage_notification wait $APP_PID 2> /dev/null } -if [ "$(id -u)" == "0" ]; then - - validate_lttng_modules_present - +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + rm -rf "$TEST_TMPDIR" + exit 0 +} - modprobe lttng-test +validate_lttng_modules_present - # 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 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 88a3691eb..b65310d88 100755 --- a/tests/regression/tools/notification/test_notification_kernel_capture +++ b/tests/regression/tools/notification/test_notification_kernel_capture @@ -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" diff --git a/tests/regression/tools/notification/test_notification_kernel_error b/tests/regression/tools/notification/test_notification_kernel_error index 891146747..dac70ad27 100755 --- a/tests/regression/tools/notification/test_notification_kernel_error +++ b/tests/regression/tools/notification/test_notification_kernel_error @@ -30,23 +30,22 @@ function test_basic_error_path wait $APP_PID 2> /dev/null } +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + exit 0 +} -if [ "$(id -u)" == "0" ]; then - validate_lttng_modules_present +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 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 b8f0c7eb8..599cc9aa3 100755 --- a/tests/regression/tools/notification/test_notification_kernel_instrumentation +++ b/tests/regression/tools/notification/test_notification_kernel_instrumentation @@ -28,22 +28,21 @@ function test_kernel_instrumentation_notification wait $APP_PID 2> /dev/null } -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_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 rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_kernel_syscall b/tests/regression/tools/notification/test_notification_kernel_syscall index ba12716fd..c9a40d077 100755 --- a/tests/regression/tools/notification/test_notification_kernel_syscall +++ b/tests/regression/tools/notification/test_notification_kernel_syscall @@ -31,19 +31,18 @@ function test_kernel_syscall_notification wait $APP_PID 2> /dev/null } -if [ "$(id -u)" == "0" ]; then - validate_lttng_modules_present +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + exit 0 +} - start_lttng_sessiond_notap +validate_lttng_modules_present - test_kernel_syscall_notification +start_lttng_sessiond_notap - stop_lttng_sessiond_notap +test_kernel_syscall_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 rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_kernel_userspace_probe b/tests/regression/tools/notification/test_notification_kernel_userspace_probe index 065e66add..38f5a5f41 100755 --- a/tests/regression/tools/notification/test_notification_kernel_userspace_probe +++ b/tests/regression/tools/notification/test_notification_kernel_userspace_probe @@ -29,18 +29,18 @@ function test_kernel_userspace_probe_notification wait $APP_PID 2> /dev/null } -if [ "$(id -u)" == "0" ]; then - validate_lttng_modules_present +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + exit 0 +} + +validate_lttng_modules_present - start_lttng_sessiond_notap +start_lttng_sessiond_notap - test_kernel_userspace_probe_notification +test_kernel_userspace_probe_notification - stop_lttng_sessiond_notap -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 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 85d863804..8f7dfd842 100755 --- a/tests/regression/tools/notification/test_notification_multi_app +++ b/tests/regression/tools/notification/test_notification_multi_app @@ -411,32 +411,31 @@ function test_on_register_evaluation () rm -rf "$output_dir" } +check_skip_kernel_test "$NUM_TESTS" || { + + TESTS=( + test_multi_app_ust + test_on_register_evaluation_ust + ) -TESTS=( - test_multi_app_ust - test_on_register_evaluation_ust -) -if [ "$(id -u)" == "0" ]; then validate_lttng_modules_present TESTS+=( - test_multi_app_kernel - test_on_register_evaluation_kernel -) -else - skip 0 "Root access is needed. Skipping all kernel multi-app notification tests." $NUM_TEST_KERNEL -fi + test_multi_app_kernel + test_on_register_evaluation_kernel + ) -for fct_test in ${TESTS[@]}; -do - TRACE_PATH=$(mktemp -d -t tmp.test_notification_multi_app_trace_path.XXXXXX) + for fct_test in ${TESTS[@]}; + do + TRACE_PATH=$(mktemp -d -t 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 1eb960d02..73dfa831f 100755 --- a/tests/regression/tools/notification/test_notification_notifier_discarded_count +++ b/tests/regression/tools/notification/test_notification_notifier_discarded_count @@ -394,7 +394,8 @@ function test_ust_notifier_discarded_regardless_trigger_owner test_ust_notifier_discarded_count test_ust_notifier_discarded_count_max_bucket -if [ "$(id -u)" == "0" ]; then +check_skip_kernel_test "$KERNEL_NUM_TESTS" || +{ validate_lttng_modules_present @@ -416,9 +417,7 @@ if [ "$(id -u)" == "0" ]; then modprobe --remove lttng-test rm -rf "${sessiond_pipe[@]}" 2> /dev/null -else - # Kernel tests are skipped. - skip 0 "Root access is needed. Skipping all kernel notification tests." $KERNEL_NUM_TESTS -fi + +} rm -rf "$TEST_TMPDIR" diff --git a/tests/regression/tools/regen-metadata/test_kernel b/tests/regression/tools/regen-metadata/test_kernel index 7c4191a47..eb37783d2 100755 --- a/tests/regression/tools/regen-metadata/test_kernel +++ b/tests/regression/tools/regen-metadata/test_kernel @@ -99,13 +99,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$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 cb0c0ad5e..d33bdf478 100755 --- a/tests/regression/tools/regen-statedump/test_kernel +++ b/tests/regression/tools/regen-statedump/test_kernel @@ -39,13 +39,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/tools/rotation/test_kernel b/tests/regression/tools/rotation/test_kernel index 817019036..92903c3cc 100755 --- a/tests/regression/tools/rotation/test_kernel +++ b/tests/regression/tools/rotation/test_kernel @@ -107,13 +107,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/rotation/test_ust_kernel b/tests/regression/tools/rotation/test_ust_kernel index 2f19e807a..c6d9373e7 100755 --- a/tests/regression/tools/rotation/test_ust_kernel +++ b/tests/regression/tools/rotation/test_ust_kernel @@ -85,13 +85,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel index 870c437b2..f30ead382 100755 --- a/tests/regression/tools/snapshots/test_kernel +++ b/tests/regression/tools/snapshots/test_kernel @@ -221,14 +221,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace - -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel snapshot tests" $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/snapshots/test_kernel_streaming b/tests/regression/tools/snapshots/test_kernel_streaming index 2abd838e7..5a1eb3a42 100755 --- a/tests/regression/tools/snapshots/test_kernel_streaming +++ b/tests/regression/tools/snapshots/test_kernel_streaming @@ -145,13 +145,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests" $NUM_TESTS || +check_skip_kernel_test $NUM_TESTS || { validate_lttng_modules_present diff --git a/tests/regression/tools/snapshots/test_ust_streaming b/tests/regression/tools/snapshots/test_ust_streaming index 3104afb3b..1278605dc 100755 --- a/tests/regression/tools/snapshots/test_ust_streaming +++ b/tests/regression/tools/snapshots/test_ust_streaming @@ -234,12 +234,6 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - start_lttng_relayd "-o $TRACE_PATH" start_lttng_sessiond diff --git a/tests/regression/tools/streaming/test_high_throughput_limits b/tests/regression/tools/streaming/test_high_throughput_limits index 50c21df4d..a7d4317b4 100755 --- a/tests/regression/tools/streaming/test_high_throughput_limits +++ b/tests/regression/tools/streaming/test_high_throughput_limits @@ -174,13 +174,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed to set bandwith limits. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { # Catch sigint and try to cleanup limits diff --git a/tests/regression/tools/streaming/test_kernel b/tests/regression/tools/streaming/test_kernel index aef1e11bc..2beb4b015 100755 --- a/tests/regression/tools/streaming/test_kernel +++ b/tests/regression/tools/streaming/test_kernel @@ -47,13 +47,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/tracker/test_event_tracker b/tests/regression/tools/tracker/test_event_tracker index 98ca990fc..3840b4676 100755 --- a/tests/regression/tools/tracker/test_event_tracker +++ b/tests/regression/tools/tracker/test_event_tracker @@ -468,13 +468,7 @@ test_event_track_untrack ust 0 "${EVENT_NAME}" "--pid --all" # backward compat test_event_tracker ust 1 "${EVENT_NAME}" "--pid --all" # backward compat test_event_pid_tracker ust 1 "${EVENT_NAME}" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel tracker tests." $NUM_KERNEL_TESTS || +check_skip_kernel_test "$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 9ba8c22f0..0dc4c6b2f 100755 --- a/tests/regression/tools/trigger/test_add_trigger_cli +++ b/tests/regression/tools/trigger/test_add_trigger_cli @@ -34,12 +34,6 @@ tmp_stdout=$(mktemp -t test_parse_cli_trigger_stdout.XXXXXX) tmp_stderr=$(mktemp -t test_parse_cli_trigger_stderr.XXXXXX) uprobe_elf_binary="${TESTDIR}/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary" -if [ "$(id -u)" == "0" ]; then - ist_root=1 -else - ist_root=0 -fi - function test_success () { local test_name="$1" @@ -223,7 +217,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_root "non-root user: skipping kprobe tests" 18 || { +check_skip_kernel_test 18 || { i=0 for type in kprobe kernel:kprobe; do @@ -262,7 +256,7 @@ skip $ist_root "non-root user: skipping kprobe tests" 18 || { done } -skip $ist_root "non-root user: skipping uprobe tests" 6 || { +check_skip_kernel_test 6 || { test_success "--condition event-rule-matches uprobe" "uprobe-trigger-0" \ --name="uprobe-trigger-0" \ --condition event-rule-matches --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe \ @@ -274,7 +268,7 @@ skip $ist_root "non-root user: skipping uprobe tests" 6 || { --action notify } -skip $ist_root "non-root user: skipping syscall tests" 30 || { +check_skip_kernel_test 30 || { test_success "--condition event-rule-matches one syscall" "syscall-trigger-0" \ --name="syscall-trigger-0" \ --condition event-rule-matches --type=syscall --name=open \ diff --git a/tests/regression/tools/trigger/test_list_triggers_cli b/tests/regression/tools/trigger/test_list_triggers_cli index 6194b8891..57ce440b0 100755 --- a/tests/regression/tools/trigger/test_list_triggers_cli +++ b/tests/regression/tools/trigger/test_list_triggers_cli @@ -38,20 +38,13 @@ register_some_triggers_bin=$(realpath "${CURDIR}/utils/register-some-triggers") uid=$(id --user) gid=$(id --group) -if [ "$uid" == "0" ]; then - ist_root=1 - ls "$uprobe_sdt_binary" >/dev/null 2>&1 - if test $? == 0; then - hast_sdt_binary=1 - else - hast_sdt_binary=0 - fi +ls "$uprobe_sdt_binary" >/dev/null 2>&1 +if test $? == 0; then + hast_sdt_binary=1 else - ist_root=0 hast_sdt_binary=0 fi - test_top_level_options () { diag "Listing top level options" @@ -2695,10 +2688,10 @@ start_lttng_sessiond_notap test_top_level_options test_event_rule_matches_tracepoint -skip $ist_root "non-root user: skipping kprobe tests" 13 || test_event_rule_matches_probe -skip $ist_root "non-root user: skipping uprobe tests" 9 || test_event_rule_matches_userspace_probe_elf -skip $(($ist_root && $hast_sdt_binary)) "skipping userspace probe SDT tests" 9 || test_event_rule_matches_userspace_probe_sdt -skip $ist_root "non-root user: skipping syscall tests" 17 || test_event_rule_matches_syscall +check_skip_kernel_test 13 || test_event_rule_matches_probe +check_skip_kernel_test 9 || test_event_rule_matches_userspace_probe_elf +check_skip_kernel_test 9 || skip $hast_sdt_binary "skipping userspace probe SDT tests" 9 || test_event_rule_matches_userspace_probe_sdt +check_skip_kernel_test 17 || test_event_rule_matches_syscall test_session_consumed_size_condition test_buffer_usage_conditions test_session_rotation_conditions diff --git a/tests/regression/tools/wildcard/test_event_wildcard b/tests/regression/tools/wildcard/test_event_wildcard index 36e669b32..1bc61991d 100755 --- a/tests/regression/tools/wildcard/test_event_wildcard +++ b/tests/regression/tools/wildcard/test_event_wildcard @@ -126,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" || { diag "Test kernel wildcards" diff --git a/tests/regression/tools/working-directory/test_relayd_working_directory b/tests/regression/tools/working-directory/test_relayd_working_directory index c196a059e..db44120e7 100755 --- a/tests/regression/tools/working-directory/test_relayd_working_directory +++ b/tests/regression/tools/working-directory/test_relayd_working_directory @@ -145,9 +145,9 @@ function test_relayd_debug_permission() diag "Test lttng-relayd change working directory on non writable directory" if [ "$(id -u)" == "0" ]; then - is_user=0 + is_user=0 else - is_user=1 + is_user=1 fi skip $is_user "Skipping permission debug output test; operation can't fail as root" 6 || diff --git a/tests/regression/ust/namespaces/test_ns_contexts_change b/tests/regression/ust/namespaces/test_ns_contexts_change index fd1621630..e2c30659a 100755 --- a/tests/regression/ust/namespaces/test_ns_contexts_change +++ b/tests/regression/ust/namespaces/test_ns_contexts_change @@ -103,12 +103,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -isroot=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 +check_skip_kernel_test "$NUM_TESTS" && exit 0 system_has_ns=0 if [ -d "/proc/$$/ns" ]; then diff --git a/tests/regression/ust/test_event_perf b/tests/regression/ust/test_event_perf index 9b2de4de2..551ea407c 100755 --- a/tests/regression/ust/test_event_perf +++ b/tests/regression/ust/test_event_perf @@ -121,17 +121,11 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - start_lttng_sessiond test_parsing_raw -skip $isroot "Root access is needed. Skipping UST perf tests." 8 || +check_skip_kernel_test 8 || { test_event_basic } diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 44b3f167a..758db8bdd 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -323,6 +323,39 @@ function conf_proc_count() echo } +# Usage: +# check_skip_kernel_test [NB_TESTS] +# Return 0 if disable kernel test was set or current user is not a root user +# If NB_TESTS passes to function, it would call the skip() to skip number of tests. +# If NB_TESTS is empty, function just output a reason + +function check_skip_kernel_test () +{ + local num_tests="$1" + + # Check for skip test kernel flag + if [ "$LTTNG_TOOLS_DISABLE_KERNEL_TESTS" == "1" ]; then + if ! test -z "$num_tests"; then + skip 0 "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set. Skipping all tests." "$num_tests" + else + diag "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set" + fi + return 0 + fi + + # Check if we are running as root + if [ "$(id -u)" != "0" ]; then + if ! test -z "$num_tests"; then + skip 0 "Root access is needed for kernel testing, skipping." "$num_tests" + else + diag "Root access is needed for kernel testing" + fi + return 0 + fi + + return 1 +} + # Check if base lttng-modules are present. # Bail out on failure function validate_lttng_modules_present () -- 2.25.1 _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
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 on an embedded device (e.g. userspace), so in this scenario, the kernel modules might not install to target rootfs, the test cases would be fail and exit. Add LTTNG_TOOLS_DISABLE_KERNEL_TESTS to skip the lttng kernel features test, this flag can be set via "make": make check LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1 When this flag was set, all kernel related testcases would be marked as SKIP in result. Since the the LTTNG_TOOLS_DISABLE_KERNEL_TESTS was checked in function check_skip_kernel_test, lots of testcases also need to check root permission, so merging the root permission checking into check_skip_kernel_test. Change-Id: I0ced8d6bd3c0e496f0ac71b8b84f64e04ea60730 Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com> --- tests/destructive/metadata-regeneration | 8 +--- tests/perf/test_perf_raw.in | 8 +--- tests/regression/kernel/test_all_events | 8 +--- tests/regression/kernel/test_callstack | 8 +--- tests/regression/kernel/test_channel | 8 +--- tests/regression/kernel/test_clock_override | 8 +--- tests/regression/kernel/test_event_basic | 8 +--- tests/regression/kernel/test_kernel_function | 8 +--- tests/regression/kernel/test_lttng_logger | 7 +--- tests/regression/kernel/test_ns_contexts | 8 +--- .../regression/kernel/test_ns_contexts_change | 9 +--- .../kernel/test_rotation_destroy_flush | 8 +--- .../regression/kernel/test_select_poll_epoll | 8 +--- tests/regression/kernel/test_syscall | 8 +--- tests/regression/kernel/test_userspace_probe | 8 +--- tests/regression/tools/clear/test_kernel | 8 +--- .../tools/filtering/test_invalid_filter | 8 +--- .../tools/filtering/test_unsupported_op | 8 +--- .../tools/filtering/test_valid_filter | 8 +--- tests/regression/tools/health/test_health.sh | 10 +---- tests/regression/tools/health/test_thread_ok | 9 +--- tests/regression/tools/live/test_kernel | 10 ++--- tests/regression/tools/live/test_lttng_kernel | 8 +--- tests/regression/tools/metadata/test_kernel | 8 +--- .../test_notification_kernel_buffer_usage | 36 ++++++++-------- .../test_notification_kernel_capture | 23 +++++------ .../test_notification_kernel_error | 23 +++++------ .../test_notification_kernel_instrumentation | 23 +++++------ .../test_notification_kernel_syscall | 19 ++++----- .../test_notification_kernel_userspace_probe | 20 ++++----- .../notification/test_notification_multi_app | 41 +++++++++---------- ...test_notification_notifier_discarded_count | 9 ++-- .../tools/regen-metadata/test_kernel | 8 +--- .../tools/regen-statedump/test_kernel | 8 +--- tests/regression/tools/rotation/test_kernel | 8 +--- .../regression/tools/rotation/test_ust_kernel | 8 +--- tests/regression/tools/snapshots/test_kernel | 9 +--- .../tools/snapshots/test_kernel_streaming | 8 +--- .../tools/snapshots/test_ust_streaming | 6 --- .../streaming/test_high_throughput_limits | 8 +--- tests/regression/tools/streaming/test_kernel | 8 +--- .../tools/tracker/test_event_tracker | 8 +--- .../tools/trigger/test_add_trigger_cli | 12 ++---- .../tools/trigger/test_list_triggers_cli | 21 ++++------ .../tools/wildcard/test_event_wildcard | 8 +--- .../test_relayd_working_directory | 4 +- .../ust/namespaces/test_ns_contexts_change | 7 +--- tests/regression/ust/test_event_perf | 8 +--- tests/utils/utils.sh | 33 +++++++++++++++ 49 files changed, 178 insertions(+), 385 deletions(-) diff --git a/tests/destructive/metadata-regeneration b/tests/destructive/metadata-regeneration index 048c601b6..457f0b9dd 100755 --- a/tests/destructive/metadata-regeneration +++ b/tests/destructive/metadata-regeneration @@ -189,12 +189,6 @@ function test_ust_streaming () rm -f "${file_sync_before_last}" } -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - if ! destructive_tests_enabled ; then echo 'Please make sure that ntp is not running while executing this test' skip 0 "You need to set the LTTNG_ENABLE_DESTRUCTIVE_TESTS environment variable to \"will-break-my-system\" to run this test" $NUM_TESTS @@ -202,7 +196,7 @@ if ! destructive_tests_enabled ; then exit 0 fi -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test $NUM_TESTS || { original_date=$(date) start_lttng_relayd "-o $TRACE_PATH" diff --git a/tests/perf/test_perf_raw.in b/tests/perf/test_perf_raw.in index 0a451ce63..00cdebc55 100644 --- a/tests/perf/test_perf_raw.in +++ b/tests/perf/test_perf_raw.in @@ -137,12 +137,6 @@ function test_kernel_raw() rm -rf $TRACE_PATH } -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - # MUST set TESTDIR before calling those functions plan_tests $NUM_TESTS @@ -154,7 +148,7 @@ have_libpfm test_ust_raw -skip $isroot "Root access is needed for kernel testing, skipping." 9 || +check_skip_kernel_test 9 || { modprobe lttng-test test_kernel_raw diff --git a/tests/regression/kernel/test_all_events b/tests/regression/kernel/test_all_events index 2fb2f611d..636469dea 100755 --- a/tests/regression/kernel/test_all_events +++ b/tests/regression/kernel/test_all_events @@ -43,13 +43,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_callstack b/tests/regression/kernel/test_callstack index cf39089af..1467e7942 100755 --- a/tests/regression/kernel/test_callstack +++ b/tests/regression/kernel/test_callstack @@ -136,13 +136,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_channel b/tests/regression/kernel/test_channel index 5525564d2..f399f5038 100755 --- a/tests/regression/kernel/test_channel +++ b/tests/regression/kernel/test_channel @@ -47,13 +47,7 @@ function test_channel_buffer_too_large() plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { start_lttng_sessiond diff --git a/tests/regression/kernel/test_clock_override b/tests/regression/kernel/test_clock_override index 524c3c3bb..53c75d3a5 100755 --- a/tests/regression/kernel/test_clock_override +++ b/tests/regression/kernel/test_clock_override @@ -174,13 +174,7 @@ TESTS=( TEST_COUNT=${#TESTS[@]} i=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present trap signal_cleanup SIGTERM SIGINT diff --git a/tests/regression/kernel/test_event_basic b/tests/regression/kernel/test_event_basic index 9f22d7db8..20215a11f 100755 --- a/tests/regression/kernel/test_event_basic +++ b/tests/regression/kernel/test_event_basic @@ -73,13 +73,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test $NUM_TESTS || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_kernel_function b/tests/regression/kernel/test_kernel_function index 131c1c70b..bfdf0091a 100755 --- a/tests/regression/kernel/test_kernel_function +++ b/tests/regression/kernel/test_kernel_function @@ -43,13 +43,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { start_lttng_sessiond_notap validate_lttng_modules_present diff --git a/tests/regression/kernel/test_lttng_logger b/tests/regression/kernel/test_lttng_logger index 849428807..d1b9567ee 100755 --- a/tests/regression/kernel/test_lttng_logger +++ b/tests/regression/kernel/test_lttng_logger @@ -110,13 +110,8 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_ns_contexts b/tests/regression/kernel/test_ns_contexts index 98b673c98..9ada1655a 100755 --- a/tests/regression/kernel/test_ns_contexts +++ b/tests/regression/kernel/test_ns_contexts @@ -108,13 +108,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -isroot=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 - +check_skip_kernel_test "$NUM_TESTS" && exit 0 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 715c67cc8..d2826ba88 100755 --- a/tests/regression/kernel/test_ns_contexts_change +++ b/tests/regression/kernel/test_ns_contexts_change @@ -162,14 +162,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" - -isroot=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 - +check_skip_kernel_test "$NUM_TESTS" && exit 0 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 6e568afda..b2df95811 100755 --- a/tests/regression/kernel/test_rotation_destroy_flush +++ b/tests/regression/kernel/test_rotation_destroy_flush @@ -120,13 +120,7 @@ TESTS=( TEST_COUNT=${#TESTS[@]} i=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present trap signal_cleanup SIGTERM SIGINT diff --git a/tests/regression/kernel/test_select_poll_epoll b/tests/regression/kernel/test_select_poll_epoll index cdde1ea4f..1f457be21 100755 --- a/tests/regression/kernel/test_select_poll_epoll +++ b/tests/regression/kernel/test_select_poll_epoll @@ -363,15 +363,9 @@ if test $? != 0; then exit 0 fi -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - diag "Supported syscalls are $SUPPORTED_SYSCALLS_LIST" -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/kernel/test_syscall b/tests/regression/kernel/test_syscall index f9b490858..20130dde9 100755 --- a/tests/regression/kernel/test_syscall +++ b/tests/regression/kernel/test_syscall @@ -664,13 +664,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/kernel/test_userspace_probe b/tests/regression/kernel/test_userspace_probe index bfa260e47..8e9002e2b 100755 --- a/tests/regression/kernel/test_userspace_probe +++ b/tests/regression/kernel/test_userspace_probe @@ -815,13 +815,7 @@ fi plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/tools/clear/test_kernel b/tests/regression/tools/clear/test_kernel index ce76f85d2..5f86ae386 100755 --- a/tests/regression/tools/clear/test_kernel +++ b/tests/regression/tools/clear/test_kernel @@ -538,12 +538,6 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - streaming_tests=(test_kernel_streaming test_kernel_streaming_rotate_clear test_kernel_streaming_clear_rotate @@ -565,7 +559,7 @@ snapshot_tests=(test_kernel_streaming_snapshot test_kernel_local_snapshot ) -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { trap signal_cleanup SIGTERM SIGINT diff --git a/tests/regression/tools/filtering/test_invalid_filter b/tests/regression/tools/filtering/test_invalid_filter index 8dfbe9eb5..839d6aff8 100755 --- a/tests/regression/tools/filtering/test_invalid_filter +++ b/tests/regression/tools/filtering/test_invalid_filter @@ -170,13 +170,7 @@ done test_bytecode_limit -u -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel invalid filter tests." $NUM_KERNEL_TESTS || +check_skip_kernel_test "$NUM_KERNEL_TESTS" || { diag "Test kernel filters" i=0 diff --git a/tests/regression/tools/filtering/test_unsupported_op b/tests/regression/tools/filtering/test_unsupported_op index dc76f99a6..e8101bdda 100755 --- a/tests/regression/tools/filtering/test_unsupported_op +++ b/tests/regression/tools/filtering/test_unsupported_op @@ -103,13 +103,7 @@ while [ "$i" -lt "$OP_COUNT" ]; do let "i++" done -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel unsupported filter operations tests." $NUM_KERNEL_TESTS || +check_skip_kernel_test $NUM_KERNEL_TESTS || { diag "Test kernel unsupported filter operations" diff --git a/tests/regression/tools/filtering/test_valid_filter b/tests/regression/tools/filtering/test_valid_filter index cd5b1a3b9..f8d3abc0b 100755 --- a/tests/regression/tools/filtering/test_valid_filter +++ b/tests/regression/tools/filtering/test_valid_filter @@ -1454,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" || { diag "Test kernel valid filters" diff --git a/tests/regression/tools/health/test_health.sh b/tests/regression/tools/health/test_health.sh index b4b416f92..85810d8e9 100644 --- a/tests/regression/tools/health/test_health.sh +++ b/tests/regression/tools/health/test_health.sh @@ -82,7 +82,7 @@ function test_health diag "With UST consumer daemons" enable_ust_lttng_event_ok $SESSION_NAME $UST_EVENT_NAME $CHANNEL_NAME - skip $isroot "Root access is needed. Skipping kernel consumer health check test." "1" || + check_skip_kernel_test "1" || { diag "With kernel consumer daemon" lttng_enable_kernel_event $SESSION_NAME $KERNEL_EVENT_NAME $CHANNEL_NAME @@ -113,7 +113,7 @@ function test_health if [ ${test_needs_root} -eq 1 ]; then - skip ${isroot} "Root access needed for test \"${test_thread_name}\"." "1" || + check_skip_kernel_test "1" || { report_errors "${test_thread_error_string}" "${test_relayd}" } @@ -271,12 +271,6 @@ STDERR_PATH=$(mktemp -t tmp.test_health_stderr_path.XXXXXX) TRACE_PATH=$(mktemp -d -t tmp.test_health_trace_path.XXXXXX) HEALTH_PATH=$(mktemp -d -t tmp.test_health_trace_path.XXXXXX) -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - THREAD_COUNT=${#THREAD[@]} i=0 while [ "$i" -lt "$THREAD_COUNT" ]; do diff --git a/tests/regression/tools/health/test_thread_ok b/tests/regression/tools/health/test_thread_ok index 663b7e4cb..475a319c7 100755 --- a/tests/regression/tools/health/test_thread_ok +++ b/tests/regression/tools/health/test_thread_ok @@ -67,7 +67,7 @@ function test_thread_ok $CURDIR/$HEALTH_CHECK_BIN > ${STDOUT_PATH} 2> ${STDERR_PATH} report_errors - skip $isroot "Root access is needed. Skipping kernel consumer health check test." "5" || + check_skip_kernel_test "5" || { diag "With kernel consumer daemon" create_lttng_session_no_output $SESSION_NAME @@ -115,13 +115,6 @@ STDERR_PATH=$(mktemp -t tmp.test_thread_ok_stderr_path.XXXXXX) TRACE_PATH=$(mktemp -d -t tmp.test_thread_ok_trace_path.XXXXXX) HEALTH_PATH=$(mktemp -d -t tmp.test_thread_ok_trace_path.XXXXXX) -# The manage kernel thread is only spawned if we are root -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -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 1be703aac..df30fcf56 100755 --- a/tests/regression/tools/live/test_kernel +++ b/tests/regression/tools/live/test_kernel @@ -39,13 +39,11 @@ function clean_live_tracing() rm -rf $TRACE_PATH } -# Need root access for kernel tracing. -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - plan_skip_all "Root access is needed. Skipping all tests." +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." exit 0 -fi +} modprobe lttng-test diff --git a/tests/regression/tools/live/test_lttng_kernel b/tests/regression/tools/live/test_lttng_kernel index ae8c57e6b..91f526ceb 100755 --- a/tests/regression/tools/live/test_lttng_kernel +++ b/tests/regression/tools/live/test_lttng_kernel @@ -45,13 +45,7 @@ function clean_live_tracing() } # Need root access for kernel tracing. -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { modprobe lttng-test diff --git a/tests/regression/tools/metadata/test_kernel b/tests/regression/tools/metadata/test_kernel index 9e1e81232..01053541d 100755 --- a/tests/regression/tools/metadata/test_kernel +++ b/tests/regression/tools/metadata/test_kernel @@ -98,13 +98,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel metadata tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present modprobe lttng-test diff --git a/tests/regression/tools/notification/test_notification_kernel_buffer_usage b/tests/regression/tools/notification/test_notification_kernel_buffer_usage index 5a87583dc..fe92c7337 100755 --- a/tests/regression/tools/notification/test_notification_kernel_buffer_usage +++ b/tests/regression/tools/notification/test_notification_kernel_buffer_usage @@ -63,29 +63,27 @@ function test_buffer_usage_notification wait $APP_PID 2> /dev/null } -if [ "$(id -u)" == "0" ]; then - - validate_lttng_modules_present - +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + rm -rf "$TEST_TMPDIR" + exit 0 +} - modprobe lttng-test +validate_lttng_modules_present - # 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 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 88a3691eb..b65310d88 100755 --- a/tests/regression/tools/notification/test_notification_kernel_capture +++ b/tests/regression/tools/notification/test_notification_kernel_capture @@ -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" diff --git a/tests/regression/tools/notification/test_notification_kernel_error b/tests/regression/tools/notification/test_notification_kernel_error index 891146747..dac70ad27 100755 --- a/tests/regression/tools/notification/test_notification_kernel_error +++ b/tests/regression/tools/notification/test_notification_kernel_error @@ -30,23 +30,22 @@ function test_basic_error_path wait $APP_PID 2> /dev/null } +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + exit 0 +} -if [ "$(id -u)" == "0" ]; then - validate_lttng_modules_present +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 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 b8f0c7eb8..599cc9aa3 100755 --- a/tests/regression/tools/notification/test_notification_kernel_instrumentation +++ b/tests/regression/tools/notification/test_notification_kernel_instrumentation @@ -28,22 +28,21 @@ function test_kernel_instrumentation_notification wait $APP_PID 2> /dev/null } -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_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 rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_kernel_syscall b/tests/regression/tools/notification/test_notification_kernel_syscall index ba12716fd..c9a40d077 100755 --- a/tests/regression/tools/notification/test_notification_kernel_syscall +++ b/tests/regression/tools/notification/test_notification_kernel_syscall @@ -31,19 +31,18 @@ function test_kernel_syscall_notification wait $APP_PID 2> /dev/null } -if [ "$(id -u)" == "0" ]; then - validate_lttng_modules_present +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + exit 0 +} - start_lttng_sessiond_notap +validate_lttng_modules_present - test_kernel_syscall_notification +start_lttng_sessiond_notap - stop_lttng_sessiond_notap +test_kernel_syscall_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 rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_kernel_userspace_probe b/tests/regression/tools/notification/test_notification_kernel_userspace_probe index 065e66add..38f5a5f41 100755 --- a/tests/regression/tools/notification/test_notification_kernel_userspace_probe +++ b/tests/regression/tools/notification/test_notification_kernel_userspace_probe @@ -29,18 +29,18 @@ function test_kernel_userspace_probe_notification wait $APP_PID 2> /dev/null } -if [ "$(id -u)" == "0" ]; then - validate_lttng_modules_present +check_skip_kernel_test && +{ + plan_skip_all "Skipping all tests." + exit 0 +} + +validate_lttng_modules_present - start_lttng_sessiond_notap +start_lttng_sessiond_notap - test_kernel_userspace_probe_notification +test_kernel_userspace_probe_notification - stop_lttng_sessiond_notap -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 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 85d863804..8f7dfd842 100755 --- a/tests/regression/tools/notification/test_notification_multi_app +++ b/tests/regression/tools/notification/test_notification_multi_app @@ -411,32 +411,31 @@ function test_on_register_evaluation () rm -rf "$output_dir" } +check_skip_kernel_test "$NUM_TESTS" || { + + TESTS=( + test_multi_app_ust + test_on_register_evaluation_ust + ) -TESTS=( - test_multi_app_ust - test_on_register_evaluation_ust -) -if [ "$(id -u)" == "0" ]; then validate_lttng_modules_present TESTS+=( - test_multi_app_kernel - test_on_register_evaluation_kernel -) -else - skip 0 "Root access is needed. Skipping all kernel multi-app notification tests." $NUM_TEST_KERNEL -fi + test_multi_app_kernel + test_on_register_evaluation_kernel + ) -for fct_test in ${TESTS[@]}; -do - TRACE_PATH=$(mktemp -d -t tmp.test_notification_multi_app_trace_path.XXXXXX) + for fct_test in ${TESTS[@]}; + do + TRACE_PATH=$(mktemp -d -t 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 1eb960d02..73dfa831f 100755 --- a/tests/regression/tools/notification/test_notification_notifier_discarded_count +++ b/tests/regression/tools/notification/test_notification_notifier_discarded_count @@ -394,7 +394,8 @@ function test_ust_notifier_discarded_regardless_trigger_owner test_ust_notifier_discarded_count test_ust_notifier_discarded_count_max_bucket -if [ "$(id -u)" == "0" ]; then +check_skip_kernel_test "$KERNEL_NUM_TESTS" || +{ validate_lttng_modules_present @@ -416,9 +417,7 @@ if [ "$(id -u)" == "0" ]; then modprobe --remove lttng-test rm -rf "${sessiond_pipe[@]}" 2> /dev/null -else - # Kernel tests are skipped. - skip 0 "Root access is needed. Skipping all kernel notification tests." $KERNEL_NUM_TESTS -fi + +} rm -rf "$TEST_TMPDIR" diff --git a/tests/regression/tools/regen-metadata/test_kernel b/tests/regression/tools/regen-metadata/test_kernel index 7c4191a47..eb37783d2 100755 --- a/tests/regression/tools/regen-metadata/test_kernel +++ b/tests/regression/tools/regen-metadata/test_kernel @@ -99,13 +99,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$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 cb0c0ad5e..d33bdf478 100755 --- a/tests/regression/tools/regen-statedump/test_kernel +++ b/tests/regression/tools/regen-statedump/test_kernel @@ -39,13 +39,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present start_lttng_sessiond diff --git a/tests/regression/tools/rotation/test_kernel b/tests/regression/tools/rotation/test_kernel index 817019036..92903c3cc 100755 --- a/tests/regression/tools/rotation/test_kernel +++ b/tests/regression/tools/rotation/test_kernel @@ -107,13 +107,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/rotation/test_ust_kernel b/tests/regression/tools/rotation/test_ust_kernel index 2f19e807a..c6d9373e7 100755 --- a/tests/regression/tools/rotation/test_ust_kernel +++ b/tests/regression/tools/rotation/test_ust_kernel @@ -85,13 +85,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel index 870c437b2..f30ead382 100755 --- a/tests/regression/tools/snapshots/test_kernel +++ b/tests/regression/tools/snapshots/test_kernel @@ -221,14 +221,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace - -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel snapshot tests" $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/snapshots/test_kernel_streaming b/tests/regression/tools/snapshots/test_kernel_streaming index 2abd838e7..5a1eb3a42 100755 --- a/tests/regression/tools/snapshots/test_kernel_streaming +++ b/tests/regression/tools/snapshots/test_kernel_streaming @@ -145,13 +145,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests" $NUM_TESTS || +check_skip_kernel_test $NUM_TESTS || { validate_lttng_modules_present diff --git a/tests/regression/tools/snapshots/test_ust_streaming b/tests/regression/tools/snapshots/test_ust_streaming index 3104afb3b..1278605dc 100755 --- a/tests/regression/tools/snapshots/test_ust_streaming +++ b/tests/regression/tools/snapshots/test_ust_streaming @@ -234,12 +234,6 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - start_lttng_relayd "-o $TRACE_PATH" start_lttng_sessiond diff --git a/tests/regression/tools/streaming/test_high_throughput_limits b/tests/regression/tools/streaming/test_high_throughput_limits index 50c21df4d..a7d4317b4 100755 --- a/tests/regression/tools/streaming/test_high_throughput_limits +++ b/tests/regression/tools/streaming/test_high_throughput_limits @@ -174,13 +174,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed to set bandwith limits. Skipping all tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { # Catch sigint and try to cleanup limits diff --git a/tests/regression/tools/streaming/test_kernel b/tests/regression/tools/streaming/test_kernel index aef1e11bc..2beb4b015 100755 --- a/tests/regression/tools/streaming/test_kernel +++ b/tests/regression/tools/streaming/test_kernel @@ -47,13 +47,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || +check_skip_kernel_test "$NUM_TESTS" || { validate_lttng_modules_present diff --git a/tests/regression/tools/tracker/test_event_tracker b/tests/regression/tools/tracker/test_event_tracker index 98ca990fc..3840b4676 100755 --- a/tests/regression/tools/tracker/test_event_tracker +++ b/tests/regression/tools/tracker/test_event_tracker @@ -468,13 +468,7 @@ test_event_track_untrack ust 0 "${EVENT_NAME}" "--pid --all" # backward compat test_event_tracker ust 1 "${EVENT_NAME}" "--pid --all" # backward compat test_event_pid_tracker ust 1 "${EVENT_NAME}" -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - -skip $isroot "Root access is needed. Skipping all kernel tracker tests." $NUM_KERNEL_TESTS || +check_skip_kernel_test "$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 9ba8c22f0..0dc4c6b2f 100755 --- a/tests/regression/tools/trigger/test_add_trigger_cli +++ b/tests/regression/tools/trigger/test_add_trigger_cli @@ -34,12 +34,6 @@ tmp_stdout=$(mktemp -t test_parse_cli_trigger_stdout.XXXXXX) tmp_stderr=$(mktemp -t test_parse_cli_trigger_stderr.XXXXXX) uprobe_elf_binary="${TESTDIR}/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary" -if [ "$(id -u)" == "0" ]; then - ist_root=1 -else - ist_root=0 -fi - function test_success () { local test_name="$1" @@ -223,7 +217,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_root "non-root user: skipping kprobe tests" 18 || { +check_skip_kernel_test 18 || { i=0 for type in kprobe kernel:kprobe; do @@ -262,7 +256,7 @@ skip $ist_root "non-root user: skipping kprobe tests" 18 || { done } -skip $ist_root "non-root user: skipping uprobe tests" 6 || { +check_skip_kernel_test 6 || { test_success "--condition event-rule-matches uprobe" "uprobe-trigger-0" \ --name="uprobe-trigger-0" \ --condition event-rule-matches --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe \ @@ -274,7 +268,7 @@ skip $ist_root "non-root user: skipping uprobe tests" 6 || { --action notify } -skip $ist_root "non-root user: skipping syscall tests" 30 || { +check_skip_kernel_test 30 || { test_success "--condition event-rule-matches one syscall" "syscall-trigger-0" \ --name="syscall-trigger-0" \ --condition event-rule-matches --type=syscall --name=open \ diff --git a/tests/regression/tools/trigger/test_list_triggers_cli b/tests/regression/tools/trigger/test_list_triggers_cli index 6194b8891..57ce440b0 100755 --- a/tests/regression/tools/trigger/test_list_triggers_cli +++ b/tests/regression/tools/trigger/test_list_triggers_cli @@ -38,20 +38,13 @@ register_some_triggers_bin=$(realpath "${CURDIR}/utils/register-some-triggers") uid=$(id --user) gid=$(id --group) -if [ "$uid" == "0" ]; then - ist_root=1 - ls "$uprobe_sdt_binary" >/dev/null 2>&1 - if test $? == 0; then - hast_sdt_binary=1 - else - hast_sdt_binary=0 - fi +ls "$uprobe_sdt_binary" >/dev/null 2>&1 +if test $? == 0; then + hast_sdt_binary=1 else - ist_root=0 hast_sdt_binary=0 fi - test_top_level_options () { diag "Listing top level options" @@ -2695,10 +2688,10 @@ start_lttng_sessiond_notap test_top_level_options test_event_rule_matches_tracepoint -skip $ist_root "non-root user: skipping kprobe tests" 13 || test_event_rule_matches_probe -skip $ist_root "non-root user: skipping uprobe tests" 9 || test_event_rule_matches_userspace_probe_elf -skip $(($ist_root && $hast_sdt_binary)) "skipping userspace probe SDT tests" 9 || test_event_rule_matches_userspace_probe_sdt -skip $ist_root "non-root user: skipping syscall tests" 17 || test_event_rule_matches_syscall +check_skip_kernel_test 13 || test_event_rule_matches_probe +check_skip_kernel_test 9 || test_event_rule_matches_userspace_probe_elf +check_skip_kernel_test 9 || skip $hast_sdt_binary "skipping userspace probe SDT tests" 9 || test_event_rule_matches_userspace_probe_sdt +check_skip_kernel_test 17 || test_event_rule_matches_syscall test_session_consumed_size_condition test_buffer_usage_conditions test_session_rotation_conditions diff --git a/tests/regression/tools/wildcard/test_event_wildcard b/tests/regression/tools/wildcard/test_event_wildcard index 36e669b32..1bc61991d 100755 --- a/tests/regression/tools/wildcard/test_event_wildcard +++ b/tests/regression/tools/wildcard/test_event_wildcard @@ -126,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" || { diag "Test kernel wildcards" diff --git a/tests/regression/tools/working-directory/test_relayd_working_directory b/tests/regression/tools/working-directory/test_relayd_working_directory index c196a059e..db44120e7 100755 --- a/tests/regression/tools/working-directory/test_relayd_working_directory +++ b/tests/regression/tools/working-directory/test_relayd_working_directory @@ -145,9 +145,9 @@ function test_relayd_debug_permission() diag "Test lttng-relayd change working directory on non writable directory" if [ "$(id -u)" == "0" ]; then - is_user=0 + is_user=0 else - is_user=1 + is_user=1 fi skip $is_user "Skipping permission debug output test; operation can't fail as root" 6 || diff --git a/tests/regression/ust/namespaces/test_ns_contexts_change b/tests/regression/ust/namespaces/test_ns_contexts_change index fd1621630..e2c30659a 100755 --- a/tests/regression/ust/namespaces/test_ns_contexts_change +++ b/tests/regression/ust/namespaces/test_ns_contexts_change @@ -103,12 +103,7 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -isroot=0 -if [ "$(id -u)" == "0" ]; then - isroot=1 -fi - -skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0 +check_skip_kernel_test "$NUM_TESTS" && exit 0 system_has_ns=0 if [ -d "/proc/$$/ns" ]; then diff --git a/tests/regression/ust/test_event_perf b/tests/regression/ust/test_event_perf index 9b2de4de2..551ea407c 100755 --- a/tests/regression/ust/test_event_perf +++ b/tests/regression/ust/test_event_perf @@ -121,17 +121,11 @@ print_test_banner "$TEST_DESC" bail_out_if_no_babeltrace -if [ "$(id -u)" == "0" ]; then - isroot=1 -else - isroot=0 -fi - start_lttng_sessiond test_parsing_raw -skip $isroot "Root access is needed. Skipping UST perf tests." 8 || +check_skip_kernel_test 8 || { test_event_basic } diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 44b3f167a..758db8bdd 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -323,6 +323,39 @@ function conf_proc_count() echo } +# Usage: +# check_skip_kernel_test [NB_TESTS] +# Return 0 if disable kernel test was set or current user is not a root user +# If NB_TESTS passes to function, it would call the skip() to skip number of tests. +# If NB_TESTS is empty, function just output a reason + +function check_skip_kernel_test () +{ + local num_tests="$1" + + # Check for skip test kernel flag + if [ "$LTTNG_TOOLS_DISABLE_KERNEL_TESTS" == "1" ]; then + if ! test -z "$num_tests"; then + skip 0 "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set. Skipping all tests." "$num_tests" + else + diag "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set" + fi + return 0 + fi + + # Check if we are running as root + if [ "$(id -u)" != "0" ]; then + if ! test -z "$num_tests"; then + skip 0 "Root access is needed for kernel testing, skipping." "$num_tests" + else + diag "Root access is needed for kernel testing" + fi + return 0 + fi + + return 1 +} + # Check if base lttng-modules are present. # Bail out on failure function validate_lttng_modules_present () -- 2.25.1 _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Hi Adel, It sounds to me like the feature you might want to try and use is the combining triggers with the user space application notification action. C.f. https://lttng.org/docs/v2.13/#doc-trigger C.f. https://lttng.org/docs/v2.13/#doc-trigger-event-notif thanks, kienan On 2/6/24 14:32, Adel Belkhiri via lttng-dev wrote: > Hi everyone, > > Hope you're all good. I'm working on something where I need to set up > routines or callbacks for specific LTTng USDT events (sticking to user > space, not kernel). The plan is to catch these events as they happen to > spot performance issues. > > If anyone's done something like this or has pointers on how to pull it > off, I'd really appreciate your advice. > > Thanks! > > > _______________________________________________ > lttng-dev mailing list > lttng-dev@lists.lttng.org > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Hi Michael, On Tue, Feb 06, 2024 at 02:14:14PM -0500, Michael Jeanson wrote: > On 2024-01-26 12:18, Martin Hicks via lttng-dev wrote: > Hi Martin, > > I tested your patch and did some minor fixes, I added the base kernel > version to the RHEL ABI version check in the Kbuild file because the ABI is > tied to a specific kernel version and it would conflict with other RHEL > versions. I also adjusted the range for 'kfree_skb' to build on RHEL9.2 > kernels. > > I uploaded the updated patch [1] to our gerrit instance for easier tracking > on our side. Can you please test this version on your system? > > You can get the patch using these commands: > > git fetch https://review.lttng.org/lttng-modules refs/changes/50/11750/3 > git cherry-pick FETCH_HEAD I cherry-picked, reviewed and compile tested. Everything still looks good. Thanks, mh -- Martin Hicks SR Research Ltd. Fast, Accurate, Reliable Eye Tracking _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
[-- Attachment #1.1: Type: text/plain, Size: 373 bytes --] Hi everyone, Hope you're all good. I'm working on something where I need to set up routines or callbacks for specific LTTng USDT events (sticking to user space, not kernel). The plan is to catch these events as they happen to spot performance issues. If anyone's done something like this or has pointers on how to pull it off, I'd really appreciate your advice. Thanks! [-- Attachment #1.2: Type: text/html, Size: 2037 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev