From: Jérémie Galarneau Date: Fri, 14 Apr 2023 18:57:06 +0000 (-0400) Subject: Tests: fix: test_list_triggers_cli fails to list userspace-probe-sdt trigger X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2f101846a0f504e64d37bf93c3b67d531f5a3b65;p=lttng-tools.git Tests: fix: test_list_triggers_cli fails to list userspace-probe-sdt trigger The listing of triggers which use an event rule match condition consisting in a user space probe set on an SDT probe fails since 28f23191d. The coding style imposes an order of includes. However, the order in which the probe declarations generated by systemtap vs sdt.h matters. From SYSTEMTAP(2): Sometimes, semaphore variables are not necessary nor helpful. Skipping them can simplify the build process, by omitting the extra "test.o" file. To skip dependence upon semaphore variables, include "" within the application before "test.h": [...] In this mode, the ENABLED() test is fixed at 1. The reformatted version of userspace-probe-sdt-binary.c includes sdt.h after the probe causing the probes to use a guarding semaphore. Unfortunately, we can't instrument such probes and the registration of the trigger silently fails. The silent failure is addressed by a follow-up commit. Signed-off-by: Jérémie Galarneau Change-Id: I5146f55ed5d9d109f1f7bc32e0f7c2c8bf839f8e --- diff --git a/tests/utils/testapp/userspace-probe-sdt-binary/libbar.c b/tests/utils/testapp/userspace-probe-sdt-binary/libbar.c index 633fa0561..0a0edfb81 100644 --- a/tests/utils/testapp/userspace-probe-sdt-binary/libbar.c +++ b/tests/utils/testapp/userspace-probe-sdt-binary/libbar.c @@ -5,9 +5,16 @@ * */ +/* + * The order of inclusion is important here: including sdt.h _before_ the probe + * declarations ensures that semaphore-protected SDT probes (which we don't support) are not + * generated. See SYSTEMTAP(2) for more details. + */ +/* clang-format off */ +#include #include "foobar_provider.h" +/* clang-format on */ -#include void bar_function() { FOOBAR_TP_IN_DLOPEN(); diff --git a/tests/utils/testapp/userspace-probe-sdt-binary/libfoo.c b/tests/utils/testapp/userspace-probe-sdt-binary/libfoo.c index 78c79fb84..283dac24e 100644 --- a/tests/utils/testapp/userspace-probe-sdt-binary/libfoo.c +++ b/tests/utils/testapp/userspace-probe-sdt-binary/libfoo.c @@ -5,9 +5,16 @@ * */ +/* + * The order of inclusion is important here: including sdt.h _before_ the probe + * declarations ensures that semaphore-protected SDT probes (which we don't support) are not + * generated. See SYSTEMTAP(2) for more details. + */ +/* clang-format off */ +#include #include "foobar_provider.h" +/* clang-format on */ -#include void foo_function() { FOOBAR_TP_IN_SHARED_OBJECT(); diff --git a/tests/utils/testapp/userspace-probe-sdt-binary/libzzz.c b/tests/utils/testapp/userspace-probe-sdt-binary/libzzz.c index ee7599f9e..8b3a0b208 100644 --- a/tests/utils/testapp/userspace-probe-sdt-binary/libzzz.c +++ b/tests/utils/testapp/userspace-probe-sdt-binary/libzzz.c @@ -5,9 +5,16 @@ * */ +/* + * The order of inclusion is important here: including sdt.h _before_ the probe + * declarations ensures that semaphore-protected SDT probes (which we don't support) are not + * generated. See SYSTEMTAP(2) for more details. + */ +/* clang-format off */ +#include #include "foobar_provider.h" +/* clang-format on */ -#include void overridable_function() { FOOBAR_TP_IN_LDPRELOAD(); diff --git a/tests/utils/testapp/userspace-probe-sdt-binary/sema.c b/tests/utils/testapp/userspace-probe-sdt-binary/sema.c index ffe2b5c60..ef8ed2629 100644 --- a/tests/utils/testapp/userspace-probe-sdt-binary/sema.c +++ b/tests/utils/testapp/userspace-probe-sdt-binary/sema.c @@ -5,9 +5,16 @@ * */ +/* + * The order of inclusion is important here: including sdt.h _after_ the probe + * declarations ensures that semaphore-protected SDT probes are + * generated. See SYSTEMTAP(2) for more details. + */ +/* clang-format off */ #include "foobar_provider.h" - #include +/* clang-format on */ + void sema_function() { FOOBAR_TP_WITH_SEMAPHORE(); diff --git a/tests/utils/testapp/userspace-probe-sdt-binary/userspace-probe-sdt-binary.c b/tests/utils/testapp/userspace-probe-sdt-binary/userspace-probe-sdt-binary.c index c9c803697..551b42b5a 100644 --- a/tests/utils/testapp/userspace-probe-sdt-binary/userspace-probe-sdt-binary.c +++ b/tests/utils/testapp/userspace-probe-sdt-binary/userspace-probe-sdt-binary.c @@ -9,7 +9,16 @@ #define _GNU_SOURCE #endif +/* + * The order of inclusion is important here: including sdt.h _before_ the probe + * declarations ensures that semaphore-protected SDT probes (which we don't support) are not + * generated. See SYSTEMTAP(2) for more details. + */ +/* clang-format off */ +#include #include "foobar_provider.h" +/* clang-format on */ + #include "libfoo.h" #include "sema.h" @@ -18,7 +27,6 @@ #include #include #include -#include #include #include