diff mbox series

[kvm-unit-tests] runtime: Teach pretty-print-stacks about EFI debug info

Message ID 20230628100550.42786-2-andrew.jones@linux.dev (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] runtime: Teach pretty-print-stacks about EFI debug info | expand

Commit Message

Andrew Jones June 28, 2023, 10:05 a.m. UTC
When running a unit test built for EFI, pretty-print-stacks needs to
look at ${kernel}.efi.debug, where ${kernel} comes from the 'file'
field of unittests.cfg but has the .flat extension removed. Teach
the pretty-print-stacks script to do that by ensuring ${kernel}.efi
is passed to the script, giving it the ability to identify an EFI
kernel and know where it is, i.e. any prepended path to the filename
is maintained. To pass ${kernel}.efi we change run() to not needlessly
convert ${kernel}.flat to $(basename $kernel .flat), but rather
to ${kernel}.efi. The original change was needless because the EFI
$RUNTIME_arch_run scripts already do a $(basename $kernel .efi)
conversion.

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
---

This is based on "[kvm-unit-tests PATCH v3 0/6] arm64: improve
debuggability" which introduces .efi.debug files.

 scripts/pretty_print_stacks.py | 6 +++++-
 scripts/runtime.bash           | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/scripts/pretty_print_stacks.py b/scripts/pretty_print_stacks.py
index 90026b724684..d990d30055d5 100755
--- a/scripts/pretty_print_stacks.py
+++ b/scripts/pretty_print_stacks.py
@@ -63,7 +63,11 @@  def main():
         sys.stderr.write('usage: %s <kernel>\n' % sys.argv[0])
         sys.exit(1)
 
-    binary = sys.argv[1].replace(".flat", ".elf")
+    binary = sys.argv[1]
+    if binary.endswith('.flat'):
+        binary = binary.replace('.flat', '.elf')
+    elif binary.endswith('.efi'):
+        binary += '.debug'
 
     with open("config.mak") as config_file:
         for line in config_file:
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 785a7b627bfd..54f8ade6bc71 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -83,7 +83,7 @@  function run()
     local timeout="${9:-$TIMEOUT}" # unittests.cfg overrides the default
 
     if [ "${CONFIG_EFI}" == "y" ]; then
-        kernel=$(basename $kernel .flat)
+        kernel=${kernel/%.flat/.efi}
     fi
 
     if [ -z "$testname" ]; then