Tests: fix: parse-callback reports missing addr2line
authorOlivier Dion <odion@efficios.com>
Fri, 10 Mar 2023 18:17:46 +0000 (13:17 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 16 Mar 2023 15:00:40 +0000 (11:00 -0400)
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

index 3bfddd9eff36631b5d179f6495c672d7e28c9965..c3f0e2e9bc5a5d5278cb650cd09abbd5b9f8af38 100755 (executable)
@@ -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]]
This page took 0.026247 seconds and 4 git commands to generate.