From fff80fb8023439e534f1fade58025ca9865e656f Mon Sep 17 00:00:00 2001 From: Yevhenii Havrylko Date: Wed, 8 May 2024 11:56:54 -0400 Subject: [PATCH] Add all kernel breakpoints hit test --- numba_dpex/tests/debugging/gdb.py | 3 +++ .../tests/debugging/test_breakpoints.py | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/numba_dpex/tests/debugging/gdb.py b/numba_dpex/tests/debugging/gdb.py index b743507c15..5459b6be9c 100644 --- a/numba_dpex/tests/debugging/gdb.py +++ b/numba_dpex/tests/debugging/gdb.py @@ -139,6 +139,9 @@ def info_functions(self, function): def info_locals(self): self._command("info locals") + def continue_(self): + self._command("continue") + def next(self): self._command("next") diff --git a/numba_dpex/tests/debugging/test_breakpoints.py b/numba_dpex/tests/debugging/test_breakpoints.py index f76411b100..f4585739f2 100644 --- a/numba_dpex/tests/debugging/test_breakpoints.py +++ b/numba_dpex/tests/debugging/test_breakpoints.py @@ -88,3 +88,29 @@ def test_kernel_breakpoint(app: gdb, condition, exp_var, exp_val): app.expect_hit_breakpoint("simple_sum.py:13") if exp_var is not None: app.print(exp_var, expected=exp_val) + + +def test_all_kernel_breakpoints_hit(app: gdb): + """Test that every thread was hit""" + + app.breakpoint("simple_sum.py:13") + app.run("simple_sum.py") + + indexes = [] + + for _ in range(10): + app.expect_hit_breakpoint("simple_sum.py:13") + + # Recover the index of the thread + app._command("print i") + app.child.expect(r"\$[0-9]+ = ") + index = app.child.read(1) + app.expect_eol() + + indexes.append(int(index)) + + app.continue_() + + indexes.sort() + + assert indexes == list(range(10))