Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,74 @@
From 74b3844737b03492756b4f896c938b504b069f14 Mon Sep 17 00:00:00 2001
From: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Date: Tue, 17 Jan 2023 16:57:35 -0500
Subject: [PATCH] compat: off64_t is not defined by musl
This helps compile with latest musl, where off64_t is not defined unless
_LARGEFILE64_SOURCE is defined. On glibc, _LARGEFILE64_SOURCE is defined
if _GNU_SOURCE is defined, so the problem is only seen with musl.
Since the project uses AC_SYS_LARGEFILE, which from the autoconf doc:
"arrange for 64-bit file offsets, known as large-file support."
As such, it is safe to assume off_t is 64-bit wide. This is checked by a
static_assert to catch any platform where autoconf would let a 32-bit
off_t slip.
Upstream-Status: Submitted [https://review.lttng.org/c/lttng-tools/+/9268]
Reported-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If2c6007a8c85bc3f3065002af8a7538b882fb4a8
---
--- a/src/common/compat/compat-fcntl.c
+++ b/src/common/compat/compat-fcntl.c
@@ -8,14 +8,17 @@
#define _LGPL_SOURCE
#include <common/compat/fcntl.h>
#include <common/macros.h>
+#include <common/bug.h>
+#include <stdint.h>
#include <unistd.h>
#ifdef __linux__
LTTNG_HIDDEN
-int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
+int compat_sync_file_range(int fd, off_t offset, off_t nbytes,
unsigned int flags)
{
+ LTTNG_BUILD_BUG_ON(sizeof(off_t) != sizeof(int64_t));
#ifdef HAVE_SYNC_FILE_RANGE
return sync_file_range(fd, offset, nbytes, flags);
#else
--- a/src/common/compat/fcntl.h
+++ b/src/common/compat/fcntl.h
@@ -13,16 +13,12 @@
#include <common/compat/errno.h>
-#if (defined(__CYGWIN__))
-typedef long long off64_t;
-#endif
-
#if (defined(__FreeBSD__) || defined(__sun__))
typedef off64_t loff_t;
#endif
#ifdef __linux__
-extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
+extern int compat_sync_file_range(int fd, off_t offset, off_t nbytes,
unsigned int flags);
#define lttng_sync_file_range(fd, offset, nbytes, flags) \
compat_sync_file_range(fd, offset, nbytes, flags)
@@ -37,8 +33,8 @@ extern int compat_sync_file_range(int fd
#define SYNC_FILE_RANGE_WAIT_BEFORE 0
#define SYNC_FILE_RANGE_WRITE 0
-static inline int lttng_sync_file_range(int fd, off64_t offset,
- off64_t nbytes, unsigned int flags)
+static inline int lttng_sync_file_range(int fd, off_t offset,
+ off_t nbytes, unsigned int flags)
{
return -ENOSYS;
}
@@ -0,0 +1,27 @@
From ab238c213fac190972f55e73cf3e0bb1c7846eb8 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 12 Dec 2019 16:52:07 +0100
Subject: [PATCH] tests: do not strip a helper library
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
tests/utils/testapp/userspace-probe-elf-binary/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am b/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am
index 03f5d5a..d12c343 100644
--- a/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am
+++ b/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am
@@ -12,7 +12,7 @@ userspace_probe_elf_binary_LDADD = libfoo.la
libfoo.strip: libfoo.la
$(OBJCOPY) --strip-all .libs/libfoo.so
-all-local: libfoo.strip
+all-local:
@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
for script in $(EXTRA_DIST); do \
cp -f $(srcdir)/$$script $(builddir); \
--
2.17.1
@@ -0,0 +1,48 @@
From 40b2a4a793c81221a28f822d07135069456ea021 Mon Sep 17 00:00:00 2001
From: Olivier Dion <odion@efficios.com>
Date: Fri, 10 Mar 2023 13:17:46 -0500
Subject: [PATCH] Tests: fix: parse-callback reports missing addr2line
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
Upstream-Status: Backport
addr2line from binutils is required for this script to work correctly.
However, it silently fails. Fix this by using `subprocess.run' with
`check=True' instead of `subprocess.getoutput'. That way, an exception
is raised if an error occurs.
Fix the shebang by not assuming where python is installed while at it.
Change-Id: I5157b3dbccf6bfbe08a6b6840b38f5db9010fe96
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
---
tests/utils/parse-callstack.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/utils/parse-callstack.py b/tests/utils/parse-callstack.py
index 3bfddd9ef..c3f0e2e9b 100755
--- a/tests/utils/parse-callstack.py
+++ b/tests/utils/parse-callstack.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
#
# Copyright (C) 2017 Francis Deslauriers <francis.deslauriers@efficios.com>
#
@@ -24,7 +24,9 @@ def addr2line(executable, addr):
# Expand inlined functions
cmd += ['--addresses', addr]
- addr2line_output = subprocess.getoutput(' '.join(cmd))
+ status = subprocess.run(cmd, stdout=subprocess.PIPE, check=True)
+
+ addr2line_output = status.stdout.decode("utf-8")
# Omit the last 2 lines as the caller of main can not be determine
fcts = [addr2line_output.split()[-2]]
--
2.34.1
@@ -0,0 +1,34 @@
Upstream-Status: Inappropriate [need to root cause the test hangs]
We keep seeing hangs in the tools/notifications tests on x86 and arm for
a variety of distros. Exclude them for now to work out if this is the
only place we see them and give SWAT/triage a break from the stream
of them.
https://bugzilla.yoctoproject.org/show_bug.cgi?id=14263
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Index: lttng-tools-2.13.1/tests/regression/Makefile.am
===================================================================
--- lttng-tools-2.13.1.orig/tests/regression/Makefile.am
+++ lttng-tools-2.13.1/tests/regression/Makefile.am
@@ -29,18 +29,6 @@ TESTS = tools/base-path/test_ust \
tools/crash/test_crash \
tools/regen-metadata/test_ust \
tools/regen-statedump/test_ust \
- tools/notification/test_notification_ust_error \
- tools/notification/test_notification_ust_buffer_usage \
- tools/notification/test_notification_ust_capture \
- tools/notification/test_notification_ust_event_rule_condition_exclusion \
- tools/notification/test_notification_kernel_error \
- tools/notification/test_notification_kernel_buffer_usage \
- tools/notification/test_notification_kernel_capture \
- tools/notification/test_notification_kernel_instrumentation \
- tools/notification/test_notification_kernel_syscall \
- tools/notification/test_notification_notifier_discarded_count \
- tools/notification/test_notification_kernel_userspace_probe \
- tools/notification/test_notification_multi_app \
tools/rotation/test_ust \
tools/rotation/test_kernel \
tools/rotation/test_save_load_mi \
@@ -0,0 +1,107 @@
From 844be4dc46deeec83199da80e9e2a6058e9f5a53 Mon Sep 17 00:00:00 2001
From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?=
<jeremie.galarneau@efficios.com>
Date: Thu, 25 May 2023 19:15:20 -0400
Subject: [PATCH] Tests fix: test_callstack: output of addr2line incorrectly
parsed
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
Upstream-Status: Backport
Issue observed
--------------
The test_callstack test fails with GCC 13.1 with the following output:
Traceback (most recent call last):
File "/usr/lib/lttng-tools/ptest/tests/regression/././kernel//../../utils/parse-callstack.py", line 160, in <module>
main()
File "/usr/lib/lttng-tools/ptest/tests/regression/././kernel//../../utils/parse-callstack.py", line 155, in main
raise Exception('Expected function name not found in recorded callstack')
Exception: Expected function name not found in recorded callstack
ok 10 - Destroy session callstack
PASS: kernel/test_callstack 10 - Destroy session callstack
not ok 11 - Validate userspace callstack
FAIL: kernel/test_callstack 11 - Validate userspace callstack
Cause
-----
parse-callstack.py uses 'split()' to split the lines of addr2line's
output. By default, 'split()' splits a string on any whitespace.
Typically this was fine as addr2line's output doesn't contain spaces and
the function then splits on new lines.
Typical output of addr2line:
$ addr2line -e ./tests/regression/kernel//../../utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack --functions --addresses 0x40124B
0x000000000040124b
my_gettid
/tmp/test-callstack-master/src/lttng-tools/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c:40
However, with the test app compiled using gcc 13.1, a "discriminator"
annotation is present:
0x0000000000401279
fct_b
/tmp/test-callstack-master/src/lttng-tools/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c:58 (discriminator 1)
Hence, by selecting the second to last element (-2, with negative
indexing), the addr2line function returns '(discriminator' as the
function name.
Solution
--------
The parsing code is changed to simply iterate on groups of 3 lines,
following addr2line's output format.
Fixes #1377
Change-Id: I8c1eab97e84ca7cad171904bed6660540061cf08
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
---
tests/utils/parse-callstack.py | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/tests/utils/parse-callstack.py b/tests/utils/parse-callstack.py
index c3f0e2e9bc..029100b618 100755
--- a/tests/utils/parse-callstack.py
+++ b/tests/utils/parse-callstack.py
@@ -26,14 +26,23 @@ def addr2line(executable, addr):
status = subprocess.run(cmd, stdout=subprocess.PIPE, check=True)
- addr2line_output = status.stdout.decode("utf-8")
-
- # Omit the last 2 lines as the caller of main can not be determine
- fcts = [addr2line_output.split()[-2]]
-
- fcts = [ f for f in fcts if '??' not in f]
-
- return fcts
+ addr2line_output = status.stdout.decode("utf-8").splitlines()
+ # addr2line's output is made of 3-tuples:
+ # - address
+ # - function name
+ # - source location
+ if len(addr2line_output) % 3 != 0:
+ raise Exception('Unexpected addr2line output:\n\t{}'.format('\n\t'.join(addr2line_output)))
+
+ function_names = []
+ for address_line_number in range(0, len(addr2line_output), 3):
+ function_name = addr2line_output[address_line_number + 1]
+
+ # Filter-out unresolved functions
+ if "??" not in function_name:
+ function_names.append(addr2line_output[address_line_number + 1])
+
+ return function_names
def extract_user_func_names(executable, raw_callstack):
"""
--
2.34.1
@@ -0,0 +1,9 @@
[Unit]
Description=LTTng 2.x central tracing registry session daemon
[Service]
Type=forking
ExecStart=/usr/bin/lttng-sessiond -d
[Install]
WantedBy=multi-user.target
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
# Without --ignore-exit, the tap harness causes any FAILs within a
# test plan to raise ERRORs; this is just noise.
export LD_LIBRARY_PATH=FIXMEPTESTPATH/tests/utils/testapp/userspace-probe-elf-binary/.libs
makeargs="LOG_DRIVER_FLAGS=--ignore-exit top_srcdir=FIXMEPTESTPATH top_builddir=FIXMEPTESTPATH"
make -k -t all >error.log 2>&1
# Can specify a test e.g.:
# -C tests/regression/ check TESTS='kernel/test_callstack'
make -k -s $makeargs check 2>error.log | sed -e 's#/tmp/tmp\...........#/tmp/tmp.XXXXXXXXXX#g'
exitcode=$?
if [ -e error.log ]; then
cat error.log
fi
if [ -e tests/unit/test-suite.log ]; then
cat tests/unit/test-suite.log
fi
if [ -e tests/regression/test-suite.log ]; then
cat tests/regression/test-suite.log
fi
exit $exitcode