blob: e338eaff2b18ff34cb7fcf9fa71f48f475b4e851 [file] [log] [blame]
Patrick Williamse760df82023-05-26 11:10:49 -05001From 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