summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-05-25 23:16:35 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-05-26 07:54:17 +0100
commit47d33683a12409db454dbbcaa5e3f2253d16e90c (patch)
tree949b06d5b42a8523a0270eef4faa86455ec15dde
parentd52d7f524bea8f67580218ce5bfbc69036d6a9f5 (diff)
downloadpoky-47d33683a12409db454dbbcaa5e3f2253d16e90c.tar.gz
lttng-tools: Add patch to fix gcc 13 test issue
Add a couple of patches from upstream which fix a failing test with gcc 13. (From OE-Core rev: 9148de637f565578a96e8c02bad765ce3daffe27) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/40b2a4a793c81221a28f822d07135069456ea021.patch48
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/gcc13-ptest-fix.patch107
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools_2.13.9.bb2
3 files changed, 157 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-tools/40b2a4a793c81221a28f822d07135069456ea021.patch b/meta/recipes-kernel/lttng/lttng-tools/40b2a4a793c81221a28f822d07135069456ea021.patch
new file mode 100644
index 0000000000..e338eaff2b
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-tools/40b2a4a793c81221a28f822d07135069456ea021.patch
@@ -0,0 +1,48 @@
1From 40b2a4a793c81221a28f822d07135069456ea021 Mon Sep 17 00:00:00 2001
2From: Olivier Dion <odion@efficios.com>
3Date: Fri, 10 Mar 2023 13:17:46 -0500
4Subject: [PATCH] Tests: fix: parse-callback reports missing addr2line
5MIME-Version: 1.0
6Content-Type: text/plain; charset=utf8
7Content-Transfer-Encoding: 8bit
8
9Upstream-Status: Backport
10
11addr2line from binutils is required for this script to work correctly.
12However, it silently fails. Fix this by using `subprocess.run' with
13`check=True' instead of `subprocess.getoutput'. That way, an exception
14is raised if an error occurs.
15
16Fix the shebang by not assuming where python is installed while at it.
17
18Change-Id: I5157b3dbccf6bfbe08a6b6840b38f5db9010fe96
19Signed-off-by: Olivier Dion <odion@efficios.com>
20Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
21---
22 tests/utils/parse-callstack.py | 6 ++++--
23 1 file changed, 4 insertions(+), 2 deletions(-)
24
25diff --git a/tests/utils/parse-callstack.py b/tests/utils/parse-callstack.py
26index 3bfddd9ef..c3f0e2e9b 100755
27--- a/tests/utils/parse-callstack.py
28+++ b/tests/utils/parse-callstack.py
29@@ -1,4 +1,4 @@
30-#!/usr/bin/python3
31+#!/usr/bin/env python3
32 #
33 # Copyright (C) 2017 Francis Deslauriers <francis.deslauriers@efficios.com>
34 #
35@@ -24,7 +24,9 @@ def addr2line(executable, addr):
36 # Expand inlined functions
37 cmd += ['--addresses', addr]
38
39- addr2line_output = subprocess.getoutput(' '.join(cmd))
40+ status = subprocess.run(cmd, stdout=subprocess.PIPE, check=True)
41+
42+ addr2line_output = status.stdout.decode("utf-8")
43
44 # Omit the last 2 lines as the caller of main can not be determine
45 fcts = [addr2line_output.split()[-2]]
46--
472.34.1
48
diff --git a/meta/recipes-kernel/lttng/lttng-tools/gcc13-ptest-fix.patch b/meta/recipes-kernel/lttng/lttng-tools/gcc13-ptest-fix.patch
new file mode 100644
index 0000000000..52c4ec9f8e
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-tools/gcc13-ptest-fix.patch
@@ -0,0 +1,107 @@
1From 844be4dc46deeec83199da80e9e2a6058e9f5a53 Mon Sep 17 00:00:00 2001
2From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?=
3 <jeremie.galarneau@efficios.com>
4Date: Thu, 25 May 2023 19:15:20 -0400
5Subject: [PATCH] Tests fix: test_callstack: output of addr2line incorrectly
6 parsed
7MIME-Version: 1.0
8Content-Type: text/plain; charset=utf8
9Content-Transfer-Encoding: 8bit
10
11Upstream-Status: Backport
12
13Issue observed
14--------------
15
16The test_callstack test fails with GCC 13.1 with the following output:
17
18 Traceback (most recent call last):
19 File "/usr/lib/lttng-tools/ptest/tests/regression/././kernel//../../utils/parse-callstack.py", line 160, in <module>
20 main()
21 File "/usr/lib/lttng-tools/ptest/tests/regression/././kernel//../../utils/parse-callstack.py", line 155, in main
22 raise Exception('Expected function name not found in recorded callstack')
23 Exception: Expected function name not found in recorded callstack
24 ok 10 - Destroy session callstack
25 PASS: kernel/test_callstack 10 - Destroy session callstack
26 not ok 11 - Validate userspace callstack
27 FAIL: kernel/test_callstack 11 - Validate userspace callstack
28
29Cause
30-----
31
32parse-callstack.py uses 'split()' to split the lines of addr2line's
33output. By default, 'split()' splits a string on any whitespace.
34Typically this was fine as addr2line's output doesn't contain spaces and
35the function then splits on new lines.
36
37Typical output of addr2line:
38
39 $ addr2line -e ./tests/regression/kernel//../../utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack --functions --addresses 0x40124B
40 0x000000000040124b
41 my_gettid
42 /tmp/test-callstack-master/src/lttng-tools/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c:40
43
44However, with the test app compiled using gcc 13.1, a "discriminator"
45annotation is present:
46
47 0x0000000000401279
48 fct_b
49 /tmp/test-callstack-master/src/lttng-tools/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack.c:58 (discriminator 1)
50
51Hence, by selecting the second to last element (-2, with negative
52indexing), the addr2line function returns '(discriminator' as the
53function name.
54
55Solution
56--------
57
58The parsing code is changed to simply iterate on groups of 3 lines,
59following addr2line's output format.
60
61Fixes #1377
62
63Change-Id: I8c1eab97e84ca7cad171904bed6660540061cf08
64Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
65---
66 tests/utils/parse-callstack.py | 25 +++++++++++++++++--------
67 1 file changed, 17 insertions(+), 8 deletions(-)
68
69diff --git a/tests/utils/parse-callstack.py b/tests/utils/parse-callstack.py
70index c3f0e2e9bc..029100b618 100755
71--- a/tests/utils/parse-callstack.py
72+++ b/tests/utils/parse-callstack.py
73@@ -26,14 +26,23 @@ def addr2line(executable, addr):
74
75 status = subprocess.run(cmd, stdout=subprocess.PIPE, check=True)
76
77- addr2line_output = status.stdout.decode("utf-8")
78-
79- # Omit the last 2 lines as the caller of main can not be determine
80- fcts = [addr2line_output.split()[-2]]
81-
82- fcts = [ f for f in fcts if '??' not in f]
83-
84- return fcts
85+ addr2line_output = status.stdout.decode("utf-8").splitlines()
86+ # addr2line's output is made of 3-tuples:
87+ # - address
88+ # - function name
89+ # - source location
90+ if len(addr2line_output) % 3 != 0:
91+ raise Exception('Unexpected addr2line output:\n\t{}'.format('\n\t'.join(addr2line_output)))
92+
93+ function_names = []
94+ for address_line_number in range(0, len(addr2line_output), 3):
95+ function_name = addr2line_output[address_line_number + 1]
96+
97+ # Filter-out unresolved functions
98+ if "??" not in function_name:
99+ function_names.append(addr2line_output[address_line_number + 1])
100+
101+ return function_names
102
103 def extract_user_func_names(executable, raw_callstack):
104 """
105--
1062.34.1
107
diff --git a/meta/recipes-kernel/lttng/lttng-tools_2.13.9.bb b/meta/recipes-kernel/lttng/lttng-tools_2.13.9.bb
index 58c0378d66..113720ca5c 100644
--- a/meta/recipes-kernel/lttng/lttng-tools_2.13.9.bb
+++ b/meta/recipes-kernel/lttng/lttng-tools_2.13.9.bb
@@ -37,6 +37,8 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
37 file://lttng-sessiond.service \ 37 file://lttng-sessiond.service \
38 file://disable-tests.patch \ 38 file://disable-tests.patch \
39 file://0001-compat-Define-off64_t-as-off_t-on-linux.patch \ 39 file://0001-compat-Define-off64_t-as-off_t-on-linux.patch \
40 file://40b2a4a793c81221a28f822d07135069456ea021.patch \
41 file://gcc13-ptest-fix.patch \
40 " 42 "
41 43
42SRC_URI[sha256sum] = "8d94dc95b608cf70216b01203a3f8242b97a232db2e23421a2f43708da08f337" 44SRC_URI[sha256sum] = "8d94dc95b608cf70216b01203a3f8242b97a232db2e23421a2f43708da08f337"