From fd2b5c0de05df73c04b4281f2a27f558a17d1edb Mon Sep 17 00:00:00 2001 From: Olivier Dion 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 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 Signed-off-by: Jérémie Galarneau --- 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 # @@ -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