summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/lttng')
-rwxr-xr-xmeta/recipes-kernel/lttng/babeltrace2/run-ptest12
-rw-r--r--meta/recipes-kernel/lttng/babeltrace2_2.0.6.bb (renamed from meta/recipes-kernel/lttng/babeltrace2_2.0.3.bb)18
-rw-r--r--meta/recipes-kernel/lttng/babeltrace_1.5.11.bb (renamed from meta/recipes-kernel/lttng/babeltrace_1.5.8.bb)8
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0001-fix-btrfs-simplify-delayed-ref-tracepoints-v6.10.patch142
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0001-fix-close_on_exec-pass-files_struct-instead-of-fdtab.patch79
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch46
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0002-fix-btrfs-move-parent-and-ref_root-into-btrfs_delaye.patch58
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0003-fix-net-udp-add-IP-port-data-to-the-tracepoint-udp-u.patch79
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch49
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules_2.12.4.bb40
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules_2.13.13.bb45
-rw-r--r--meta/recipes-kernel/lttng/lttng-platforms.inc16
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/0001-Fix-rotation-destroy-flush-fix-session-daemon-abort-.patch56
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch74
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/0001-tests-add-check_skip_kernel_test-to-check-root-user-.patch1246
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/0001-tests-do-not-strip-a-helper-library.patch9
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/0001-tests-regression-disable-the-tools-live-tests.patch55
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/disable-tests.patch34
-rwxr-xr-xmeta/recipes-kernel/lttng/lttng-tools/run-ptest45
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools_2.13.13.bb (renamed from meta/recipes-kernel/lttng/lttng-tools_2.12.2.bb)81
-rw-r--r--meta/recipes-kernel/lttng/lttng-ust/0001-Makefile.am-update-rpath-link.patch33
-rw-r--r--meta/recipes-kernel/lttng/lttng-ust/0001-lttng-ust-common-link-with-liburcu-explicitly.patch26
-rw-r--r--meta/recipes-kernel/lttng/lttng-ust/0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch26
-rw-r--r--meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb (renamed from meta/recipes-kernel/lttng/lttng-ust_2.12.0.bb)30
24 files changed, 2081 insertions, 226 deletions
diff --git a/meta/recipes-kernel/lttng/babeltrace2/run-ptest b/meta/recipes-kernel/lttng/babeltrace2/run-ptest
index 72fe223436..71a9c81bfb 100755
--- a/meta/recipes-kernel/lttng/babeltrace2/run-ptest
+++ b/meta/recipes-kernel/lttng/babeltrace2/run-ptest
@@ -6,4 +6,14 @@
6# test plan to raise ERRORs; this is just noise. 6# test plan to raise ERRORs; this is just noise.
7makeargs="LOG_DRIVER_FLAGS=--ignore-exit abs_top_srcdir=$PWD abs_top_builddir=$PWD GREP=grep SED=sed PYTHON=python3" 7makeargs="LOG_DRIVER_FLAGS=--ignore-exit abs_top_srcdir=$PWD abs_top_builddir=$PWD GREP=grep SED=sed PYTHON=python3"
8 8
9exec make -C tests -k -s $makeargs $target 2>/dev/null 9exec 2> error.log
10make -C tests -k -s $makeargs $target
11exitcode=$?
12if [ -e error.log ]; then
13 cat error.log
14fi
15if [ -e tests/test-suite.log ]; then
16 cat tests/test-suite.log
17fi
18
19exit $exitcode \ No newline at end of file
diff --git a/meta/recipes-kernel/lttng/babeltrace2_2.0.3.bb b/meta/recipes-kernel/lttng/babeltrace2_2.0.6.bb
index c65882581d..d6c75d7580 100644
--- a/meta/recipes-kernel/lttng/babeltrace2_2.0.3.bb
+++ b/meta/recipes-kernel/lttng/babeltrace2_2.0.6.bb
@@ -2,34 +2,36 @@ SUMMARY = "Babeltrace2 - Trace Format Babel Tower"
2DESCRIPTION = "Babeltrace provides trace read and write libraries in host side, as well as a trace converter, which used to convert LTTng 2.0 traces into human-readable log." 2DESCRIPTION = "Babeltrace provides trace read and write libraries in host side, as well as a trace converter, which used to convert LTTng 2.0 traces into human-readable log."
3HOMEPAGE = "http://babeltrace.org/" 3HOMEPAGE = "http://babeltrace.org/"
4BUGTRACKER = "https://bugs.lttng.org/projects/babeltrace" 4BUGTRACKER = "https://bugs.lttng.org/projects/babeltrace"
5LICENSE = "MIT & GPLv2 & LGPLv2.1 & BSD-2-Clause" 5LICENSE = "MIT & GPL-2.0-only & LGPL-2.1-only & BSD-2-Clause"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=a6a458c13f18385b7bc5069a6d7b176e" 6LIC_FILES_CHKSUM = "file://LICENSE;md5=a6a458c13f18385b7bc5069a6d7b176e"
7 7
8DEPENDS = "glib-2.0 util-linux popt bison-native flex-native" 8DEPENDS = "glib-2.0 util-linux popt bison-native flex-native"
9 9
10SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-2.0 \ 10SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-2.0;protocol=https \
11 file://run-ptest \ 11 file://run-ptest \
12 file://0001-tests-do-not-run-test-applications-from-.libs.patch \ 12 file://0001-tests-do-not-run-test-applications-from-.libs.patch \
13 file://0001-Make-manpages-multilib-identical.patch \ 13 file://0001-Make-manpages-multilib-identical.patch \
14 " 14 "
15SRCREV = "91d154476e66735d705adda9ca5cbf5b5eea5940" 15SRCREV = "0a6632f77801f3218a288604c646f8a39cb0d2c4"
16UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>2(\.\d+)+)$" 16UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>2(\.\d+)+)$"
17 17
18S = "${WORKDIR}/git" 18S = "${WORKDIR}/git"
19 19
20inherit autotools pkgconfig ptest 20inherit autotools pkgconfig ptest python3targetconfig
21 21
22EXTRA_OECONF = "--disable-debug-info" 22EXTRA_OECONF = "--disable-debug-info --disable-Werror"
23 23
24PACKAGECONFIG ??= "manpages" 24PACKAGECONFIG ??= "manpages"
25PACKAGECONFIG[manpages] = ", --disable-man-pages, asciidoc-native xmlto-native" 25PACKAGECONFIG[manpages] = ", --disable-man-pages, asciidoc-native xmlto-native"
26 26
27FILES_${PN}-staticdev += "${libdir}/babeltrace2/plugins/*.a" 27FILES:${PN}-staticdev += "${libdir}/babeltrace2/plugins/*.a"
28FILES_${PN} += "${libdir}/babeltrace2/plugins/*.so" 28FILES:${PN} += "${libdir}/babeltrace2/plugins/*.so"
29 29
30ASNEEDED = "" 30ASNEEDED = ""
31LDFLAGS:append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld ptest', ' -fuse-ld=bfd ', '', d)}"
31 32
32RDEPENDS_${PN}-ptest += "bash gawk python3" 33# coreutils since we need full mktemp
34RDEPENDS:${PN}-ptest += "bash gawk python3 make grep coreutils findutils"
33 35
34do_compile_ptest () { 36do_compile_ptest () {
35 make -C tests all 37 make -C tests all
diff --git a/meta/recipes-kernel/lttng/babeltrace_1.5.8.bb b/meta/recipes-kernel/lttng/babeltrace_1.5.11.bb
index 9e5d3a7a97..f4d9b5e42a 100644
--- a/meta/recipes-kernel/lttng/babeltrace_1.5.8.bb
+++ b/meta/recipes-kernel/lttng/babeltrace_1.5.11.bb
@@ -2,15 +2,15 @@ SUMMARY = "Babeltrace - Trace Format Babel Tower"
2DESCRIPTION = "Babeltrace provides trace read and write libraries in host side, as well as a trace converter, which used to convert LTTng 2.0 traces into human-readable log." 2DESCRIPTION = "Babeltrace provides trace read and write libraries in host side, as well as a trace converter, which used to convert LTTng 2.0 traces into human-readable log."
3HOMEPAGE = "http://babeltrace.org/" 3HOMEPAGE = "http://babeltrace.org/"
4BUGTRACKER = "https://bugs.lttng.org/projects/babeltrace" 4BUGTRACKER = "https://bugs.lttng.org/projects/babeltrace"
5LICENSE = "MIT & GPLv2 & LGPLv2.1" 5LICENSE = "MIT & GPL-2.0-only & LGPL-2.1-only"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=76ba15dd76a248e1dd526bca0e2125fa" 6LIC_FILES_CHKSUM = "file://LICENSE;md5=76ba15dd76a248e1dd526bca0e2125fa"
7 7
8DEPENDS = "glib-2.0 util-linux popt bison-native flex-native" 8DEPENDS = "glib-2.0 util-linux popt bison-native flex-native"
9 9
10SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-1.5 \ 10SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-1.5;protocol=https \
11 file://run-ptest \ 11 file://run-ptest \
12 " 12 "
13SRCREV = "054a54ae10b01a271afc4f19496c041b10fb414c" 13SRCREV = "91c00f70884887ff5c4849a8e3d47e311a22ba9d"
14UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>1(\.\d+)+)$" 14UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>1(\.\d+)+)$"
15 15
16S = "${WORKDIR}/git" 16S = "${WORKDIR}/git"
@@ -21,7 +21,7 @@ EXTRA_OECONF = "--disable-debug-info"
21 21
22ASNEEDED = "" 22ASNEEDED = ""
23 23
24RDEPENDS_${PN}-ptest += "bash gawk" 24RDEPENDS:${PN}-ptest += "bash gawk make"
25 25
26addtask do_patch_ptest_path after do_patch before do_configure 26addtask do_patch_ptest_path after do_patch before do_configure
27do_patch_ptest_path () { 27do_patch_ptest_path () {
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-btrfs-simplify-delayed-ref-tracepoints-v6.10.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-btrfs-simplify-delayed-ref-tracepoints-v6.10.patch
new file mode 100644
index 0000000000..c1e11f2bfb
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-btrfs-simplify-delayed-ref-tracepoints-v6.10.patch
@@ -0,0 +1,142 @@
1From db0f940136afd43ce5fcf87c4d4e9ca558db1d4f Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 27 May 2024 13:04:42 -0400
4Subject: [PATCH 1/3] fix: btrfs: simplify delayed ref tracepoints (v6.10)
5
6See upstream commit:
7
8 commit 1bff6d4f873790cfc675afce9860208576508c5a
9 Author: Josef Bacik <josef@toxicpanda.com>
10 Date: Fri Apr 12 20:27:00 2024 -0400
11
12 btrfs: simplify delayed ref tracepoints
13
14 Now that all of the delayed ref information is in the delayed ref node,
15 drastically simplify the delayed ref tracepoints by simply passing in
16 the btrfs_delayed_ref_node and populating the tracepoints with the
17 values from the structure itself.
18
19Upstream-Status: Backport [commit db0f9401 fix: btrfs: simplify delayed ref tracepoints (v6.10)]
20
21Change-Id: Ic90bc23d6aa558baec33adc33b4d21e052e83375
22Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
23Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
24---
25 include/instrumentation/events/btrfs.h | 94 +++++++++++++++++++++++++-
26 1 file changed, 92 insertions(+), 2 deletions(-)
27
28diff --git a/include/instrumentation/events/btrfs.h b/include/instrumentation/events/btrfs.h
29index ffb1b646..d73c1ce5 100644
30--- a/include/instrumentation/events/btrfs.h
31+++ b/include/instrumentation/events/btrfs.h
32@@ -899,7 +899,51 @@ LTTNG_TRACEPOINT_EVENT(btrfs_add_block_group,
33 )
34 #endif
35
36-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0) || \
37+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,10,0))
38+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_tree_ref,
39+
40+ TP_PROTO(const struct btrfs_fs_info *fs_info,
41+ const struct btrfs_delayed_ref_node *ref),
42+
43+ TP_ARGS(fs_info, ref),
44+
45+ TP_FIELDS(
46+ ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
47+ ctf_integer(u64, bytenr, ref->bytenr)
48+ ctf_integer(u64, num_bytes, ref->num_bytes)
49+ ctf_integer(int, action, ref->action)
50+ ctf_integer(u64, parent, ref->tree_ref.parent)
51+ ctf_integer(u64, ref_root, ref->tree_ref.root)
52+ ctf_integer(int, level, ref->tree_ref.level)
53+ ctf_integer(int, type, ref->type)
54+ ctf_integer(u64, seq, ref->seq)
55+ )
56+)
57+
58+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref,
59+
60+ add_delayed_tree_ref,
61+
62+ btrfs_add_delayed_tree_ref,
63+
64+ TP_PROTO(const struct btrfs_fs_info *fs_info,
65+ const struct btrfs_delayed_ref_node *ref),
66+
67+ TP_ARGS(fs_info, ref)
68+)
69+
70+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_tree_ref,
71+
72+ run_delayed_tree_ref,
73+
74+ btrfs_run_delayed_tree_ref,
75+
76+ TP_PROTO(const struct btrfs_fs_info *fs_info,
77+ const struct btrfs_delayed_ref_node *ref),
78+
79+ TP_ARGS(fs_info, ref)
80+)
81+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0) || \
82 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
83 LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
84 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
85@@ -1139,7 +1183,53 @@ LTTNG_TRACEPOINT_EVENT(btrfs_delayed_tree_ref,
86 )
87 #endif
88
89-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0) || \
90+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,10,0))
91+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_data_ref,
92+
93+ TP_PROTO(const struct btrfs_fs_info *fs_info,
94+ const struct btrfs_delayed_ref_node *ref),
95+
96+ TP_ARGS(fs_info, ref),
97+
98+ TP_FIELDS(
99+ ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
100+ ctf_integer(u64, bytenr, ref->bytenr)
101+ ctf_integer(u64, num_bytes, ref->num_bytes)
102+ ctf_integer(int, action, ref->action)
103+ ctf_integer(u64, parent, ref->data_ref.parent)
104+ ctf_integer(u64, ref_root, ref->data_ref.root)
105+ ctf_integer(u64, owner, ref->data_ref.objectid)
106+ ctf_integer(u64, offset, ref->data_ref.offset)
107+ ctf_integer(int, type, ref->type)
108+ ctf_integer(u64, seq, ref->seq)
109+ )
110+)
111+
112+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref,
113+
114+ add_delayed_data_ref,
115+
116+ btrfs_add_delayed_data_ref,
117+
118+ TP_PROTO(const struct btrfs_fs_info *fs_info,
119+ const struct btrfs_delayed_ref_node *ref),
120+
121+ TP_ARGS(fs_info, ref)
122+)
123+
124+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(btrfs_delayed_data_ref,
125+
126+ run_delayed_data_ref,
127+
128+ btrfs_run_delayed_data_ref,
129+
130+ TP_PROTO(const struct btrfs_fs_info *fs_info,
131+ const struct btrfs_delayed_ref_node *ref),
132+
133+ TP_ARGS(fs_info, ref)
134+)
135+
136+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0) || \
137 LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
138 LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
139 LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
140--
1412.39.2
142
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-close_on_exec-pass-files_struct-instead-of-fdtab.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-close_on_exec-pass-files_struct-instead-of-fdtab.patch
new file mode 100644
index 0000000000..bb659d5563
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-close_on_exec-pass-files_struct-instead-of-fdtab.patch
@@ -0,0 +1,79 @@
1From c8adc20d19d853527a29411a03e114efdeff5f59 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 27 May 2024 10:49:45 -0400
4Subject: [PATCH] fix: close_on_exec(): pass files_struct instead of fdtable
5 (v6.10)
6
7See upstream commit:
8
9 commit f60d374d2cc88034385265d193a38e3f4a4b430c
10 Author: Al Viro <viro@zeniv.linux.org.uk>
11 Date: Thu Jan 4 21:35:38 2024 -0500
12
13 close_on_exec(): pass files_struct instead of fdtable
14
15 both callers are happier that way...
16
17Upstream-Status: Backport [c8adc20d fix: close_on_exec(): pass files_struct instead of fdtable (v6.10)]
18
19Change-Id: I8cdabb073c2090842b27b74954d86cb486c43b3e
20Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
21Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
22---
23 include/wrapper/fdtable.h | 14 ++++++++++++++
24 src/lttng-statedump-impl.c | 3 +--
25 2 files changed, 15 insertions(+), 2 deletions(-)
26
27Index: lttng-modules-2.13.13/include/wrapper/fdtable.h
28===================================================================
29--- lttng-modules-2.13.13.orig/include/wrapper/fdtable.h
30+++ lttng-modules-2.13.13/include/wrapper/fdtable.h
31@@ -69,20 +69,18 @@ int lttng_iterate_fd(struct files_struct
32
33 #endif
34
35-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,4,0))
36-
37-static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
38+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,10,0))
39+static inline
40+bool lttng_close_on_exec(unsigned int fd, const struct files_struct *files)
41 {
42- return close_on_exec(fd, fdt);
43+ return close_on_exec(fd, files);
44 }
45-
46 #else
47-
48-static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
49+static inline
50+bool lttng_close_on_exec(unsigned int fd, const struct files_struct *files)
51 {
52- return FD_ISSET(fd, fdt->close_on_exec);
53+ return close_on_exec(fd, files_fdtable(files));
54 }
55-
56 #endif
57
58 #endif /* _LTTNG_WRAPPER_FDTABLE_H */
59Index: lttng-modules-2.13.13/src/lttng-statedump-impl.c
60===================================================================
61--- lttng-modules-2.13.13.orig/src/lttng-statedump-impl.c
62+++ lttng-modules-2.13.13/src/lttng-statedump-impl.c
63@@ -44,7 +44,6 @@
64 #include <wrapper/tracepoint.h>
65 #include <wrapper/genhd.h>
66 #include <wrapper/file.h>
67-#include <wrapper/fdtable.h>
68 #include <wrapper/sched.h>
69
70 #ifdef CONFIG_LTTNG_HAS_LIST_IRQ
71@@ -451,7 +450,7 @@ int lttng_dump_one_fd(const void *p, str
72 * the lock is taken, but we are not aware whether this is
73 * guaranteed or not, so play safe.
74 */
75- if (fd < fdt->max_fds && lttng_close_on_exec(fd, fdt))
76+ if (fd < fdt->max_fds && lttng_close_on_exec(fd, ctx->files))
77 flags |= O_CLOEXEC;
78 if (IS_ERR(s)) {
79 struct dentry *dentry = file->f_path.dentry;
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch
new file mode 100644
index 0000000000..120528bf9c
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch
@@ -0,0 +1,46 @@
1From 878f89b6136ff7b870a19e04901cc6f316bbe10a Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@gmail.com>
3Date: Sat, 15 May 2021 10:26:38 -0400
4Subject: [PATCH] src/Kbuild: change missing CONFIG_TRACEPOINTS to warning
5
6Taken from a previous patch to the main lttng-modules Makefile, by
7Otavio Salvador:
8
9 The lttng-modules are being pulled by the tools-profile image feature,
10 however, not every kernel has the CONFIG_TRACEPOINTS feature enabled.
11
12 This change makes the build do not fail when CONFIG_TRACEPOINTS is not
13 available, allowing it to be kept being pulled by default.
14
15Upstream-Status: Inappropriate [embedded specific]
16
17Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
18---
19 src/Kbuild | 7 ++++++-
20 1 file changed, 6 insertions(+), 1 deletion(-)
21
22Index: lttng-modules-2.13.10/src/Kbuild
23===================================================================
24--- lttng-modules-2.13.10.orig/src/Kbuild
25+++ lttng-modules-2.13.10/src/Kbuild
26@@ -2,10 +2,13 @@
27
28 ifdef CONFIG_LOCALVERSION # Check if dot-config is included.
29 ifeq ($(CONFIG_TRACEPOINTS),)
30- $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration)
31+ $(warning The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration)
32+ DISABLE_MODULE = y
33 endif # CONFIG_TRACEPOINTS
34 endif # ifdef CONFIG_LOCALVERSION
35
36+ifneq ($(DISABLE_MODULE),y)
37+
38 TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/..
39
40 lttng_check_linux_version = $(shell pwd)/include/linux/version.h
41@@ -150,3 +153,5 @@ lttng-statedump-objs := lttng-statedump-
42 obj-$(CONFIG_LTTNG) += probes/
43 obj-$(CONFIG_LTTNG) += lib/
44 obj-$(CONFIG_LTTNG) += tests/
45+
46+endif # DISABLE_MODULE
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-btrfs-move-parent-and-ref_root-into-btrfs_delaye.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-btrfs-move-parent-and-ref_root-into-btrfs_delaye.patch
new file mode 100644
index 0000000000..5d0d1fb314
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-btrfs-move-parent-and-ref_root-into-btrfs_delaye.patch
@@ -0,0 +1,58 @@
1From 9bb17e292631f54fb5af4be4fae32ccd3d3d15c7 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 27 May 2024 13:13:15 -0400
4Subject: [PATCH 2/3] fix: btrfs: move ->parent and ->ref_root into
5 btrfs_delayed_ref_node (v6.10)
6
7See upstream commit:
8
9 commit cf4f04325b2b27efa5697ba0ea4c1abdee0035b4
10 Author: Josef Bacik <josef@toxicpanda.com>
11 Date: Fri Apr 12 22:57:13 2024 -0400
12
13 btrfs: move ->parent and ->ref_root into btrfs_delayed_ref_node
14
15 These two members are shared by both the tree refs and data refs, so
16 move them into btrfs_delayed_ref_node proper. This allows us to greatly
17 simplify the comparison code, as the shared refs always only sort on
18 parent, and the non shared refs always sort first on ref_root, and then
19 only data refs sort on their specific fields.
20
21Upstream-Status: Backport [9bb17e29 fix: btrfs: move ->parent and ->ref_root into btrfs_delayed_ref_node (v6.10)]
22
23Change-Id: Ib7c92cc4bb8d674ac66ccfa25c03476f7adaaf90
24Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
25Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
26---
27 include/instrumentation/events/btrfs.h | 8 ++++----
28 1 file changed, 4 insertions(+), 4 deletions(-)
29
30diff --git a/include/instrumentation/events/btrfs.h b/include/instrumentation/events/btrfs.h
31index d73c1ce5..c0c746e2 100644
32--- a/include/instrumentation/events/btrfs.h
33+++ b/include/instrumentation/events/btrfs.h
34@@ -912,8 +912,8 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_tree_ref,
35 ctf_integer(u64, bytenr, ref->bytenr)
36 ctf_integer(u64, num_bytes, ref->num_bytes)
37 ctf_integer(int, action, ref->action)
38- ctf_integer(u64, parent, ref->tree_ref.parent)
39- ctf_integer(u64, ref_root, ref->tree_ref.root)
40+ ctf_integer(u64, parent, ref->parent)
41+ ctf_integer(u64, ref_root, ref->ref_root)
42 ctf_integer(int, level, ref->tree_ref.level)
43 ctf_integer(int, type, ref->type)
44 ctf_integer(u64, seq, ref->seq)
45@@ -1196,8 +1196,8 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs_delayed_data_ref,
46 ctf_integer(u64, bytenr, ref->bytenr)
47 ctf_integer(u64, num_bytes, ref->num_bytes)
48 ctf_integer(int, action, ref->action)
49- ctf_integer(u64, parent, ref->data_ref.parent)
50- ctf_integer(u64, ref_root, ref->data_ref.root)
51+ ctf_integer(u64, parent, ref->parent)
52+ ctf_integer(u64, ref_root, ref->ref_root)
53 ctf_integer(u64, owner, ref->data_ref.objectid)
54 ctf_integer(u64, offset, ref->data_ref.offset)
55 ctf_integer(int, type, ref->type)
56--
572.39.2
58
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-net-udp-add-IP-port-data-to-the-tracepoint-udp-u.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-net-udp-add-IP-port-data-to-the-tracepoint-udp-u.patch
new file mode 100644
index 0000000000..ab28f870c5
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-net-udp-add-IP-port-data-to-the-tracepoint-udp-u.patch
@@ -0,0 +1,79 @@
1From 4ae0d960e149d1205d0cc167e44c120148c7f4f0 Mon Sep 17 00:00:00 2001
2From: Michael Jeanson <mjeanson@efficios.com>
3Date: Mon, 27 May 2024 11:11:21 -0400
4Subject: [PATCH 3/3] fix: net: udp: add IP/port data to the tracepoint
5 udp/udp_fail_queue_rcv_skb (v6.10)
6
7See upstream commit:
8
9 commit e9669a00bba79442dd4862c57761333d6a020c24
10 Author: Balazs Scheidler <bazsi77@gmail.com>
11 Date: Tue Mar 26 19:05:47 2024 +0100
12
13 net: udp: add IP/port data to the tracepoint udp/udp_fail_queue_rcv_skb
14
15 The udp_fail_queue_rcv_skb() tracepoint lacks any details on the source
16 and destination IP/port whereas this information can be critical in case
17 of UDP/syslog.
18
19Upstream-Status: Backport [4ae0d960 fix: net: udp: add IP/port data to the tracepoint udp/udp_fail_queue_rcv_skb (v6.10)]
20
21Change-Id: I0c337c5817b0a120298cbf5088d60671d9625b0d
22Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
23Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
24---
25 include/instrumentation/events/udp.h | 30 ++++++++++++++++++++++++++++
26 1 file changed, 30 insertions(+)
27
28diff --git a/include/instrumentation/events/udp.h b/include/instrumentation/events/udp.h
29index b63a1bb5..0a94b466 100644
30--- a/include/instrumentation/events/udp.h
31+++ b/include/instrumentation/events/udp.h
32@@ -7,7 +7,36 @@
33
34 #include <lttng/tracepoint-event.h>
35 #include <linux/udp.h>
36+#include <lttng/kernel-version.h>
37
38+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,10,0))
39+LTTNG_TRACEPOINT_ENUM(lttng_sk_family,
40+ TP_ENUM_VALUES(
41+ ctf_enum_value("AF_INET", AF_INET)
42+ ctf_enum_value("AF_INET6", AF_INET6)
43+ )
44+)
45+
46+LTTNG_TRACEPOINT_EVENT(udp_fail_queue_rcv_skb,
47+
48+ TP_PROTO(int rc, struct sock *sk, struct sk_buff *skb),
49+
50+ TP_ARGS(rc, sk, skb),
51+
52+ TP_FIELDS(
53+ ctf_integer(int, rc, rc)
54+ ctf_integer(__u16, sport, ntohs(udp_hdr(skb)->source))
55+ ctf_integer(__u16, dport, ntohs(udp_hdr(skb)->dest))
56+ ctf_enum(lttng_sk_family, __u16, family, sk->sk_family)
57+ /*
58+ * The 'saddr' and 'daddr' fields from the upstream tracepoint
59+ * are currently not extracted. It is recommended to use a
60+ * tracepoint from the 'net' probe instead which includes all
61+ * fields from the IP header.
62+ */
63+ )
64+)
65+#else
66 LTTNG_TRACEPOINT_EVENT(udp_fail_queue_rcv_skb,
67
68 TP_PROTO(int rc, struct sock *sk),
69@@ -19,6 +48,7 @@ LTTNG_TRACEPOINT_EVENT(udp_fail_queue_rcv_skb,
70 ctf_integer(__u16, lport, inet_sk(sk)->inet_num)
71 )
72 )
73+#endif
74
75 #endif /* LTTNG_TRACE_UDP_H */
76
77--
782.39.2
79
diff --git a/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch b/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch
deleted file mode 100644
index e411242272..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules/Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1From 1b0e574d680101105a6c1e8931c78824f5a97a42 Mon Sep 17 00:00:00 2001
2From: Otavio Salvador <otavio@ossystems.com.br>
3Date: Mon, 5 Sep 2016 17:08:56 +0000
4Subject: [PATCH] Makefile: Do not fail if CONFIG_TRACEPOINTS is not enabled
5Organization: O.S. Systems Software LTDA.
6
7The lttng-modules are being pulled by the tools-profile image feature,
8however, not every kernel has the CONFIG_TRACEPOINTS feature enabled.
9
10This change makes the build do not fail when CONFIG_TRACEPOINTS is not
11available, allowing it to be kept being pulled by default.
12
13Upstream-Status: Inappropriate [embedded specific]
14
15Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
16---
17 Makefile | 9 +++++----
18 1 file changed, 5 insertions(+), 4 deletions(-)
19
20diff --git a/Makefile b/Makefile
21index 8602649..75550cc 100644
22--- a/Makefile
23+++ b/Makefile
24@@ -8,10 +8,7 @@ ifneq ($(KERNELRELEASE),)
25 # and defines the modules to be built.
26
27 ifdef CONFIG_LOCALVERSION # Check if dot-config is included.
28- ifeq ($(CONFIG_TRACEPOINTS),)
29- $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration)
30- endif # CONFIG_TRACEPOINTS
31- endif # ifdef CONFIG_LOCALVERSION
32+ ifneq ($(CONFIG_TRACEPOINTS),)
33
34 TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))
35
36@@ -94,6 +91,10 @@ ifneq ($(KERNELRELEASE),)
37 obj-$(CONFIG_LTTNG) += lib/
38 obj-$(CONFIG_LTTNG) += tests/
39
40+ else
41+ $(warning The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration)
42+ endif # CONFIG_TRACEPOINTS
43+ endif # ifdef CONFIG_LOCALVERSION
44 else # KERNELRELEASE
45
46 # This part of the Makefile is used when the 'make' command is runned in the
47--
482.1.4
49
diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.4.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.4.bb
deleted file mode 100644
index 73f3931717..0000000000
--- a/meta/recipes-kernel/lttng/lttng-modules_2.12.4.bb
+++ /dev/null
@@ -1,40 +0,0 @@
1SECTION = "devel"
2SUMMARY = "Linux Trace Toolkit KERNEL MODULE"
3DESCRIPTION = "The lttng-modules 2.0 package contains the kernel tracer modules"
4LICENSE = "LGPLv2.1 & GPLv2 & MIT"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=3f882d431dc0f32f1f44c0707aa41128"
6
7inherit module
8
9include lttng-platforms.inc
10
11SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
12 file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
13 "
14
15SRC_URI[sha256sum] = "fe66400fa1b85bff1b9ae24419c74e3bb7d358d643eade0594d81b48bd190688"
16
17export INSTALL_MOD_DIR="kernel/lttng-modules"
18
19EXTRA_OEMAKE += "KERNELDIR='${STAGING_KERNEL_DIR}'"
20
21do_install_append() {
22 # Delete empty directories to avoid QA failures if no modules were built
23 find ${D}/${nonarch_base_libdir} -depth -type d -empty -exec rmdir {} \;
24}
25
26python do_package_prepend() {
27 if not os.path.exists(os.path.join(d.getVar('D'), d.getVar('nonarch_base_libdir')[1:], 'modules')):
28 bb.warn("%s: no modules were created; this may be due to CONFIG_TRACEPOINTS not being enabled in your kernel." % d.getVar('PN'))
29}
30
31BBCLASSEXTEND = "devupstream:target"
32LIC_FILES_CHKSUM_class-devupstream = "file://LICENSE;md5=3f882d431dc0f32f1f44c0707aa41128"
33DEFAULT_PREFERENCE_class-devupstream = "-1"
34SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.12 \
35 file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
36 "
37SRCREV_class-devupstream = "be71b60a327d7ad2588abc5cad2861177119972b"
38PV_class-devupstream = "2.12.3+git${SRCPV}"
39S_class-devupstream = "${WORKDIR}/git"
40SRCREV_FORMAT ?= "lttng_git"
diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.13.13.bb b/meta/recipes-kernel/lttng/lttng-modules_2.13.13.bb
new file mode 100644
index 0000000000..75b144757a
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules_2.13.13.bb
@@ -0,0 +1,45 @@
1SECTION = "devel"
2SUMMARY = "Linux Trace Toolkit KERNEL MODULE"
3DESCRIPTION = "The lttng-modules 2.0 package contains the kernel tracer modules"
4HOMEPAGE = "https://lttng.org/"
5LICENSE = "LGPL-2.1-only & GPL-2.0-only & MIT"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=0464cff101a009c403cd2ed65d01d4c4"
7
8inherit module
9
10include lttng-platforms.inc
11
12SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
13 file://0001-fix-btrfs-simplify-delayed-ref-tracepoints-v6.10.patch \
14 file://0002-fix-btrfs-move-parent-and-ref_root-into-btrfs_delaye.patch \
15 file://0003-fix-net-udp-add-IP-port-data-to-the-tracepoint-udp-u.patch \
16 file://0001-fix-close_on_exec-pass-files_struct-instead-of-fdtab.patch \
17 "
18
19# Use :append here so that the patch is applied also when using devupstream
20SRC_URI:append = " file://0001-src-Kbuild-change-missing-CONFIG_TRACEPOINTS-to-warn.patch"
21
22SRC_URI[sha256sum] = "7d26c07a5e80b66aa7bdcfdaaf4857f00fc9a5cdde79226b2528676700d50228"
23
24export INSTALL_MOD_DIR="kernel/lttng-modules"
25
26EXTRA_OEMAKE += "KERNELDIR='${STAGING_KERNEL_DIR}'"
27
28MODULES_MODULE_SYMVERS_LOCATION = "src"
29
30do_install:append() {
31 # Delete empty directories to avoid QA failures if no modules were built
32 if [ -d ${D}/${nonarch_base_libdir} ]; then
33 find ${D}/${nonarch_base_libdir} -depth -type d -empty -exec rmdir {} \;
34 fi
35}
36
37python do_package:prepend() {
38 if not os.path.exists(os.path.join(d.getVar('D'), d.getVar('nonarch_base_libdir')[1:], 'modules')):
39 bb.warn("%s: no modules were created; this may be due to CONFIG_TRACEPOINTS not being enabled in your kernel." % d.getVar('PN'))
40}
41
42BBCLASSEXTEND = "devupstream:target"
43SRC_URI:class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.13;protocol=https"
44SRCREV:class-devupstream = "7584cfc04914cb0842a986e9808686858b9c8630"
45SRCREV_FORMAT ?= "lttng_git"
diff --git a/meta/recipes-kernel/lttng/lttng-platforms.inc b/meta/recipes-kernel/lttng/lttng-platforms.inc
index aa8220bbb4..900e36df82 100644
--- a/meta/recipes-kernel/lttng/lttng-platforms.inc
+++ b/meta/recipes-kernel/lttng/lttng-platforms.inc
@@ -2,16 +2,20 @@
2# Whether the platform supports kernel tracing 2# Whether the platform supports kernel tracing
3# 3#
4LTTNGMODULES = "lttng-modules" 4LTTNGMODULES = "lttng-modules"
5LTTNGMODULES_arc = "" 5LTTNGMODULES:arc = ""
6LTTNGMODULES_riscv64 = "" 6LTTNGMODULES:riscv64 = ""
7 7
8COMPATIBLE_HOST_riscv64_pn-lttng-modules = "null" 8COMPATIBLE_HOST:riscv64:pn-lttng-modules = "null"
9COMPATIBLE_HOST_arc_pn-lttng-modules = "null" 9COMPATIBLE_HOST:arc:pn-lttng-modules = "null"
10 10
11# Whether the platform supports userspace tracing 11# Whether the platform supports userspace tracing
12# lttng-ust uses sched_getcpu() which is not there on for some platforms. 12# lttng-ust uses sched_getcpu() which is not there on for some platforms.
13LTTNGUST = "lttng-ust" 13LTTNGUST = "lttng-ust"
14LTTNGUST_arc = "" 14LTTNGUST:arc = ""
15 15
16COMPATIBLE_HOST_arc_pn-lttng-ust = "null" 16COMPATIBLE_HOST:arc:pn-lttng-ust = "null"
17 17
18# Whether the platform supports lttng-tools
19# lttng-tools requires SYS_ppoll and SYS_pselect6 which are not supported on riscv32.
20# It's also turned off for riscv32 in meta-riscv. See https://github.com/riscv/meta-riscv/blob/master/conf/layer.conf
21COMPATIBLE_HOST:riscv32:pn-lttng-tools = "null"
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-rotation-destroy-flush-fix-session-daemon-abort-.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-rotation-destroy-flush-fix-session-daemon-abort-.patch
new file mode 100644
index 0000000000..3286dfb5c1
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-rotation-destroy-flush-fix-session-daemon-abort-.patch
@@ -0,0 +1,56 @@
1From 6b45c5f80d20e7bbf3d98c1fa17d2cf8716af3bb Mon Sep 17 00:00:00 2001
2From: Xiangyu Chen <xiangyu.chen@windriver.com>
3Date: Mon, 25 Mar 2024 18:20:14 +0800
4Subject: [PATCH] Fix: rotation-destroy-flush: fix session daemon abort if no
5 kernel module present
6
7Testing rotation-destroy-flush when no lttng kernel modules present, it would
8be failed with error message:
9
10 Error: Unable to load required module lttng-ring-buffer-client-discard
11 not ok 1 - Start session daemon
12 Failed test 'Start session daemon'
13 not ok 2 - Create session rotation_destroy_flush in -o /tmp/tmp.test_rot ...
14 ...
15
16This because test script that sets the LTTNG_ABORT_ON_ERROR environment
17variable. It's this environment variable that causes the sessiond to handle the
18kernel module loading failure as an abort rather than a warning.
19
20Using "check_skip_kernel_test" to detect whether the kernel module fails to
21load is expected or not. If the failure is expected, the script won't set that
22environment variable any more.
23
24Fixes: 3a174400
25("tests:add check_skip_kernel_test to check root user and lttng kernel modules")
26
27Upstream-Status: Submitted [https://review.lttng.org/c/lttng-tools/+/12155]
28
29Change-Id: I371e9ba717613e2940186f710cf3cccd35baed6c
30Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
31---
32 .../ust/rotation-destroy-flush/test_rotation_destroy_flush | 6 +++---
33 1 file changed, 3 insertions(+), 3 deletions(-)
34
35diff --git a/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush b/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush
36index 669bcbc43..64161768f 100755
37--- a/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush
38+++ b/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush
39@@ -23,11 +23,11 @@ SIZE_LIMIT=$PAGE_SIZE
40 NR_ITER=10
41 NUM_TESTS=$((15*$NR_ITER))
42
43-# Ensure the daemons invoke abort on error.
44-export LTTNG_ABORT_ON_ERROR=1
45-
46 source $TESTDIR/utils/utils.sh
47
48+# Ensure the daemons invoke abort on error.
49+check_skip_kernel_test || export LTTNG_ABORT_ON_ERROR=1
50+
51 # MUST set TESTDIR before calling those functions
52 function run_app()
53 {
54--
552.25.1
56
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch
new file mode 100644
index 0000000000..4e21d1e9f1
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch
@@ -0,0 +1,74 @@
1From 74b3844737b03492756b4f896c938b504b069f14 Mon Sep 17 00:00:00 2001
2From: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3Date: Tue, 17 Jan 2023 16:57:35 -0500
4Subject: [PATCH] compat: off64_t is not defined by musl
5
6This helps compile with latest musl, where off64_t is not defined unless
7_LARGEFILE64_SOURCE is defined. On glibc, _LARGEFILE64_SOURCE is defined
8if _GNU_SOURCE is defined, so the problem is only seen with musl.
9
10Since the project uses AC_SYS_LARGEFILE, which from the autoconf doc:
11"arrange for 64-bit file offsets, known as large-file support."
12
13As such, it is safe to assume off_t is 64-bit wide. This is checked by a
14static_assert to catch any platform where autoconf would let a 32-bit
15off_t slip.
16
17Upstream-Status: Submitted [https://review.lttng.org/c/lttng-tools/+/9268]
18Reported-by: Khem Raj <raj.khem@gmail.com>
19Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
20Change-Id: If2c6007a8c85bc3f3065002af8a7538b882fb4a8
21---
22
23--- a/src/common/compat/compat-fcntl.c
24+++ b/src/common/compat/compat-fcntl.c
25@@ -8,14 +8,17 @@
26 #define _LGPL_SOURCE
27 #include <common/compat/fcntl.h>
28 #include <common/macros.h>
29+#include <common/bug.h>
30+#include <stdint.h>
31 #include <unistd.h>
32
33 #ifdef __linux__
34
35 LTTNG_HIDDEN
36-int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
37+int compat_sync_file_range(int fd, off_t offset, off_t nbytes,
38 unsigned int flags)
39 {
40+ LTTNG_BUILD_BUG_ON(sizeof(off_t) != sizeof(int64_t));
41 #ifdef HAVE_SYNC_FILE_RANGE
42 return sync_file_range(fd, offset, nbytes, flags);
43 #else
44--- a/src/common/compat/fcntl.h
45+++ b/src/common/compat/fcntl.h
46@@ -13,16 +13,12 @@
47
48 #include <common/compat/errno.h>
49
50-#if (defined(__CYGWIN__))
51-typedef long long off64_t;
52-#endif
53-
54 #if (defined(__FreeBSD__) || defined(__sun__))
55 typedef off64_t loff_t;
56 #endif
57
58 #ifdef __linux__
59-extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
60+extern int compat_sync_file_range(int fd, off_t offset, off_t nbytes,
61 unsigned int flags);
62 #define lttng_sync_file_range(fd, offset, nbytes, flags) \
63 compat_sync_file_range(fd, offset, nbytes, flags)
64@@ -37,8 +33,8 @@ extern int compat_sync_file_range(int fd
65 #define SYNC_FILE_RANGE_WAIT_BEFORE 0
66 #define SYNC_FILE_RANGE_WRITE 0
67
68-static inline int lttng_sync_file_range(int fd, off64_t offset,
69- off64_t nbytes, unsigned int flags)
70+static inline int lttng_sync_file_range(int fd, off_t offset,
71+ off_t nbytes, unsigned int flags)
72 {
73 return -ENOSYS;
74 }
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-add-check_skip_kernel_test-to-check-root-user-.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-add-check_skip_kernel_test-to-check-root-user-.patch
new file mode 100644
index 0000000000..2671a1908e
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-add-check_skip_kernel_test-to-check-root-user-.patch
@@ -0,0 +1,1246 @@
1From cf558f802b259a33605fe0ede4d74ae2ff6be699 Mon Sep 17 00:00:00 2001
2From: Xiangyu Chen <xiangyu.chen@windriver.com>
3Date: Mon, 12 Feb 2024 09:23:54 -0500
4Subject: [PATCH] tests: add check_skip_kernel_test to check root user and
5 lttng kernel modules
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10The current tests will run both userspace and kernel testing. Some of
11use cases only use lttng for one kind of tracing on an embedded
12device (e.g. userspace), so in this scenario, the kernel modules might
13not install to target rootfs, the test cases would be fail and exit.
14
15Add LTTNG_TOOLS_DISABLE_KERNEL_TESTS to skip the lttng kernel features
16test, this flag can be set via "make":
17
18 make check LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1
19
20When this flag was set, all kernel related testcases would be marked as
21SKIP in result.
22
23Since the the LTTNG_TOOLS_DISABLE_KERNEL_TESTS was checked in function
24check_skip_kernel_test, lots of testcases also need to check root
25permission, so merging the root permission checking into
26check_skip_kernel_test.
27
28Upstream-Status: Backport from
29[https://git.lttng.org/?p=lttng-tools.git;a=commit;h=3a1744008331a0604479d3d7461f77056fad3a64]
30
31Change-Id: I49a1f642a9869c21a69e0186c296fd917bd7b525
32Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
33Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
34Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
35---
36 tests/destructive/metadata-regeneration | 8 +----
37 tests/perf/test_perf_raw.in | 8 +----
38 tests/regression/kernel/test_all_events | 8 +----
39 tests/regression/kernel/test_callstack | 8 +----
40 tests/regression/kernel/test_channel | 8 +----
41 tests/regression/kernel/test_clock_override | 8 +----
42 tests/regression/kernel/test_event_basic | 8 +----
43 tests/regression/kernel/test_kernel_function | 8 +----
44 tests/regression/kernel/test_lttng_logger | 8 +----
45 tests/regression/kernel/test_ns_contexts | 8 +----
46 .../regression/kernel/test_ns_contexts_change | 9 +----
47 .../kernel/test_rotation_destroy_flush | 8 +----
48 .../regression/kernel/test_select_poll_epoll | 8 +----
49 tests/regression/kernel/test_syscall | 8 +----
50 tests/regression/kernel/test_userspace_probe | 8 +----
51 tests/regression/tools/clear/test_kernel | 8 +----
52 .../tools/filtering/test_invalid_filter | 8 +----
53 .../tools/filtering/test_unsupported_op | 8 +----
54 .../tools/filtering/test_valid_filter | 8 +----
55 tests/regression/tools/health/test_health.sh | 10 ++----
56 tests/regression/tools/health/test_thread_ok | 9 +----
57 tests/regression/tools/live/test_kernel | 10 +++---
58 tests/regression/tools/live/test_lttng_kernel | 8 +----
59 tests/regression/tools/metadata/test_kernel | 8 +----
60 .../test_notification_kernel_buffer_usage | 36 +++++++++----------
61 .../test_notification_kernel_capture | 23 ++++++------
62 .../test_notification_kernel_error | 23 ++++++------
63 .../test_notification_kernel_instrumentation | 23 ++++++------
64 .../test_notification_kernel_syscall | 19 +++++-----
65 .../test_notification_kernel_userspace_probe | 20 +++++------
66 .../notification/test_notification_multi_app | 14 +++-----
67 ...test_notification_notifier_discarded_count | 9 +++--
68 .../tools/regen-metadata/test_kernel | 8 +----
69 .../tools/regen-statedump/test_kernel | 8 +----
70 tests/regression/tools/rotation/test_kernel | 8 +----
71 tests/regression/tools/snapshots/test_kernel | 8 +----
72 .../tools/snapshots/test_kernel_streaming | 8 +----
73 .../streaming/test_high_throughput_limits | 8 +----
74 tests/regression/tools/streaming/test_kernel | 8 +----
75 .../tools/tracker/test_event_tracker | 8 +----
76 .../tools/trigger/test_add_trigger_cli | 12 ++-----
77 .../tools/trigger/test_list_triggers_cli | 26 +++++---------
78 .../tools/wildcard/test_event_wildcard | 8 +----
79 .../test_relayd_working_directory | 4 +--
80 .../ust/namespaces/test_ns_contexts_change | 7 +---
81 tests/regression/ust/test_event_perf | 8 +----
82 tests/utils/utils.sh | 35 ++++++++++++++++++
83 47 files changed, 166 insertions(+), 363 deletions(-)
84
85diff --git a/tests/destructive/metadata-regeneration b/tests/destructive/metadata-regeneration
86index b81e7af32..36b130d17 100755
87--- a/tests/destructive/metadata-regeneration
88+++ b/tests/destructive/metadata-regeneration
89@@ -185,19 +185,13 @@ function test_ust_streaming ()
90 rm -f ${file_sync_before_last}
91 }
92
93-if [ "$(id -u)" == "0" ]; then
94- isroot=1
95-else
96- isroot=0
97-fi
98-
99 if ! destructive_tests_enabled ; then
100 echo 'You need to set the LTTNG_ENABLE_DESTRUCTIVE_TESTS to "will-break-my-system" as argument to run this test'
101 echo 'Moreover, please make sure that ntp is not running while executing this test'
102 exit 0
103 fi
104
105-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
106+check_skip_kernel_test $NUM_TESTS "Skipping all tests." ||
107 {
108 start_lttng_relayd "-o $TRACE_PATH"
109 start_lttng_sessiond
110diff --git a/tests/perf/test_perf_raw.in b/tests/perf/test_perf_raw.in
111index f293ccd71..d35529a87 100644
112--- a/tests/perf/test_perf_raw.in
113+++ b/tests/perf/test_perf_raw.in
114@@ -137,12 +137,6 @@ function test_kernel_raw()
115 rm -rf $TRACE_PATH
116 }
117
118-if [ "$(id -u)" == "0" ]; then
119- isroot=1
120-else
121- isroot=0
122-fi
123-
124 # MUST set TESTDIR before calling those functions
125 plan_tests $NUM_TESTS
126
127@@ -154,7 +148,7 @@ have_libpfm
128
129 test_ust_raw
130
131-skip $isroot "Root access is needed for kernel testing, skipping." 9 ||
132+check_skip_kernel_test 9 ||
133 {
134 modprobe lttng-test
135 test_kernel_raw
136diff --git a/tests/regression/kernel/test_all_events b/tests/regression/kernel/test_all_events
137index 2e20888df..044f9b65f 100755
138--- a/tests/regression/kernel/test_all_events
139+++ b/tests/regression/kernel/test_all_events
140@@ -43,13 +43,7 @@ plan_tests $NUM_TESTS
141
142 print_test_banner "$TEST_DESC"
143
144-if [ "$(id -u)" == "0" ]; then
145- isroot=1
146-else
147- isroot=0
148-fi
149-
150-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
151+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
152 {
153 validate_lttng_modules_present
154 start_lttng_sessiond
155diff --git a/tests/regression/kernel/test_callstack b/tests/regression/kernel/test_callstack
156index a4477fd7c..d8d6b5e0f 100755
157--- a/tests/regression/kernel/test_callstack
158+++ b/tests/regression/kernel/test_callstack
159@@ -134,13 +134,7 @@ plan_tests $NUM_TESTS
160
161 print_test_banner "$TEST_DESC"
162
163-if [ "$(id -u)" == "0" ]; then
164- isroot=1
165-else
166- isroot=0
167-fi
168-
169-skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" ||
170+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
171 {
172 validate_lttng_modules_present
173 start_lttng_sessiond
174diff --git a/tests/regression/kernel/test_channel b/tests/regression/kernel/test_channel
175index 9cc74c4e8..4c377bd2a 100755
176--- a/tests/regression/kernel/test_channel
177+++ b/tests/regression/kernel/test_channel
178@@ -47,13 +47,7 @@ function test_channel_buffer_too_large()
179 plan_tests $NUM_TESTS
180 print_test_banner "$TEST_DESC"
181
182-if [ "$(id -u)" == "0" ]; then
183- isroot=1
184-else
185- isroot=0
186-fi
187-
188-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
189+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
190 {
191 start_lttng_sessiond
192
193diff --git a/tests/regression/kernel/test_clock_override b/tests/regression/kernel/test_clock_override
194index 72892898b..48a3f926a 100755
195--- a/tests/regression/kernel/test_clock_override
196+++ b/tests/regression/kernel/test_clock_override
197@@ -172,13 +172,7 @@ TESTS=(
198 TEST_COUNT=${#TESTS[@]}
199 i=0
200
201-if [ "$(id -u)" == "0" ]; then
202- isroot=1
203-else
204- isroot=0
205-fi
206-
207-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
208+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
209 {
210 validate_lttng_modules_present
211 trap signal_cleanup SIGTERM SIGINT
212diff --git a/tests/regression/kernel/test_event_basic b/tests/regression/kernel/test_event_basic
213index ac9ec0549..387e2f733 100755
214--- a/tests/regression/kernel/test_event_basic
215+++ b/tests/regression/kernel/test_event_basic
216@@ -73,13 +73,7 @@ plan_tests $NUM_TESTS
217
218 print_test_banner "$TEST_DESC"
219
220-if [ "$(id -u)" == "0" ]; then
221- isroot=1
222-else
223- isroot=0
224-fi
225-
226-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
227+check_skip_kernel_test $NUM_TESTS "Skipping all tests." ||
228 {
229 validate_lttng_modules_present
230 start_lttng_sessiond
231diff --git a/tests/regression/kernel/test_kernel_function b/tests/regression/kernel/test_kernel_function
232index b1d5491fc..ea16cdeef 100755
233--- a/tests/regression/kernel/test_kernel_function
234+++ b/tests/regression/kernel/test_kernel_function
235@@ -43,13 +43,7 @@ plan_tests $NUM_TESTS
236
237 print_test_banner "$TEST_DESC"
238
239-if [ "$(id -u)" == "0" ]; then
240- isroot=1
241-else
242- isroot=0
243-fi
244-
245-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
246+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
247 {
248 start_lttng_sessiond_notap
249 validate_lttng_modules_present
250diff --git a/tests/regression/kernel/test_lttng_logger b/tests/regression/kernel/test_lttng_logger
251index b8f7ded82..00eaae823 100755
252--- a/tests/regression/kernel/test_lttng_logger
253+++ b/tests/regression/kernel/test_lttng_logger
254@@ -110,13 +110,7 @@ plan_tests $NUM_TESTS
255
256 print_test_banner "$TEST_DESC"
257
258-if [ "$(id -u)" == "0" ]; then
259- isroot=1
260-else
261- isroot=0
262-fi
263-
264-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
265+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
266 {
267 validate_lttng_modules_present
268 start_lttng_sessiond
269diff --git a/tests/regression/kernel/test_ns_contexts b/tests/regression/kernel/test_ns_contexts
270index 0c8718d78..59e2568f6 100755
271--- a/tests/regression/kernel/test_ns_contexts
272+++ b/tests/regression/kernel/test_ns_contexts
273@@ -108,13 +108,7 @@ plan_tests $NUM_TESTS
274 print_test_banner "$TEST_DESC"
275
276
277-isroot=0
278-if [ "$(id -u)" == "0" ]; then
279- isroot=1
280-fi
281-
282-skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0
283-
284+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." && exit 0
285
286 system_has_ns=0
287 if [ -d "/proc/$$/ns" ]; then
288diff --git a/tests/regression/kernel/test_ns_contexts_change b/tests/regression/kernel/test_ns_contexts_change
289index 42a61276b..3f5e4eeab 100755
290--- a/tests/regression/kernel/test_ns_contexts_change
291+++ b/tests/regression/kernel/test_ns_contexts_change
292@@ -162,14 +162,7 @@ plan_tests $NUM_TESTS
293
294 print_test_banner "$TEST_DESC"
295
296-
297-isroot=0
298-if [ "$(id -u)" == "0" ]; then
299- isroot=1
300-fi
301-
302-skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0
303-
304+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." && exit 0
305
306 system_has_ns=0
307 if [ -d "/proc/$$/ns" ]; then
308diff --git a/tests/regression/kernel/test_rotation_destroy_flush b/tests/regression/kernel/test_rotation_destroy_flush
309index cb773d7df..0af514b49 100755
310--- a/tests/regression/kernel/test_rotation_destroy_flush
311+++ b/tests/regression/kernel/test_rotation_destroy_flush
312@@ -120,13 +120,7 @@ TESTS=(
313 TEST_COUNT=${#TESTS[@]}
314 i=0
315
316-if [ "$(id -u)" == "0" ]; then
317- isroot=1
318-else
319- isroot=0
320-fi
321-
322-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
323+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
324 {
325 validate_lttng_modules_present
326 trap signal_cleanup SIGTERM SIGINT
327diff --git a/tests/regression/kernel/test_select_poll_epoll b/tests/regression/kernel/test_select_poll_epoll
328index d8245a0e7..20f0ef0ae 100755
329--- a/tests/regression/kernel/test_select_poll_epoll
330+++ b/tests/regression/kernel/test_select_poll_epoll
331@@ -374,13 +374,7 @@ if test $? != 0; then
332 exit 0
333 fi
334
335-if [ "$(id -u)" == "0" ]; then
336- isroot=1
337-else
338- isroot=0
339-fi
340-
341-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
342+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
343 {
344 validate_lttng_modules_present
345
346diff --git a/tests/regression/kernel/test_syscall b/tests/regression/kernel/test_syscall
347index 401a18a8d..219d94703 100755
348--- a/tests/regression/kernel/test_syscall
349+++ b/tests/regression/kernel/test_syscall
350@@ -664,13 +664,7 @@ plan_tests $NUM_TESTS
351
352 print_test_banner "$TEST_DESC"
353
354-if [ "$(id -u)" == "0" ]; then
355- isroot=1
356-else
357- isroot=0
358-fi
359-
360-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
361+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
362 {
363 validate_lttng_modules_present
364 start_lttng_sessiond
365diff --git a/tests/regression/kernel/test_userspace_probe b/tests/regression/kernel/test_userspace_probe
366index 1091ee65e..5d984d666 100755
367--- a/tests/regression/kernel/test_userspace_probe
368+++ b/tests/regression/kernel/test_userspace_probe
369@@ -815,13 +815,7 @@ fi
370 plan_tests $NUM_TESTS
371 print_test_banner "$TEST_DESC"
372
373-if [ "$(id -u)" == "0" ]; then
374- isroot=1
375-else
376- isroot=0
377-fi
378-
379-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
380+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
381 {
382 validate_lttng_modules_present
383 start_lttng_sessiond
384diff --git a/tests/regression/tools/clear/test_kernel b/tests/regression/tools/clear/test_kernel
385index 06fb1c368..48250a742 100755
386--- a/tests/regression/tools/clear/test_kernel
387+++ b/tests/regression/tools/clear/test_kernel
388@@ -536,12 +536,6 @@ plan_tests $NUM_TESTS
389
390 print_test_banner "$TEST_DESC"
391
392-if [ "$(id -u)" == "0" ]; then
393- isroot=1
394-else
395- isroot=0
396-fi
397-
398 streaming_tests=(test_kernel_streaming
399 test_kernel_streaming_rotate_clear
400 test_kernel_streaming_clear_rotate
401@@ -563,7 +557,7 @@ snapshot_tests=(test_kernel_streaming_snapshot
402 test_kernel_local_snapshot
403 )
404
405-skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
406+check_skip_kernel_test "$NUM_TESTS" "Skipping kernel streaming tests." ||
407 {
408 trap signal_cleanup SIGTERM SIGINT
409
410diff --git a/tests/regression/tools/filtering/test_invalid_filter b/tests/regression/tools/filtering/test_invalid_filter
411index 7d9e524d9..8435e5546 100755
412--- a/tests/regression/tools/filtering/test_invalid_filter
413+++ b/tests/regression/tools/filtering/test_invalid_filter
414@@ -168,13 +168,7 @@ done
415
416 test_bytecode_limit -u
417
418-if [ "$(id -u)" == "0" ]; then
419- isroot=1
420-else
421- isroot=0
422-fi
423-
424-skip $isroot "Root access is needed. Skipping all kernel invalid filter tests." $NUM_KERNEL_TESTS ||
425+check_skip_kernel_test "$NUM_KERNEL_TESTS" "Skipping kernel invalid filter tests." ||
426 {
427 diag "Test kernel filters"
428 i=0
429diff --git a/tests/regression/tools/filtering/test_unsupported_op b/tests/regression/tools/filtering/test_unsupported_op
430index 299247a3c..91eb86d21 100755
431--- a/tests/regression/tools/filtering/test_unsupported_op
432+++ b/tests/regression/tools/filtering/test_unsupported_op
433@@ -103,13 +103,7 @@ while [ "$i" -lt "$OP_COUNT" ]; do
434 let "i++"
435 done
436
437-if [ "$(id -u)" == "0" ]; then
438- isroot=1
439-else
440- isroot=0
441-fi
442-
443-skip $isroot "Root access is needed. Skipping all kernel unsupported filter operations tests." $NUM_KERNEL_TESTS ||
444+check_skip_kernel_test $NUM_KERNEL_TESTS "Skipping kernel unsupported filter operations tests." ||
445 {
446 diag "Test kernel unsupported filter operations"
447
448diff --git a/tests/regression/tools/filtering/test_valid_filter b/tests/regression/tools/filtering/test_valid_filter
449index e76ffa25f..1ba7c79bb 100755
450--- a/tests/regression/tools/filtering/test_valid_filter
451+++ b/tests/regression/tools/filtering/test_valid_filter
452@@ -1452,13 +1452,7 @@ KERNEL_FILTERS=(
453
454 IFS=$OLDIFS
455
456-if [ "$(id -u)" == "0" ]; then
457- isroot=1
458-else
459- isroot=0
460-fi
461-
462-skip $isroot "Root access is needed. Skipping all kernel valid filter tests." $NUM_KERNEL_TESTS ||
463+check_skip_kernel_test "$NUM_KERNEL_TESTS" "Skipping kernel valid filter tests." ||
464 {
465 diag "Test kernel valid filters"
466
467diff --git a/tests/regression/tools/health/test_health.sh b/tests/regression/tools/health/test_health.sh
468index b3d6419d2..68716e6b9 100644
469--- a/tests/regression/tools/health/test_health.sh
470+++ b/tests/regression/tools/health/test_health.sh
471@@ -82,7 +82,7 @@ function test_health
472 diag "With UST consumer daemons"
473 enable_ust_lttng_event_ok $SESSION_NAME $UST_EVENT_NAME $CHANNEL_NAME
474
475- skip $isroot "Root access is needed. Skipping kernel consumer health check test." "1" ||
476+ check_skip_kernel_test "1" "Skipping kernel consumer health check test." ||
477 {
478 diag "With kernel consumer daemon"
479 lttng_enable_kernel_event $SESSION_NAME $KERNEL_EVENT_NAME $CHANNEL_NAME
480@@ -113,7 +113,7 @@ function test_health
481
482
483 if [ ${test_needs_root} -eq 1 ]; then
484- skip ${isroot} "Root access needed for test \"${test_thread_name}\"." "1" ||
485+ check_skip_kernel_test "1" "Skipping \"${test_thread_name}\"." ||
486 {
487 report_errors "${test_thread_error_string}" "${test_relayd}"
488 }
489@@ -276,12 +276,6 @@ STDERR_PATH=$(mktemp --tmpdir tmp.test_health_stderr_path.XXXXXX)
490 TRACE_PATH=$(mktemp --tmpdir -d tmp.test_health_trace_path.XXXXXX)
491 HEALTH_PATH=$(mktemp --tmpdir -d tmp.test_health_trace_path.XXXXXX)
492
493-if [ "$(id -u)" == "0" ]; then
494- isroot=1
495-else
496- isroot=0
497-fi
498-
499 THREAD_COUNT=${#THREAD[@]}
500 i=0
501 while [ "$i" -lt "$THREAD_COUNT" ]; do
502diff --git a/tests/regression/tools/health/test_thread_ok b/tests/regression/tools/health/test_thread_ok
503index e84adb611..e5e23543f 100755
504--- a/tests/regression/tools/health/test_thread_ok
505+++ b/tests/regression/tools/health/test_thread_ok
506@@ -67,7 +67,7 @@ function test_thread_ok
507 $CURDIR/$HEALTH_CHECK_BIN > ${STDOUT_PATH} 2> ${STDERR_PATH}
508 report_errors
509
510- skip $isroot "Root access is needed. Skipping kernel consumer health check test." "5" ||
511+ check_skip_kernel_test "5" "Skipping kernel consumer health check test." ||
512 {
513 diag "With kernel consumer daemon"
514 create_lttng_session_no_output $SESSION_NAME
515@@ -115,13 +115,6 @@ STDERR_PATH=$(mktemp --tmpdir tmp.test_thread_ok_stderr_path.XXXXXX)
516 TRACE_PATH=$(mktemp --tmpdir -d tmp.test_thread_ok_trace_path.XXXXXX)
517 HEALTH_PATH=$(mktemp --tmpdir -d tmp.test_thread_ok_trace_path.XXXXXX)
518
519-# The manage kernel thread is only spawned if we are root
520-if [ "$(id -u)" == "0" ]; then
521- isroot=1
522-else
523- isroot=0
524-fi
525-
526 test_thread_ok
527
528 rm -rf ${HEALTH_PATH}
529diff --git a/tests/regression/tools/live/test_kernel b/tests/regression/tools/live/test_kernel
530index b622b5214..fdaa09f0d 100755
531--- a/tests/regression/tools/live/test_kernel
532+++ b/tests/regression/tools/live/test_kernel
533@@ -39,13 +39,11 @@ function clean_live_tracing()
534 rm -rf $TRACE_PATH
535 }
536
537-# Need root access for kernel tracing.
538-if [ "$(id -u)" == "0" ]; then
539- isroot=1
540-else
541- plan_skip_all "Root access is needed. Skipping all tests."
542+check_skip_kernel_test &&
543+{
544+ plan_skip_all "Skipping all tests."
545 exit 0
546-fi
547+}
548
549 modprobe lttng-test
550
551diff --git a/tests/regression/tools/live/test_lttng_kernel b/tests/regression/tools/live/test_lttng_kernel
552index a23d9373a..1b933648f 100755
553--- a/tests/regression/tools/live/test_lttng_kernel
554+++ b/tests/regression/tools/live/test_lttng_kernel
555@@ -45,13 +45,7 @@ function clean_live_tracing()
556 }
557
558 # Need root access for kernel tracing.
559-if [ "$(id -u)" == "0" ]; then
560- isroot=1
561-else
562- isroot=0
563-fi
564-
565-skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
566+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
567 {
568 modprobe lttng-test
569
570diff --git a/tests/regression/tools/metadata/test_kernel b/tests/regression/tools/metadata/test_kernel
571index 57cace6ea..26e95d93a 100755
572--- a/tests/regression/tools/metadata/test_kernel
573+++ b/tests/regression/tools/metadata/test_kernel
574@@ -91,13 +91,7 @@ plan_tests $NUM_TESTS
575 print_test_banner "$TEST_DESC"
576
577
578-if [ "$(id -u)" == "0" ]; then
579- isroot=1
580-else
581- isroot=0
582-fi
583-
584-skip $isroot "Root access is needed. Skipping all kernel metadata tests." $NUM_TESTS ||
585+check_skip_kernel_test "$NUM_TESTS" "Skipping kernel metadata tests." ||
586 {
587 validate_lttng_modules_present
588 modprobe lttng-test
589diff --git a/tests/regression/tools/notification/test_notification_kernel_buffer_usage b/tests/regression/tools/notification/test_notification_kernel_buffer_usage
590index 76e69a77e..8fdaabb3e 100755
591--- a/tests/regression/tools/notification/test_notification_kernel_buffer_usage
592+++ b/tests/regression/tools/notification/test_notification_kernel_buffer_usage
593@@ -60,29 +60,27 @@ function test_buffer_usage_notification
594 wait $APP_PID 2> /dev/null
595 }
596
597-if [ "$(id -u)" == "0" ]; then
598-
599- validate_lttng_modules_present
600-
601+check_skip_kernel_test &&
602+{
603+ plan_skip_all "Skipping all tests."
604+ rm -rf "$TEST_TMPDIR"
605+ exit 0
606+}
607
608- modprobe lttng-test
609+validate_lttng_modules_present
610
611- # Used on sessiond launch.
612- LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 \
613- CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} \
614- LD_PRELOAD=${TESTPOINT}"
615- start_lttng_sessiond_notap
616+modprobe lttng-test
617
618- test_buffer_usage_notification
619+# Used on sessiond launch.
620+LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 \
621+ CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} \
622+ LD_PRELOAD=${TESTPOINT}"
623+start_lttng_sessiond_notap
624
625- stop_lttng_sessiond_notap
626- rmmod lttng-test
627+test_buffer_usage_notification
628
629- rm -rf "${consumerd_pipe[@]}" 2> /dev/null
630-else
631- # Kernel tests are skipped.
632- plan_tests $NUM_TESTS
633- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
634-fi
635+stop_lttng_sessiond_notap
636+rmmod lttng-test
637
638+rm -rf "${consumerd_pipe[@]}" 2> /dev/null
639 rm -rf "$TEST_TMPDIR"
640diff --git a/tests/regression/tools/notification/test_notification_kernel_capture b/tests/regression/tools/notification/test_notification_kernel_capture
641index 88f123d3d..0f8a2bc6f 100755
642--- a/tests/regression/tools/notification/test_notification_kernel_capture
643+++ b/tests/regression/tools/notification/test_notification_kernel_capture
644@@ -31,22 +31,21 @@ function test_basic_error_path
645 }
646
647
648-if [ "$(id -u)" == "0" ]; then
649- validate_lttng_modules_present
650+check_skip_kernel_test &&
651+{
652+ plan_skip_all "Skipping all tests."
653+ exit 0
654+}
655
656- modprobe lttng-test
657+validate_lttng_modules_present
658
659- start_lttng_sessiond_notap
660+modprobe lttng-test
661
662- test_basic_error_path
663+start_lttng_sessiond_notap
664
665- stop_lttng_sessiond_notap
666- rmmod lttng-test
667+test_basic_error_path
668
669-else
670- # Kernel tests are skipped.
671- plan_tests $NUM_TESTS
672- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
673-fi
674+stop_lttng_sessiond_notap
675+rmmod lttng-test
676
677 rm -f "$TESTAPP_STATE_PATH"
678diff --git a/tests/regression/tools/notification/test_notification_kernel_error b/tests/regression/tools/notification/test_notification_kernel_error
679index 80fe6e5b5..b757ec2b4 100755
680--- a/tests/regression/tools/notification/test_notification_kernel_error
681+++ b/tests/regression/tools/notification/test_notification_kernel_error
682@@ -30,23 +30,22 @@ function test_basic_error_path
683 wait $APP_PID 2> /dev/null
684 }
685
686+check_skip_kernel_test &&
687+{
688+ plan_skip_all "Skipping all tests."
689+ exit 0
690+}
691
692-if [ "$(id -u)" == "0" ]; then
693- validate_lttng_modules_present
694+validate_lttng_modules_present
695
696- modprobe lttng-test
697+modprobe lttng-test
698
699- start_lttng_sessiond_notap
700+start_lttng_sessiond_notap
701
702- test_basic_error_path
703+test_basic_error_path
704
705- stop_lttng_sessiond_notap
706- rmmod lttng-test
707+stop_lttng_sessiond_notap
708+rmmod lttng-test
709
710-else
711- # Kernel tests are skipped.
712- plan_tests $NUM_TESTS
713- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
714-fi
715
716 rm -f "$TESTAPP_STATE_PATH"
717diff --git a/tests/regression/tools/notification/test_notification_kernel_instrumentation b/tests/regression/tools/notification/test_notification_kernel_instrumentation
718index 90545a541..705f7703d 100755
719--- a/tests/regression/tools/notification/test_notification_kernel_instrumentation
720+++ b/tests/regression/tools/notification/test_notification_kernel_instrumentation
721@@ -28,22 +28,21 @@ function test_kernel_instrumentation_notification
722 wait $APP_PID 2> /dev/null
723 }
724
725-if [ "$(id -u)" == "0" ]; then
726- validate_lttng_modules_present
727+check_skip_kernel_test &&
728+{
729+ plan_skip_all "Skipping all tests."
730+ exit 0
731+}
732
733- modprobe lttng-test
734+validate_lttng_modules_present
735
736- start_lttng_sessiond_notap
737+modprobe lttng-test
738
739- test_kernel_instrumentation_notification
740+start_lttng_sessiond_notap
741
742- stop_lttng_sessiond_notap
743- rmmod lttng-test
744+test_kernel_instrumentation_notification
745
746-else
747- # Kernel tests are skipped.
748- plan_tests $NUM_TESTS
749- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
750-fi
751+stop_lttng_sessiond_notap
752+rmmod lttng-test
753
754 rm -f "$TESTAPP_STATE_PATH"
755diff --git a/tests/regression/tools/notification/test_notification_kernel_syscall b/tests/regression/tools/notification/test_notification_kernel_syscall
756index d273cb55d..7fa235388 100755
757--- a/tests/regression/tools/notification/test_notification_kernel_syscall
758+++ b/tests/regression/tools/notification/test_notification_kernel_syscall
759@@ -31,19 +31,18 @@ function test_kernel_syscall_notification
760 wait $APP_PID 2> /dev/null
761 }
762
763-if [ "$(id -u)" == "0" ]; then
764- validate_lttng_modules_present
765+check_skip_kernel_test &&
766+{
767+ plan_skip_all "Skipping all tests."
768+ exit 0
769+}
770
771- start_lttng_sessiond_notap
772+validate_lttng_modules_present
773
774- test_kernel_syscall_notification
775+start_lttng_sessiond_notap
776
777- stop_lttng_sessiond_notap
778+test_kernel_syscall_notification
779
780-else
781- # Kernel tests are skipped.
782- plan_tests $NUM_TESTS
783- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
784-fi
785+stop_lttng_sessiond_notap
786
787 rm -f "$TESTAPP_STATE_PATH"
788diff --git a/tests/regression/tools/notification/test_notification_kernel_userspace_probe b/tests/regression/tools/notification/test_notification_kernel_userspace_probe
789index 8ef8d708d..abddd9be7 100755
790--- a/tests/regression/tools/notification/test_notification_kernel_userspace_probe
791+++ b/tests/regression/tools/notification/test_notification_kernel_userspace_probe
792@@ -29,18 +29,18 @@ function test_kernel_userspace_probe_notification
793 wait $APP_PID 2> /dev/null
794 }
795
796-if [ "$(id -u)" == "0" ]; then
797- validate_lttng_modules_present
798+check_skip_kernel_test &&
799+{
800+ plan_skip_all "Skipping all tests."
801+ exit 0
802+}
803+
804+validate_lttng_modules_present
805
806- start_lttng_sessiond_notap
807+start_lttng_sessiond_notap
808
809- test_kernel_userspace_probe_notification
810+test_kernel_userspace_probe_notification
811
812- stop_lttng_sessiond_notap
813-else
814- # Kernel tests are skipped.
815- plan_tests $NUM_TESTS
816- skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
817-fi
818+stop_lttng_sessiond_notap
819
820 rm -f "$TESTAPP_STATE_PATH"
821diff --git a/tests/regression/tools/notification/test_notification_multi_app b/tests/regression/tools/notification/test_notification_multi_app
822index d8b639225..61891b56f 100755
823--- a/tests/regression/tools/notification/test_notification_multi_app
824+++ b/tests/regression/tools/notification/test_notification_multi_app
825@@ -411,22 +411,18 @@ function test_on_register_evaluation ()
826 rm -rf "$output_dir"
827 }
828
829-
830 TESTS=(
831 test_multi_app_ust
832 test_on_register_evaluation_ust
833 )
834
835-if [ "$(id -u)" == "0" ]; then
836+check_skip_kernel_test "$NUM_TEST_KERNEL" "Skipping kernel multi-app notification tests." || {
837 validate_lttng_modules_present
838 TESTS+=(
839- test_multi_app_kernel
840- test_on_register_evaluation_kernel
841-)
842-else
843- skip 0 "Root access is needed. Skipping all kernel multi-app notification tests." $NUM_TEST_KERNEL
844-fi
845-
846+ test_multi_app_kernel
847+ test_on_register_evaluation_kernel
848+ )
849+}
850
851 for fct_test in ${TESTS[@]};
852 do
853diff --git a/tests/regression/tools/notification/test_notification_notifier_discarded_count b/tests/regression/tools/notification/test_notification_notifier_discarded_count
854index c9235393e..a6c31a728 100755
855--- a/tests/regression/tools/notification/test_notification_notifier_discarded_count
856+++ b/tests/regression/tools/notification/test_notification_notifier_discarded_count
857@@ -391,7 +391,8 @@ function test_ust_notifier_discarded_regardless_trigger_owner
858 test_ust_notifier_discarded_count
859 test_ust_notifier_discarded_count_max_bucket
860
861-if [ "$(id -u)" == "0" ]; then
862+check_skip_kernel_test "$KERNEL_NUM_TESTS" "Skipping kernel notification tests." ||
863+{
864
865 validate_lttng_modules_present
866
867@@ -413,9 +414,7 @@ if [ "$(id -u)" == "0" ]; then
868 modprobe --remove lttng-test
869
870 rm -rf "${sessiond_pipe[@]}" 2> /dev/null
871-else
872- # Kernel tests are skipped.
873- skip 0 "Root access is needed. Skipping all kernel notification tests." $KERNEL_NUM_TESTS
874-fi
875+
876+}
877
878 rm -rf "$TEST_TMPDIR"
879diff --git a/tests/regression/tools/regen-metadata/test_kernel b/tests/regression/tools/regen-metadata/test_kernel
880index 49eea32a7..555a4e2ce 100755
881--- a/tests/regression/tools/regen-metadata/test_kernel
882+++ b/tests/regression/tools/regen-metadata/test_kernel
883@@ -99,13 +99,7 @@ plan_tests $NUM_TESTS
884
885 print_test_banner "$TEST_DESC"
886
887-if [ "$(id -u)" == "0" ]; then
888- isroot=1
889-else
890- isroot=0
891-fi
892-
893-skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
894+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
895 {
896 validate_lttng_modules_present
897
898diff --git a/tests/regression/tools/regen-statedump/test_kernel b/tests/regression/tools/regen-statedump/test_kernel
899index 8a261355d..bbbac3942 100755
900--- a/tests/regression/tools/regen-statedump/test_kernel
901+++ b/tests/regression/tools/regen-statedump/test_kernel
902@@ -39,13 +39,7 @@ plan_tests $NUM_TESTS
903
904 print_test_banner "$TEST_DESC"
905
906-if [ "$(id -u)" == "0" ]; then
907- isroot=1
908-else
909- isroot=0
910-fi
911-
912-skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
913+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
914 {
915 validate_lttng_modules_present
916 start_lttng_sessiond
917diff --git a/tests/regression/tools/rotation/test_kernel b/tests/regression/tools/rotation/test_kernel
918index f5f1f5553..efe3fd359 100755
919--- a/tests/regression/tools/rotation/test_kernel
920+++ b/tests/regression/tools/rotation/test_kernel
921@@ -82,13 +82,7 @@ plan_tests $NUM_TESTS
922
923 print_test_banner "$TEST_DESC"
924
925-if [ "$(id -u)" == "0" ]; then
926- isroot=1
927-else
928- isroot=0
929-fi
930-
931-skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
932+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
933 {
934 validate_lttng_modules_present
935
936diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel
937index abb243563..d91876867 100755
938--- a/tests/regression/tools/snapshots/test_kernel
939+++ b/tests/regression/tools/snapshots/test_kernel
940@@ -217,13 +217,7 @@ plan_tests $NUM_TESTS
941
942 print_test_banner "$TEST_DESC"
943
944-if [ "$(id -u)" == "0" ]; then
945- isroot=1
946-else
947- isroot=0
948-fi
949-
950-skip $isroot "Root access is needed. Skipping all kernel snapshot tests" $NUM_TESTS ||
951+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
952 {
953
954 validate_lttng_modules_present
955diff --git a/tests/regression/tools/snapshots/test_kernel_streaming b/tests/regression/tools/snapshots/test_kernel_streaming
956index 0c92dc710..dd965afee 100755
957--- a/tests/regression/tools/snapshots/test_kernel_streaming
958+++ b/tests/regression/tools/snapshots/test_kernel_streaming
959@@ -145,13 +145,7 @@ plan_tests $NUM_TESTS
960
961 print_test_banner "$TEST_DESC"
962
963-if [ "$(id -u)" == "0" ]; then
964- isroot=1
965-else
966- isroot=0
967-fi
968-
969-skip $isroot "Root access is needed. Skipping all kernel streaming tests" $NUM_TESTS ||
970+check_skip_kernel_test $NUM_TESTS "Skipping all tests." ||
971 {
972 validate_lttng_modules_present
973
974diff --git a/tests/regression/tools/streaming/test_high_throughput_limits b/tests/regression/tools/streaming/test_high_throughput_limits
975index 2b9e3ad39..c55d51098 100755
976--- a/tests/regression/tools/streaming/test_high_throughput_limits
977+++ b/tests/regression/tools/streaming/test_high_throughput_limits
978@@ -170,13 +170,7 @@ plan_tests $NUM_TESTS
979
980 print_test_banner "$TEST_DESC"
981
982-if [ "$(id -u)" == "0" ]; then
983- isroot=1
984-else
985- isroot=0
986-fi
987-
988-skip $isroot "Root access is needed to set bandwith limits. Skipping all tests." $NUM_TESTS ||
989+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
990 {
991
992 # Catch sigint and try to cleanup limits
993diff --git a/tests/regression/tools/streaming/test_kernel b/tests/regression/tools/streaming/test_kernel
994index 33334229f..113eea7bf 100755
995--- a/tests/regression/tools/streaming/test_kernel
996+++ b/tests/regression/tools/streaming/test_kernel
997@@ -47,13 +47,7 @@ plan_tests $NUM_TESTS
998
999 print_test_banner "$TEST_DESC"
1000
1001-if [ "$(id -u)" == "0" ]; then
1002- isroot=1
1003-else
1004- isroot=0
1005-fi
1006-
1007-skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
1008+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
1009 {
1010 validate_lttng_modules_present
1011
1012diff --git a/tests/regression/tools/tracker/test_event_tracker b/tests/regression/tools/tracker/test_event_tracker
1013index cc0f698d2..de0c79d36 100755
1014--- a/tests/regression/tools/tracker/test_event_tracker
1015+++ b/tests/regression/tools/tracker/test_event_tracker
1016@@ -466,13 +466,7 @@ test_event_track_untrack ust 0 "${EVENT_NAME}" "--pid --all" # backward compat
1017 test_event_tracker ust 1 "${EVENT_NAME}" "--pid --all" # backward compat
1018 test_event_pid_tracker ust 1 "${EVENT_NAME}"
1019
1020-if [ "$(id -u)" == "0" ]; then
1021- isroot=1
1022-else
1023- isroot=0
1024-fi
1025-
1026-skip $isroot "Root access is needed. Skipping all kernel tracker tests." $NUM_KERNEL_TESTS ||
1027+check_skip_kernel_test "$NUM_KERNEL_TESTS" "Skipping kernel tracker tests." ||
1028 {
1029 diag "Test kernel tracker"
1030
1031diff --git a/tests/regression/tools/trigger/test_add_trigger_cli b/tests/regression/tools/trigger/test_add_trigger_cli
1032index 98ecf6272..d1763aa2e 100755
1033--- a/tests/regression/tools/trigger/test_add_trigger_cli
1034+++ b/tests/regression/tools/trigger/test_add_trigger_cli
1035@@ -34,12 +34,6 @@ tmp_stdout=$(mktemp --tmpdir -t test_parse_cli_trigger_stdout.XXXXXX)
1036 tmp_stderr=$(mktemp --tmpdir -t test_parse_cli_trigger_stderr.XXXXXX)
1037 uprobe_elf_binary="${TESTDIR}/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary"
1038
1039-if [ "$(id -u)" == "0" ]; then
1040- ist_root=1
1041-else
1042- ist_root=0
1043-fi
1044-
1045 function test_success ()
1046 {
1047 local test_name="$1"
1048@@ -223,7 +217,7 @@ test_success "--exclude-name two" "trigger5" \
1049 --condition event-rule-matches --type=user --name='jean-*' --exclude-name jean-chretien -x jean-charest \
1050 --action notify
1051
1052-skip $ist_root "non-root user: skipping kprobe tests" 18 || {
1053+check_skip_kernel_test 18 "Skipping kprobe tests." || {
1054 i=0
1055
1056 for type in kprobe kernel:kprobe; do
1057@@ -262,7 +256,7 @@ skip $ist_root "non-root user: skipping kprobe tests" 18 || {
1058 done
1059 }
1060
1061-skip $ist_root "non-root user: skipping uprobe tests" 6 || {
1062+check_skip_kernel_test 6 "Skipping uprobe tests." || {
1063 test_success "--condition event-rule-matches uprobe" "uprobe-trigger-0" \
1064 --name="uprobe-trigger-0" \
1065 --condition event-rule-matches --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe \
1066@@ -274,7 +268,7 @@ skip $ist_root "non-root user: skipping uprobe tests" 6 || {
1067 --action notify
1068 }
1069
1070-skip $ist_root "non-root user: skipping syscall tests" 30 || {
1071+check_skip_kernel_test 30 "Skipping syscall tests." || {
1072 test_success "--condition event-rule-matches one syscall" "syscall-trigger-0" \
1073 --name="syscall-trigger-0" \
1074 --condition event-rule-matches --type=syscall --name=open \
1075diff --git a/tests/regression/tools/trigger/test_list_triggers_cli b/tests/regression/tools/trigger/test_list_triggers_cli
1076index a04018013..02c3de3e9 100755
1077--- a/tests/regression/tools/trigger/test_list_triggers_cli
1078+++ b/tests/regression/tools/trigger/test_list_triggers_cli
1079@@ -36,22 +36,12 @@ uprobe_sdt_binary=$(realpath "${TESTDIR}/utils/testapp/userspace-probe-sdt-binar
1080 register_some_triggers_bin=$(realpath "${CURDIR}/utils/register-some-triggers")
1081
1082 uid=$(id --user)
1083-gid=$(id --group)
1084
1085-if [ "$uid" == "0" ]; then
1086- ist_root=1
1087- ls "$uprobe_sdt_binary" >/dev/null 2>&1
1088- if test $? == 0; then
1089- hast_sdt_binary=1
1090- else
1091- hast_sdt_binary=0
1092- fi
1093-else
1094- ist_root=0
1095- hast_sdt_binary=0
1096+sdt_binary_present=0
1097+if [ -f "$uprobe_sdt_binary" ]; then
1098+ sdt_binary_present=1
1099 fi
1100
1101-
1102 test_top_level_options ()
1103 {
1104 diag "Listing top level options"
1105@@ -2695,10 +2685,12 @@ start_lttng_sessiond_notap
1106
1107 test_top_level_options
1108 test_event_rule_matches_tracepoint
1109-skip $ist_root "non-root user: skipping kprobe tests" 13 || test_event_rule_matches_probe
1110-skip $ist_root "non-root user: skipping uprobe tests" 9 || test_event_rule_matches_userspace_probe_elf
1111-skip $(($ist_root && $hast_sdt_binary)) "skipping userspace probe SDT tests" 9 || test_event_rule_matches_userspace_probe_sdt
1112-skip $ist_root "non-root user: skipping syscall tests" 17 || test_event_rule_matches_syscall
1113+check_skip_kernel_test 48 "Skipping kprobe, uprobe, SDT and syscall tests." || {
1114+ test_event_rule_matches_probe
1115+ test_event_rule_matches_userspace_probe_elf
1116+ skip $sdt_binary_present "No SDT binary. Skipping userspace probe SDT tests" 9 || test_event_rule_matches_userspace_probe_sdt
1117+ test_event_rule_matches_syscall
1118+}
1119 test_session_consumed_size_condition
1120 test_buffer_usage_conditions
1121 test_session_rotation_conditions
1122diff --git a/tests/regression/tools/wildcard/test_event_wildcard b/tests/regression/tools/wildcard/test_event_wildcard
1123index f69baffc4..14d9bb88a 100755
1124--- a/tests/regression/tools/wildcard/test_event_wildcard
1125+++ b/tests/regression/tools/wildcard/test_event_wildcard
1126@@ -124,13 +124,7 @@ test_event_wildcard ust 1 'tp*tptest'
1127 test_event_wildcard ust 1 'tp**tptest'
1128 test_event_wildcard ust 1 'tp*test'
1129
1130-if [ "$(id -u)" == "0" ]; then
1131- isroot=1
1132-else
1133- isroot=0
1134-fi
1135-
1136-skip $isroot "Root access is needed. Skipping all kernel wildcard tests." $NUM_KERNEL_TESTS ||
1137+check_skip_kernel_test "$NUM_KERNEL_TESTS" "Skipping kernel wildcard tests." ||
1138 {
1139 diag "Test kernel wildcards"
1140
1141diff --git a/tests/regression/tools/working-directory/test_relayd_working_directory b/tests/regression/tools/working-directory/test_relayd_working_directory
1142index c7e784cca..6bd1e504a 100755
1143--- a/tests/regression/tools/working-directory/test_relayd_working_directory
1144+++ b/tests/regression/tools/working-directory/test_relayd_working_directory
1145@@ -145,9 +145,9 @@ function test_relayd_debug_permission()
1146 diag "Test lttng-relayd change working directory on non writable directory"
1147
1148 if [ "$(id -u)" == "0" ]; then
1149- is_user=0
1150+ is_user=0
1151 else
1152- is_user=1
1153+ is_user=1
1154 fi
1155
1156 skip $is_user "Skipping permission debug output test; operation can't fail as root" 6 ||
1157diff --git a/tests/regression/ust/namespaces/test_ns_contexts_change b/tests/regression/ust/namespaces/test_ns_contexts_change
1158index 8a4b62ce3..622241f7b 100755
1159--- a/tests/regression/ust/namespaces/test_ns_contexts_change
1160+++ b/tests/regression/ust/namespaces/test_ns_contexts_change
1161@@ -101,12 +101,7 @@ plan_tests $NUM_TESTS
1162
1163 print_test_banner "$TEST_DESC"
1164
1165-isroot=0
1166-if [ "$(id -u)" == "0" ]; then
1167- isroot=1
1168-fi
1169-
1170-skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" && exit 0
1171+check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." && exit 0
1172
1173 system_has_ns=0
1174 if [ -d "/proc/$$/ns" ]; then
1175diff --git a/tests/regression/ust/test_event_perf b/tests/regression/ust/test_event_perf
1176index 33aab2981..178959a19 100755
1177--- a/tests/regression/ust/test_event_perf
1178+++ b/tests/regression/ust/test_event_perf
1179@@ -119,17 +119,11 @@ plan_tests $NUM_TESTS
1180
1181 print_test_banner "$TEST_DESC"
1182
1183-if [ "$(id -u)" == "0" ]; then
1184- isroot=1
1185-else
1186- isroot=0
1187-fi
1188-
1189 start_lttng_sessiond
1190
1191 test_parsing_raw
1192
1193-skip $isroot "Root access is needed. Skipping UST perf tests." 8 ||
1194+check_skip_kernel_test 8 "Skipping UST perf tests." ||
1195 {
1196 test_event_basic
1197 }
1198diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh
1199index faa87e783..da0e0569d 100644
1200--- a/tests/utils/utils.sh
1201+++ b/tests/utils/utils.sh
1202@@ -318,6 +318,41 @@ function conf_proc_count()
1203 echo
1204 }
1205
1206+# Usage:
1207+# check_skip_kernel_test [NB_TESTS] [SKIP_MESSAGE]
1208+# Return 0 if LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set or the current user is not a root user
1209+# If NB_TESTS is set, call skip() to skip number of tests.
1210+# If NB_TESTS is empty, just output a reason with diag.
1211+# An optional message can be added.
1212+
1213+function check_skip_kernel_test ()
1214+{
1215+ local num_tests="$1"
1216+ local skip_message="$2"
1217+
1218+ # Check for skip test kernel flag
1219+ if [ "$LTTNG_TOOLS_DISABLE_KERNEL_TESTS" == "1" ]; then
1220+ if ! test -z "$num_tests"; then
1221+ skip 0 "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set.${skip_message+ }${skip_message}" "$num_tests"
1222+ else
1223+ diag "LTTNG_TOOLS_DISABLE_KERNEL_TESTS was set.${skip_message+ }${skip_message}"
1224+ fi
1225+ return 0
1226+ fi
1227+
1228+ # Check if we are running as root
1229+ if [ "$(id -u)" != "0" ]; then
1230+ if ! test -z "$num_tests"; then
1231+ skip 0 "Root access is needed for kernel testing.${skip_message+ }${skip_message}" "$num_tests"
1232+ else
1233+ diag "Root access is needed for kernel testing.${skip_message+ }${skip_message}"
1234+ fi
1235+ return 0
1236+ fi
1237+
1238+ return 1
1239+}
1240+
1241 # Check if base lttng-modules are present.
1242 # Bail out on failure
1243 function validate_lttng_modules_present ()
1244--
12452.25.1
1246
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-do-not-strip-a-helper-library.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-do-not-strip-a-helper-library.patch
index 2d08b08879..2f95889c4b 100644
--- a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-do-not-strip-a-helper-library.patch
+++ b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-do-not-strip-a-helper-library.patch
@@ -1,4 +1,4 @@
1From ab238c213fac190972f55e73cf3e0bb1c7846eb8 Mon Sep 17 00:00:00 2001 1From 2237748af00467ad8250a7ccd944200f811db69a Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com> 2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Thu, 12 Dec 2019 16:52:07 +0100 3Date: Thu, 12 Dec 2019 16:52:07 +0100
4Subject: [PATCH] tests: do not strip a helper library 4Subject: [PATCH] tests: do not strip a helper library
@@ -10,10 +10,10 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
10 1 file changed, 1 insertion(+), 1 deletion(-) 10 1 file changed, 1 insertion(+), 1 deletion(-)
11 11
12diff --git a/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am b/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am 12diff --git a/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am b/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am
13index 03f5d5a..d12c343 100644 13index 836f13e..e19a554 100644
14--- a/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am 14--- a/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am
15+++ b/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am 15+++ b/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am
16@@ -12,7 +12,7 @@ userspace_probe_elf_binary_LDADD = libfoo.la 16@@ -14,7 +14,7 @@ userspace_probe_elf_binary_LDADD = libfoo.la
17 libfoo.strip: libfoo.la 17 libfoo.strip: libfoo.la
18 $(OBJCOPY) --strip-all .libs/libfoo.so 18 $(OBJCOPY) --strip-all .libs/libfoo.so
19 19
@@ -22,6 +22,3 @@ index 03f5d5a..d12c343 100644
22 @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ 22 @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
23 for script in $(EXTRA_DIST); do \ 23 for script in $(EXTRA_DIST); do \
24 cp -f $(srcdir)/$$script $(builddir); \ 24 cp -f $(srcdir)/$$script $(builddir); \
25--
262.17.1
27
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-regression-disable-the-tools-live-tests.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-regression-disable-the-tools-live-tests.patch
deleted file mode 100644
index 08c1423310..0000000000
--- a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-regression-disable-the-tools-live-tests.patch
+++ /dev/null
@@ -1,55 +0,0 @@
1From de9fc501e775cae05f1f87534b4237cd78e8d9a8 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Fri, 24 Jan 2020 18:03:25 +0100
4Subject: [PATCH] tests/regression: disable the tools/live tests
5
6They have been found to sporadically fail; the issue has been
7reported upstream and they will work to investigate and fix:
8https://bugs.lttng.org/issues/1217
9
10Upstream-Status: Inappropriate [upstream is working on a real fix]
11Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
12
13---
14 tests/regression/Makefile.am | 10 +---------
15 1 file changed, 1 insertion(+), 9 deletions(-)
16
17diff --git a/tests/regression/Makefile.am b/tests/regression/Makefile.am
18index cbac90d..d467886 100644
19--- a/tests/regression/Makefile.am
20+++ b/tests/regression/Makefile.am
21@@ -11,16 +11,10 @@ TESTS = tools/filtering/test_invalid_filter \
22 tools/filtering/test_valid_filter \
23 tools/streaming/test_ust \
24 tools/health/test_thread_ok \
25- tools/live/test_ust \
26- tools/live/test_ust_tracefile_count \
27- tools/live/test_lttng_ust \
28 tools/tracefile-limits/test_tracefile_count \
29 tools/tracefile-limits/test_tracefile_size \
30- tools/exclusion/test_exclusion \
31 tools/snapshots/test_ust_fast \
32- tools/snapshots/test_ust_streaming \
33 tools/save-load/test_save \
34- tools/save-load/test_load \
35 tools/save-load/test_autoload \
36 tools/mi/test_mi \
37 tools/wildcard/test_event_wildcard \
38@@ -38,8 +32,7 @@ TESTS = tools/filtering/test_invalid_filter \
39 tools/working-directory/test_relayd_working_directory \
40 tools/notification/test_notification_multi_app \
41 tools/clear/test_ust \
42- tools/clear/test_kernel \
43- tools/tracker/test_event_tracker
44+ tools/clear/test_kernel
45
46 if HAVE_LIBLTTNG_UST_CTL
47 SUBDIRS += ust
48@@ -60,7 +53,6 @@ TESTS += ust/before-after/test_before_after \
49 ust/multi-lib/test_multi_lib \
50 ust/rotation-destroy-flush/test_rotation_destroy_flush \
51 ust/namespaces/test_ns_contexts \
52- ust/namespaces/test_ns_contexts_change \
53 tools/metadata/test_ust \
54 tools/relayd-grouping/test_ust
55 endif # HAVE_LIBLTTNG_UST_CTL
diff --git a/meta/recipes-kernel/lttng/lttng-tools/disable-tests.patch b/meta/recipes-kernel/lttng/lttng-tools/disable-tests.patch
new file mode 100644
index 0000000000..3a77ea2e43
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-tools/disable-tests.patch
@@ -0,0 +1,34 @@
1Upstream-Status: Inappropriate [need to root cause the test hangs]
2
3We keep seeing hangs in the tools/notifications tests on x86 and arm for
4a variety of distros. Exclude them for now to work out if this is the
5only place we see them and give SWAT/triage a break from the stream
6of them.
7
8https://bugzilla.yoctoproject.org/show_bug.cgi?id=14263
9
10Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
11
12Index: lttng-tools-2.13.1/tests/regression/Makefile.am
13===================================================================
14--- lttng-tools-2.13.1.orig/tests/regression/Makefile.am
15+++ lttng-tools-2.13.1/tests/regression/Makefile.am
16@@ -29,18 +29,6 @@ TESTS = tools/base-path/test_ust \
17 tools/crash/test_crash \
18 tools/regen-metadata/test_ust \
19 tools/regen-statedump/test_ust \
20- tools/notification/test_notification_ust_error \
21- tools/notification/test_notification_ust_buffer_usage \
22- tools/notification/test_notification_ust_capture \
23- tools/notification/test_notification_ust_event_rule_condition_exclusion \
24- tools/notification/test_notification_kernel_error \
25- tools/notification/test_notification_kernel_buffer_usage \
26- tools/notification/test_notification_kernel_capture \
27- tools/notification/test_notification_kernel_instrumentation \
28- tools/notification/test_notification_kernel_syscall \
29- tools/notification/test_notification_notifier_discarded_count \
30- tools/notification/test_notification_kernel_userspace_probe \
31- tools/notification/test_notification_multi_app \
32 tools/rotation/test_ust \
33 tools/rotation/test_kernel \
34 tools/rotation/test_save_load_mi \
diff --git a/meta/recipes-kernel/lttng/lttng-tools/run-ptest b/meta/recipes-kernel/lttng/lttng-tools/run-ptest
index eaa2e7b29d..39d93e2bbf 100755
--- a/meta/recipes-kernel/lttng/lttng-tools/run-ptest
+++ b/meta/recipes-kernel/lttng/lttng-tools/run-ptest
@@ -1,6 +1,45 @@
1#!/bin/sh 1#!/bin/sh
2# Without --ignore-exit, the tap harness causes any FAILs within a 2# Without --ignore-exit, the tap harness causes any FAILs within a
3# test plan to raise ERRORs; this is just noise. 3# test plan to raise ERRORs; this is just noise.
4makeargs="LOG_DRIVER_FLAGS=--ignore-exit top_srcdir=$PWD top_builddir=$PWD" 4
5make -k -t all >/dev/null 2>&1 5#Detecting whether current system has lttng kernel modules
6exec make -k -s $makeargs check 2>/dev/null | sed -e 's#/tmp/tmp\...........#/tmp/tmp.XXXXXXXXXX#g' 6LTTNG_KMOD_PATH=/lib/modules/$(uname -r)/kernel/lttng-modules/lttng-tracer.ko
7function validate_lttng_modules_present()
8{
9 # Check for loadable modules.
10 if [ -f "$LTTNG_KMOD_PATH" ]; then
11 return 0
12 fi
13
14 # Check for builtin modules.
15 ls /proc/lttng > /dev/null 2>&1
16 if [ $? -eq 0 ]; then
17 return 0
18 fi
19
20 return 1
21}
22
23export LD_LIBRARY_PATH=FIXMEPTESTPATH/tests/utils/testapp/userspace-probe-elf-binary/.libs
24makeargs="LOG_DRIVER_FLAGS=--ignore-exit top_srcdir=FIXMEPTESTPATH top_builddir=FIXMEPTESTPATH"
25
26#If current system doesn't have lttng kernel modules, disable lttng kernel related tests.
27validate_lttng_modules_present || {
28 makeargs="$makeargs LTTNG_TOOLS_DISABLE_KERNEL_TESTS=1"
29}
30
31make -k -t all >error.log 2>&1
32# Can specify a test e.g.:
33# -C tests/regression/ check TESTS='kernel/test_callstack'
34make -k -s $makeargs check 2>error.log | sed -e 's#/tmp/tmp\...........#/tmp/tmp.XXXXXXXXXX#g'
35exitcode=$?
36if [ -e error.log ]; then
37 cat error.log
38fi
39if [ -e tests/unit/test-suite.log ]; then
40 cat tests/unit/test-suite.log
41fi
42if [ -e tests/regression/test-suite.log ]; then
43 cat tests/regression/test-suite.log
44fi
45exit $exitcode
diff --git a/meta/recipes-kernel/lttng/lttng-tools_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-tools_2.13.13.bb
index 0787e04d19..e73dd4801a 100644
--- a/meta/recipes-kernel/lttng/lttng-tools_2.12.2.bb
+++ b/meta/recipes-kernel/lttng/lttng-tools_2.13.13.bb
@@ -3,28 +3,29 @@ SUMMARY = "Linux Trace Toolkit Control"
3DESCRIPTION = "The Linux trace toolkit is a suite of tools designed \ 3DESCRIPTION = "The Linux trace toolkit is a suite of tools designed \
4to extract program execution details from the Linux operating system \ 4to extract program execution details from the Linux operating system \
5and interpret them." 5and interpret them."
6HOMEPAGE = "https://github.com/lttng/lttng-tools"
6 7
7LICENSE = "GPLv2 & LGPLv2.1" 8LICENSE = "GPL-2.0-only & LGPL-2.1-only"
8LIC_FILES_CHKSUM = "file://LICENSE;md5=40ef17463fbd6f377db3c47b1cbaded8 \ 9LIC_FILES_CHKSUM = "file://LICENSE;md5=40ef17463fbd6f377db3c47b1cbaded8 \
9 file://LICENSES/GPL-2.0;md5=e68f69a54b44ba526ad7cb963e18fbce \ 10 file://LICENSES/GPL-2.0;md5=e68f69a54b44ba526ad7cb963e18fbce \
10 file://LICENSES/LGPL-2.1;md5=9920968d0f2ff585ce61fae30344dd95" 11 file://LICENSES/LGPL-2.1;md5=9920968d0f2ff585ce61fae30344dd95"
11 12
12include lttng-platforms.inc 13include lttng-platforms.inc
13 14
14DEPENDS = "liburcu popt libxml2 util-linux" 15DEPENDS = "liburcu popt libxml2 util-linux bison-native"
15RDEPENDS_${PN} = "libgcc" 16RDEPENDS:${PN} = "libgcc"
16RRECOMMENDS_${PN} += "${LTTNGMODULES}" 17RRECOMMENDS:${PN} += "${LTTNGMODULES}"
17RDEPENDS_${PN}-ptest += "make perl bash gawk babeltrace procps perl-module-overloading coreutils util-linux kmod ${LTTNGMODULES} sed python3-core" 18RDEPENDS:${PN}-ptest += "make perl bash gawk babeltrace procps perl-module-overloading coreutils util-linux kmod ${LTTNGMODULES} sed python3-core grep binutils"
18RDEPENDS_${PN}-ptest_append_libc-glibc = " glibc-utils" 19RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils"
19RDEPENDS_${PN}-ptest_append_libc-musl = " musl-utils" 20RDEPENDS:${PN}-ptest:append:libc-musl = " musl-utils"
20# babelstats.pl wants getopt-long 21# babelstats.pl wants getopt-long
21RDEPENDS_${PN}-ptest += "perl-module-getopt-long" 22RDEPENDS:${PN}-ptest += "perl-module-getopt-long"
22 23
23PYTHON_OPTION = "am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \ 24PYTHON_OPTION = "am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \
24 am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \ 25 am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \
25 PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \ 26 PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \
26" 27"
27PACKAGECONFIG ??= "${LTTNGUST}" 28PACKAGECONFIG ??= "${LTTNGUST} kmod"
28PACKAGECONFIG[python] = "--enable-python-bindings ${PYTHON_OPTION},,python3 swig-native" 29PACKAGECONFIG[python] = "--enable-python-bindings ${PYTHON_OPTION},,python3 swig-native"
29PACKAGECONFIG[lttng-ust] = "--with-lttng-ust, --without-lttng-ust, lttng-ust" 30PACKAGECONFIG[lttng-ust] = "--with-lttng-ust, --without-lttng-ust, lttng-ust"
30PACKAGECONFIG[kmod] = "--with-kmod, --without-kmod, kmod" 31PACKAGECONFIG[kmod] = "--with-kmod, --without-kmod, kmod"
@@ -34,47 +35,59 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
34 file://0001-tests-do-not-strip-a-helper-library.patch \ 35 file://0001-tests-do-not-strip-a-helper-library.patch \
35 file://run-ptest \ 36 file://run-ptest \
36 file://lttng-sessiond.service \ 37 file://lttng-sessiond.service \
37 file://0001-tests-regression-disable-the-tools-live-tests.patch \ 38 file://disable-tests.patch \
39 file://0001-compat-Define-off64_t-as-off_t-on-linux.patch \
40 file://0001-tests-add-check_skip_kernel_test-to-check-root-user-.patch \
41 file://0001-Fix-rotation-destroy-flush-fix-session-daemon-abort-.patch \
38 " 42 "
39 43
40SRC_URI[sha256sum] = "9ed9161795ff023b076f9f95afaa4f1f822ec42495c0fa04c586ab8fa74e84f1" 44SRC_URI[sha256sum] = "ff5f4f00b081dac66092afe8e72b7c790670931cf1c1ee0deaa7f80fbc53883e"
41 45
42inherit autotools ptest pkgconfig useradd python3-dir manpages systemd 46inherit autotools ptest pkgconfig useradd python3-dir manpages systemd
43 47
44SYSTEMD_SERVICE_${PN} = "lttng-sessiond.service" 48CACHED_CONFIGUREVARS = "PGREP=/usr/bin/pgrep"
49
50SYSTEMD_SERVICE:${PN} = "lttng-sessiond.service"
45SYSTEMD_AUTO_ENABLE = "disable" 51SYSTEMD_AUTO_ENABLE = "disable"
46 52
47USERADD_PACKAGES = "${PN}" 53USERADD_PACKAGES = "${PN}"
48GROUPADD_PARAM_${PN} = "tracing" 54GROUPADD_PARAM:${PN} = "tracing"
49 55
50FILES_${PN} += "${libdir}/lttng/libexec/* ${datadir}/xml/lttng \ 56FILES:${PN} += "${libdir}/lttng/libexec/* ${datadir}/xml/lttng \
51 ${PYTHON_SITEPACKAGES_DIR}/*" 57 ${PYTHON_SITEPACKAGES_DIR}/*"
52FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" 58FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
53FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la" 59FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la"
54 60
55# Since files are installed into ${libdir}/lttng/libexec we match 61# Since files are installed into ${libdir}/lttng/libexec we match
56# the libexec insane test so skip it. 62# the libexec insane test so skip it.
57# Python module needs to keep _lttng.so 63# Python module needs to keep _lttng.so
58INSANE_SKIP_${PN} = "libexec dev-so" 64INSANE_SKIP:${PN} = "libexec dev-so"
59INSANE_SKIP_${PN}-dbg = "libexec" 65INSANE_SKIP:${PN}-dbg = "libexec"
60 66
61PRIVATE_LIBS_${PN}-ptest = "libfoo.so" 67PRIVATE_LIBS:${PN}-ptest = "libfoo.so"
62 68
63do_install_append () { 69do_install:append () {
64 # install systemd unit file 70 # install systemd unit file
65 install -d ${D}${systemd_unitdir}/system 71 install -d ${D}${systemd_system_unitdir}
66 install -m 0644 ${WORKDIR}/lttng-sessiond.service ${D}${systemd_unitdir}/system 72 install -m 0644 ${UNPACKDIR}/lttng-sessiond.service ${D}${systemd_system_unitdir}
67} 73}
68 74
69do_install_ptest () { 75do_install_ptest () {
70 for f in Makefile tests/Makefile tests/utils/utils.sh tests/regression/tools/save-load/load-42*.lttng tests/regression/tools/save-load/configuration/load-42*.lttng tests/regression/tools/health/test_health.sh tests/regression/tools/metadata/utils.sh tests/regression/tools/rotation/rotate_utils.sh; do 76 for f in Makefile tests/Makefile tests/utils/utils.sh tests/regression/tools/save-load/*.lttng \
77 tests/regression/tools/save-load/configuration/load-42*.lttng tests/regression/tools/health/test_health.sh \
78 tests/regression/tools/metadata/utils.sh tests/regression/tools/rotation/rotate_utils.sh \
79 tests/regression/tools/notification/util_event_generator.sh \
80 tests/regression/tools/base-path/*.lttng; do
71 install -D "${B}/$f" "${D}${PTEST_PATH}/$f" 81 install -D "${B}/$f" "${D}${PTEST_PATH}/$f"
72 done 82 done
73 83
74 for f in config/tap-driver.sh config/test-driver src/common/config/session.xsd src/common/mi-lttng-4.0.xsd; do 84 for f in tests/utils/tap-driver.sh config/test-driver src/common/config/session.xsd src/common/mi-lttng-4.1.xsd; do
75 install -D "${S}/$f" "${D}${PTEST_PATH}/$f" 85 install -D "${S}/$f" "${D}${PTEST_PATH}/$f"
76 done 86 done
77 87
88 # Patch in the correct path for the custom libraries a helper executable needs
89 sed -i -e 's!FIXMEPTESTPATH!${PTEST_PATH}!g' "${D}${PTEST_PATH}/run-ptest"
90
78 # Prevent 'make check' from recursing into non-test subdirectories. 91 # Prevent 'make check' from recursing into non-test subdirectories.
79 sed -i -e 's!^SUBDIRS = .*!SUBDIRS = tests!' "${D}${PTEST_PATH}/Makefile" 92 sed -i -e 's!^SUBDIRS = .*!SUBDIRS = tests!' "${D}${PTEST_PATH}/Makefile"
80 93
@@ -102,7 +115,7 @@ do_install_ptest () {
102 for f in $(find "${B}/tests/$d" -maxdepth 1 -executable -type f -printf '%P ') ; do 115 for f in $(find "${B}/tests/$d" -maxdepth 1 -executable -type f -printf '%P ') ; do
103 cp ${B}/tests/$d/$f ${D}${PTEST_PATH}/tests/`dirname $d`/$f 116 cp ${B}/tests/$d/$f ${D}${PTEST_PATH}/tests/`dirname $d`/$f
104 case $f in 117 case $f in
105 *.so) 118 *.so|userspace-probe-elf-*)
106 install -d ${D}${PTEST_PATH}/tests/$d/ 119 install -d ${D}${PTEST_PATH}/tests/$d/
107 ln -s ../$f ${D}${PTEST_PATH}/tests/$d/$f 120 ln -s ../$f ${D}${PTEST_PATH}/tests/$d/$f
108 # Remove any rpath/runpath to pass QA check. 121 # Remove any rpath/runpath to pass QA check.
@@ -113,6 +126,9 @@ do_install_ptest () {
113 done 126 done
114 127
115 chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary 128 chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary
129 chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary
130 chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libbar.so
131 chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libfoo.so
116 132
117 # 133 #
118 # Use the versioned libs of liblttng-ust-dl. 134 # Use the versioned libs of liblttng-ust-dl.
@@ -150,6 +166,10 @@ do_install_ptest () {
150 -e 's#\(^test.*LDADD.=\)#disable\1#g' \ 166 -e 's#\(^test.*LDADD.=\)#disable\1#g' \
151 -i ${D}${PTEST_PATH}/tests/unit/Makefile 167 -i ${D}${PTEST_PATH}/tests/unit/Makefile
152 168
169 # Fix hardcoded build path
170 sed -e 's#TESTAPP_PATH=.*/tests/regression/#TESTAPP_PATH="${PTEST_PATH}/tests/regression/#' \
171 -i ${D}${PTEST_PATH}/tests/regression/ust/python-logging/test_python_logging
172
153 # Substitute links to installed binaries. 173 # Substitute links to installed binaries.
154 for prog in lttng lttng-relayd lttng-sessiond lttng-consumerd lttng-crash; do 174 for prog in lttng lttng-relayd lttng-sessiond lttng-consumerd lttng-crash; do
155 exedir="${D}${PTEST_PATH}/src/bin/${prog}" 175 exedir="${D}${PTEST_PATH}/src/bin/${prog}"
@@ -164,3 +184,14 @@ do_install_ptest () {
164 esac 184 esac
165 done 185 done
166} 186}
187
188INHIBIT_PACKAGE_STRIP_FILES = "\
189 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary \
190 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary \
191 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary \
192 ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/.libs/userspace-probe-elf-cxx-binary \
193 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/gen-syscall-events \
194 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/.libs/gen-syscall-events \
195 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack \
196 ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/.libs/gen-syscall-events-callstack \
197 "
diff --git a/meta/recipes-kernel/lttng/lttng-ust/0001-Makefile.am-update-rpath-link.patch b/meta/recipes-kernel/lttng/lttng-ust/0001-Makefile.am-update-rpath-link.patch
new file mode 100644
index 0000000000..6aca8f85fa
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-ust/0001-Makefile.am-update-rpath-link.patch
@@ -0,0 +1,33 @@
1From 7d053804ab3823d40ae10d90f4efc49dbfb4cb66 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Wed, 22 Sep 2021 16:33:10 +0800
4Subject: [PATCH] Makefile.am: update rpath link
5
6since commit 6339062 Move liblttng-ust to 'src/lib/',
7liblttng-ust.so/liblttng-ust-common.so/liblttng-ust-tracepoint.so
8's location changed from one dir to multiple dirs. which make below
9error:
10ld: warning: liblttng-ust-common.so.1, needed by ../../../src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link)
11ld: warning: liblttng-ust-tracepoint.so.1, needed by ../../../src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link)
12
13Upstream-Status: Submitted [https://github.com/lttng/lttng-ust/pull/61]
14
15Signed-off-by: Changqing Li <changqing.li@windriver.com>
16
17---
18 doc/examples/Makefile.am | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
22index 57782cc..d46caa6 100644
23--- a/doc/examples/Makefile.am
24+++ b/doc/examples/Makefile.am
25@@ -167,7 +167,7 @@ all-local:
26 CFLAGS='$(CFLAGS)' \
27 AM_CFLAGS='$(AM_CFLAGS)' \
28 LDFLAGS="$(LDFLAGS)" \
29- AM_LDFLAGS='$(AM_LDFLAGS) -L../../../src/lib/lttng-ust/.libs -Wl,-rpath="$(PWD)/../../src/lib/lttng-ust/.libs/" -Wl,-rpath-link="$(PWD)/../../src/lib/lttng-ust/.libs/"' \
30+ AM_LDFLAGS='$(AM_LDFLAGS) -L../../../src/lib/lttng-ust/.libs -Wl,-rpath="$(PWD)/../../src/lib/lttng-ust/.libs/" -Wl,-rpath-link="$(PWD)/../../src/lib/lttng-ust/.libs/:$(PWD)/../../src/lib/lttng-ust-tracepoint/.libs:$(PWD)/../../src/lib/lttng-ust-common/.libs/"' \
31 LTTNG_GEN_TP_PATH="$$rel_src_subdir$(top_srcdir)/tools/" \
32 AM_V_P="$(AM_V_P)" \
33 AM_V_at="$(AM_V_at)" \
diff --git a/meta/recipes-kernel/lttng/lttng-ust/0001-lttng-ust-common-link-with-liburcu-explicitly.patch b/meta/recipes-kernel/lttng/lttng-ust/0001-lttng-ust-common-link-with-liburcu-explicitly.patch
new file mode 100644
index 0000000000..e85dbdb439
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-ust/0001-lttng-ust-common-link-with-liburcu-explicitly.patch
@@ -0,0 +1,26 @@
1From 27402453f25fbdb5a9fb1a1b88d1c4d9852187d2 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex@linutronix.de>
3Date: Sun, 5 Sep 2021 10:44:19 +0200
4Subject: [PATCH] lttng-ust-common: link with liburcu explicitly
5
6Otherwise linking errors are seen on x86-32.
7
8Upstream-Status: Submitted [by email to lttng-dev, Francis, Jonathan]
9Signed-off-by: Alexander Kanavin <alex@linutronix.de>
10
11---
12 src/lib/lttng-ust-common/Makefile.am | 1 +
13 1 file changed, 1 insertion(+)
14
15diff --git a/src/lib/lttng-ust-common/Makefile.am b/src/lib/lttng-ust-common/Makefile.am
16index 1ccc290..6531fa0 100644
17--- a/src/lib/lttng-ust-common/Makefile.am
18+++ b/src/lib/lttng-ust-common/Makefile.am
19@@ -16,6 +16,7 @@ liblttng_ust_common_la_SOURCES = \
20
21 liblttng_ust_common_la_LIBADD = \
22 $(top_builddir)/src/common/libcommon.la \
23+ $(URCU_LIBS) \
24 $(DL_LIBS)
25
26 liblttng_ust_common_la_LDFLAGS = -no-undefined -version-info $(LTTNG_UST_LIBRARY_VERSION)
diff --git a/meta/recipes-kernel/lttng/lttng-ust/0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch b/meta/recipes-kernel/lttng/lttng-ust/0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch
index c2028d0e1a..7c49583e0d 100644
--- a/meta/recipes-kernel/lttng/lttng-ust/0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch
+++ b/meta/recipes-kernel/lttng/lttng-ust/0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch
@@ -1,6 +1,6 @@
1From f79dac30af9adda12996da7f6aa6667d3b580537 Mon Sep 17 00:00:00 2001 1From f65efd963e52de51d35e2e03fb773f33dd64f565 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com> 2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Thu, 26 Sep 2019 17:54:00 +0800 3Date: Tue, 20 Feb 2024 12:19:06 +0000
4Subject: [PATCH] python-lttngust/Makefile.am: Add --install-lib to setup.py 4Subject: [PATCH] python-lttngust/Makefile.am: Add --install-lib to setup.py
5 5
6Otherwise it may install to /usr/lib, but should be /usr/lib64 when cross 6Otherwise it may install to /usr/lib, but should be /usr/lib64 when cross
@@ -9,23 +9,21 @@ building.
9Upstream-Status: Submitted [https://github.com/lttng/lttng-ust/pull/59] 9Upstream-Status: Submitted [https://github.com/lttng/lttng-ust/pull/59]
10 10
11Signed-off-by: Robert Yang <liezhi.yang@windriver.com> 11Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
12
12--- 13---
13 python-lttngust/Makefile.am | 2 +- 14 src/python-lttngust/Makefile.am | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-) 15 1 file changed, 1 insertion(+), 1 deletion(-)
15 16
16diff --git a/python-lttngust/Makefile.am b/python-lttngust/Makefile.am 17diff --git a/src/python-lttngust/Makefile.am b/src/python-lttngust/Makefile.am
17index 6c0d20d..38b51b8 100644 18index d53e21d..283901e 100644
18--- a/python-lttngust/Makefile.am 19--- a/src/python-lttngust/Makefile.am
19+++ b/python-lttngust/Makefile.am 20+++ b/src/python-lttngust/Makefile.am
20@@ -9,7 +9,7 @@ install-exec-local: 21@@ -45,7 +45,7 @@ install-exec-local: build-python-bindings.stamp
21 if [ "$(DESTDIR)" != "" ]; then \ 22 if [ "$(DESTDIR)" != "" ]; then \
22 opts="$$opts --root=$(DESTDIR)"; \ 23 opts="$$opts --root=$(DESTDIR)"; \
23 fi; \ 24 fi; \
24- $(PYTHON) setup.py install $$opts; 25- $(PYTHON) $(builddir)/setup.py install $(PY_INSTALL_OPTS) $$opts;
25+ $(PYTHON) setup.py install $$opts --install-lib=$(pythondir); 26+ $(PYTHON) $(builddir)/setup.py install $(PY_INSTALL_OPTS) $$opts --install-lib=$(pythondir);
26 27
27 clean-local: 28 clean-local:
28 rm -rf $(builddir)/build 29 rm -rf $(builddir)/build
29--
302.7.4
31
diff --git a/meta/recipes-kernel/lttng/lttng-ust_2.12.0.bb b/meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb
index 67a4307c7b..dddd3a5004 100644
--- a/meta/recipes-kernel/lttng/lttng-ust_2.12.0.bb
+++ b/meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb
@@ -3,38 +3,38 @@ DESCRIPTION = "The LTTng UST 2.x package contains the userspace tracer library t
3HOMEPAGE = "http://lttng.org/ust" 3HOMEPAGE = "http://lttng.org/ust"
4BUGTRACKER = "https://bugs.lttng.org/projects/lttng-ust" 4BUGTRACKER = "https://bugs.lttng.org/projects/lttng-ust"
5 5
6LICENSE = "LGPLv2.1+ & MIT & GPLv2" 6LICENSE = "LGPL-2.1-or-later & MIT & GPL-2.0-only"
7LIC_FILES_CHKSUM = "file://COPYING;md5=c963eb366b781252b0bf0fdf1624d9e9 \ 7LIC_FILES_CHKSUM = "file://LICENSE;md5=a46577a38ad0c36ff6ff43ccf40c480f"
8 file://snprintf/snprintf.c;endline=32;md5=d3d544959d8a3782b2e07451be0a903c \
9 file://snprintf/various.h;endline=31;md5=89f2509b6b4682c4fc95255eec4abe44"
10 8
11PYTHON_OPTION = "am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \ 9PYTHON_OPTION = "am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \
12 am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \ 10 am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \
13 PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \ 11 PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \
14" 12"
15 13
16inherit autotools lib_package manpages python3native 14inherit autotools lib_package manpages python3native pkgconfig
17 15
18include lttng-platforms.inc 16include lttng-platforms.inc
19 17
20EXTRA_OECONF = "--disable-numa" 18EXTRA_OECONF = "--disable-numa"
19CPPFLAGS:append:arm = "${@oe.utils.vartrue('DEBUG_BUILD', '-DUATOMIC_NO_LINK_ERROR', '', d)}"
21 20
22DEPENDS = "liburcu util-linux" 21DEPENDS = "liburcu util-linux"
23RDEPENDS_${PN}-bin = "python3-core" 22RDEPENDS:${PN}-bin = "python3-core"
24 23
25# For backwards compatibility after rename 24# For backwards compatibility after rename
26RPROVIDES_${PN} = "lttng2-ust" 25RPROVIDES:${PN} = "lttng2-ust"
27RREPLACES_${PN} = "lttng2-ust" 26RREPLACES:${PN} = "lttng2-ust"
28RCONFLICTS_${PN} = "lttng2-ust" 27RCONFLICTS:${PN} = "lttng2-ust"
29 28
30PE = "2" 29PE = "2"
31 30
32SRC_URI = "https://lttng.org/files/lttng-ust/lttng-ust-${PV}.tar.bz2 \ 31SRC_URI = "https://lttng.org/files/lttng-ust/lttng-ust-${PV}.tar.bz2 \
33 file://0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch \ 32 file://0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch \
33 file://0001-lttng-ust-common-link-with-liburcu-explicitly.patch \
34 file://0001-Makefile.am-update-rpath-link.patch \
34 " 35 "
35 36
36SRC_URI[md5sum] = "3bf4a04c305271d13cf6596c4e7b9b3c" 37SRC_URI[sha256sum] = "d4ef98dab9a37ad4f524ccafdfd50af4f266039b528dd5afabce78e49024d937"
37SRC_URI[sha256sum] = "1983edb525f3f27e3494088d8d5389b4c71af66bbfe63c6f1df2ad95aa44a528"
38 38
39CVE_PRODUCT = "ust" 39CVE_PRODUCT = "ust"
40 40
@@ -42,11 +42,11 @@ PACKAGECONFIG[examples] = "--enable-examples, --disable-examples,"
42PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages, asciidoc-native xmlto-native libxslt-native" 42PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages, asciidoc-native xmlto-native libxslt-native"
43PACKAGECONFIG[python3-agent] = "--enable-python-agent ${PYTHON_OPTION}, --disable-python-agent, python3, python3" 43PACKAGECONFIG[python3-agent] = "--enable-python-agent ${PYTHON_OPTION}, --disable-python-agent, python3, python3"
44 44
45FILES_${PN} += " ${PYTHON_SITEPACKAGES_DIR}/*" 45FILES:${PN} += " ${PYTHON_SITEPACKAGES_DIR}/*"
46FILES_${PN}-staticdev += " ${PYTHON_SITEPACKAGES_DIR}/*.a" 46FILES:${PN}-staticdev += " ${PYTHON_SITEPACKAGES_DIR}/*.a"
47FILES_${PN}-dev += " ${PYTHON_SITEPACKAGES_DIR}/*.la" 47FILES:${PN}-dev += " ${PYTHON_SITEPACKAGES_DIR}/*.la"
48 48
49do_install_append() { 49do_install:append() {
50 # Patch python tools to use Python 3; they should be source compatible, but 50 # Patch python tools to use Python 3; they should be source compatible, but
51 # still refer to Python 2 in the shebang 51 # still refer to Python 2 in the shebang
52 sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${bindir}/lttng-gen-tp 52 sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${bindir}/lttng-gen-tp