mirror of
https://git.yoctoproject.org/poky
synced 2026-09-16 09:49:35 +02:00
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>
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
107
meta/recipes-kernel/lttng/lttng-tools/gcc13-ptest-fix.patch
Normal file
107
meta/recipes-kernel/lttng/lttng-tools/gcc13-ptest-fix.patch
Normal file
@@ -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
|
||||||
|
|
||||||
@@ -37,6 +37,8 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
|
|||||||
file://lttng-sessiond.service \
|
file://lttng-sessiond.service \
|
||||||
file://disable-tests.patch \
|
file://disable-tests.patch \
|
||||||
file://0001-compat-Define-off64_t-as-off_t-on-linux.patch \
|
file://0001-compat-Define-off64_t-as-off_t-on-linux.patch \
|
||||||
|
file://40b2a4a793c81221a28f822d07135069456ea021.patch \
|
||||||
|
file://gcc13-ptest-fix.patch \
|
||||||
"
|
"
|
||||||
|
|
||||||
SRC_URI[sha256sum] = "8d94dc95b608cf70216b01203a3f8242b97a232db2e23421a2f43708da08f337"
|
SRC_URI[sha256sum] = "8d94dc95b608cf70216b01203a3f8242b97a232db2e23421a2f43708da08f337"
|
||||||
|
|||||||
Reference in New Issue
Block a user