skip gdb tests when gdb isn't found
authorJacob Lifshay <programmerjake@gmail.com>
Thu, 25 Aug 2022 09:33:52 +0000 (02:33 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Thu, 25 Aug 2022 09:37:47 +0000 (02:37 -0700)
src/openpower/simulator/qemu.py

index af734e338e800969035d69ee6e191f37724f554e..c60d6384f7882895d2db511188a82edc9edf7124 100644 (file)
@@ -1,3 +1,4 @@
+import unittest
 from pygdbmi.gdbcontroller import GdbController
 import subprocess
 import tempfile
@@ -47,7 +48,14 @@ class QemuController:
         self.qemu_popen = subprocess.Popen(args,
                                            stdout=subprocess.PIPE,
                                            stdin=subprocess.PIPE)
-        self.gdb = GdbController(gdb_path='powerpc64-linux-gnu-gdb')
+        try:
+            self.gdb = GdbController(gdb_path='powerpc64-linux-gnu-gdb')
+        except ValueError as e:
+            if len(e.args) == 1 and isinstance(e.args[0], str) and \
+                e.args[0].startswith("gdb executable could not be resolved"):
+                raise unittest.SkipTest(
+                    "powerpc64-linux-gnu-gdb not found") from e
+            raise
         self.bigendian = bigendian
         self._reg_cache = {}