[PATCH] D118468: [cross-project-tests] XFAIL llgdb-tests when gdb can't read clang's DWARF

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 04:28:05 PST 2022


Orlando added inline comments.


================
Comment at: cross-project-tests/lit.cfg.py:212-215
+  try:
+    gdb_vers_lines = subprocess.check_output(['gdb', '--version']).decode().splitlines()
+  except FileNotFoundError:
+    return None # No gdb found.
----------------
jmorse wrote:
> Would this benefit from a pokemon exception handler? Given that we're calling another process, there's a nonzero possibility we'll get a CalledProcessError or some other unexpected behaviour. I'd suggest that if gdb itself is broken, we should catch the resulting exceptions here, return None, and let the gdb tests run and possibly fail. IMO, that's better than presenting an exception in llvm-lit to the developer.
SGTM, done.


================
Comment at: cross-project-tests/lit.cfg.py:220
+    return None
+  return gdb_vers_lines[0].strip().partition('GNU gdb (GDB) ')[2]
+
----------------
jmorse wrote:
> Having the same length-check for `[2]` as on the earlier few lines would future proof this code.
`partition` returns a 3-tuple of strings ([docs](https://docs.python.org/3/library/stdtypes.html#str.partition)).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118468/new/

https://reviews.llvm.org/D118468



More information about the llvm-commits mailing list