#
import gdb
-import sys
-
-failcount = 0
-
-
-def report(cond, msg):
- "Report success/fail of test"
- if cond:
- print("PASS: %s" % (msg))
- else:
- print("FAIL: %s" % (msg))
- global failcount
- failcount += 1
+from test_gdbstub import main, report
def check_interrupt(thread):
Test if interrupting the code always lands us on the same thread when
running with scheduler-lock enabled.
"""
+ if len(gdb.selected_inferior().threads()) == 1:
+ print("SKIP: set to run on a single thread")
+ exit(0)
gdb.execute("set scheduler-locking on")
for thread in gdb.selected_inferior().threads():
"thread %d resumes correctly on interrupt" % thread.num)
-#
-# This runs as the script it sourced (via -x, via run-test.py)
-#
-try:
- inferior = gdb.selected_inferior()
- arch = inferior.architecture()
- print("ATTACHED: %s" % arch.name())
-except (gdb.error, AttributeError):
- print("SKIPPING (not connected)", file=sys.stderr)
- exit(0)
-
-if gdb.parse_and_eval('$pc') == 0:
- print("SKIP: PC not set")
- exit(0)
-if len(gdb.selected_inferior().threads()) == 1:
- print("SKIP: set to run on a single thread")
- exit(0)
-
-try:
- # Run the actual tests
- run_test()
-except (gdb.error):
- print("GDB Exception: %s" % (sys.exc_info()[0]))
- failcount += 1
- pass
-
-# Finally kill the inferior and exit gdb with a count of failures
-gdb.execute("kill")
-exit(failcount)
+main(run_test)