| """Helper functions for gdbstub testing |
| from __future__ import print_function |
| """Report success/fail of a test""" |
| print("PASS: {}".format(msg)) |
| print("FAIL: {}".format(msg)) |
| def main(test, expected_arch=None): |
| This runs as the script it sourced (via -x, via run-test.py).""" |
| inferior = gdb.selected_inferior() |
| arch = inferior.architecture() |
| print("ATTACHED: {}".format(arch.name())) |
| if expected_arch is not None: |
| report(arch.name() == expected_arch, |
| "connected to {}".format(expected_arch)) |
| except (gdb.error, AttributeError): |
| print("SKIP: not connected") |
| if gdb.parse_and_eval("$pc") == 0: |
| print("SKIP: PC not set") |
| traceback.print_exc(file=sys.stdout) |
| if "QEMU_TEST_INTERACTIVE" in os.environ: |
| code.InteractiveConsole(locals=globals()).interact() |
| print("All tests complete: {} failures".format(fail_count)) |