diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-05-25 23:16:35 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-05-26 07:54:17 +0100 |
commit | 47d33683a12409db454dbbcaa5e3f2253d16e90c (patch) | |
tree | 949b06d5b42a8523a0270eef4faa86455ec15dde | |
parent | d52d7f524bea8f67580218ce5bfbc69036d6a9f5 (diff) | |
download | poky-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>
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 @@ | |||
1 | From 40b2a4a793c81221a28f822d07135069456ea021 Mon Sep 17 00:00:00 2001 | ||
2 | From: Olivier Dion <odion@efficios.com> | ||
3 | Date: Fri, 10 Mar 2023 13:17:46 -0500 | ||
4 | Subject: [PATCH] Tests: fix: parse-callback reports missing addr2line | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=utf8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Upstream-Status: Backport | ||
10 | |||
11 | addr2line from binutils is required for this script to work correctly. | ||
12 | However, it silently fails. Fix this by using `subprocess.run' with | ||
13 | `check=True' instead of `subprocess.getoutput'. That way, an exception | ||
14 | is raised if an error occurs. | ||
15 | |||
16 | Fix the shebang by not assuming where python is installed while at it. | ||
17 | |||
18 | Change-Id: I5157b3dbccf6bfbe08a6b6840b38f5db9010fe96 | ||
19 | Signed-off-by: Olivier Dion <odion@efficios.com> | ||
20 | Signed-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 | |||
25 | diff --git a/tests/utils/parse-callstack.py b/tests/utils/parse-callstack.py | ||
26 | index 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 | -- | ||
47 | 2.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 @@ | |||
1 | From 844be4dc46deeec83199da80e9e2a6058e9f5a53 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= | ||
3 | <jeremie.galarneau@efficios.com> | ||
4 | Date: Thu, 25 May 2023 19:15:20 -0400 | ||
5 | Subject: [PATCH] Tests fix: test_callstack: output of addr2line incorrectly | ||
6 | parsed | ||
7 | MIME-Version: 1.0 | ||
8 | Content-Type: text/plain; charset=utf8 | ||
9 | Content-Transfer-Encoding: 8bit | ||
10 | |||
11 | Upstream-Status: Backport | ||
12 | |||
13 | Issue observed | ||
14 | -------------- | ||
15 | |||
16 | The 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 | |||
29 | Cause | ||
30 | ----- | ||
31 | |||
32 | parse-callstack.py uses 'split()' to split the lines of addr2line's | ||
33 | output. By default, 'split()' splits a string on any whitespace. | ||
34 | Typically this was fine as addr2line's output doesn't contain spaces and | ||
35 | the function then splits on new lines. | ||
36 | |||
37 | Typical 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 | |||
44 | However, with the test app compiled using gcc 13.1, a "discriminator" | ||
45 | annotation 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 | |||
51 | Hence, by selecting the second to last element (-2, with negative | ||
52 | indexing), the addr2line function returns '(discriminator' as the | ||
53 | function name. | ||
54 | |||
55 | Solution | ||
56 | -------- | ||
57 | |||
58 | The parsing code is changed to simply iterate on groups of 3 lines, | ||
59 | following addr2line's output format. | ||
60 | |||
61 | Fixes #1377 | ||
62 | |||
63 | Change-Id: I8c1eab97e84ca7cad171904bed6660540061cf08 | ||
64 | Signed-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 | |||
69 | diff --git a/tests/utils/parse-callstack.py b/tests/utils/parse-callstack.py | ||
70 | index 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 | -- | ||
106 | 2.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 | ||
42 | SRC_URI[sha256sum] = "8d94dc95b608cf70216b01203a3f8242b97a232db2e23421a2f43708da08f337" | 44 | SRC_URI[sha256sum] = "8d94dc95b608cf70216b01203a3f8242b97a232db2e23421a2f43708da08f337" |