Skip to content

Commit 655aa8b

Browse files
author
Diptorup Deb
committed
Changes to gdb unit tests to enable them on Intel Max GPU
- Increase the timeout value for pyexpect as spawning gdb on discrete GPU can take more time than on CPU. - Slight modifications on the regex patterns to be matched on hitting a breakpoint. The change was done based on what was observed on Intel Max GPU and gdb-oneapi.
1 parent 84acdea commit 655aa8b

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

numba_dpex/tests/debugging/gdb.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
r"layout=[A-Z],\s+"
3434
r"address_space=[0-4],\s+"
3535
r"usm_type=[a-z]+,\s+"
36-
r"device=[a-z:0-9]+,\s+"
37-
r"sycl_queue=[A-Za-z:0-9 ]+\)"
36+
r"device=[a-z\_:0-9]+,\s+"
37+
r"sycl_queue=[A-Za-z:0-9\s\_:]+\)"
3838
)
3939

4040

@@ -52,7 +52,7 @@ def spawn(self):
5252
env["NUMBA_DEBUGINFO"] = "1"
5353

5454
self.child = pexpect.spawn(
55-
"gdb-oneapi -q python", env=env, encoding="utf-8"
55+
"gdb-oneapi -q python", env=env, encoding="utf-8", timeout=60
5656
)
5757
if config.TESTING_LOG_DEBUGGING:
5858
self.child.logfile = sys.stdout
@@ -109,7 +109,7 @@ def expect_eol(self):
109109
self.child.expect(r"[^\n]*\n")
110110

111111
def expect_hit_breakpoint(self, expected_location=None):
112-
expect = r"Thread [0-9A-Za-z \"]+ hit Breakpoint [0-9\.]+"
112+
expect = r"Breakpoint [0-9\.]+"
113113
if expected_location is not None:
114114
# function name + args could be long, so we have to assume that
115115
# the message may be splitted in multiple lines. It potentially can

numba_dpex/tests/debugging/test_breakpoints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_device_func_breakpoint(
5858

5959
app.breakpoint(breakpoint, condition=condition)
6060
app.run(f"side-by-side.py --api={api}")
61-
app.expect_hit_breakpoint("side-by-side.py:15")
61+
app.expect_hit_breakpoint(expected_location="side-by-side.py:15")
6262
if exp_var is not None:
6363
app.print(exp_var, expected=exp_val)
6464

numba_dpex/tests/debugging/test_info.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def test_info_args(
7878
):
7979
app.breakpoint(breakpoint)
8080
app.run(script)
81-
app.expect_hit_breakpoint(breakpoint)
81+
app.expect_hit_breakpoint(expected_location=breakpoint)
8282
app.expect(expected_line, with_eol=True)
8383

8484
if kind == "info":
@@ -99,7 +99,7 @@ def test_info_args(
9999
def test_info_functions(app):
100100
app.breakpoint("simple_sum.py:12")
101101
app.run("simple_sum.py")
102-
app.expect_hit_breakpoint("simple_sum.py:12")
102+
app.expect_hit_breakpoint(expected_location="simple_sum.py:12")
103103
app.expect(r"12\s+i = item.get_id\(0\)", with_eol=True)
104104

105105
app.info_functions("data_parallel_sum")
@@ -119,7 +119,7 @@ def test_print_array_element(app, api):
119119

120120
app.breakpoint("side-by-side-2.py:17", condition="param_a == 5")
121121
app.run(f"side-by-side-2.py --api={api}")
122-
app.expect_hit_breakpoint("side-by-side-2.py:17")
122+
app.expect_hit_breakpoint(expected_location="side-by-side-2.py:17")
123123

124124
# We can access only c_array, not python style array
125125
app.print("b.data[5]", 5)
@@ -142,7 +142,7 @@ def test_print_array_element(app, api):
142142
def test_assignment_to_variable(app, api, assign):
143143
app.breakpoint("side-by-side-2.py:17", condition="param_a == 5")
144144
app.run(f"side-by-side-2.py --api={api}")
145-
app.expect_hit_breakpoint("side-by-side-2.py:17")
145+
app.expect_hit_breakpoint(expected_location="side-by-side-2.py:17")
146146

147147
app.print("param_a", expected=5)
148148
if assign == "print":

numba_dpex/tests/debugging/test_stepping.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
def test_next(app: gdb):
2222
app.breakpoint("simple_dpex_func.py:18")
2323
app.run("simple_dpex_func.py")
24-
app.expect_hit_breakpoint("simple_dpex_func.py:18")
24+
app.expect_hit_breakpoint(expected_location="simple_dpex_func.py:18")
2525
app.expect(r"18\s+i = item.get_id\(0\)", with_eol=True)
2626
app.set_scheduler_lock()
2727
app.next()
@@ -37,7 +37,7 @@ def test_next(app: gdb):
3737
def test_step(app: gdb):
3838
app.breakpoint("simple_dpex_func.py:19")
3939
app.run("simple_dpex_func.py")
40-
app.expect_hit_breakpoint("simple_dpex_func.py:19")
40+
app.expect_hit_breakpoint(expected_location="simple_dpex_func.py:19")
4141
app.expect(
4242
r"19\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)",
4343
with_eol=True,
@@ -57,7 +57,7 @@ def test_step(app: gdb):
5757
def test_stepi(app: gdb, func: str):
5858
app.breakpoint("simple_dpex_func.py:19")
5959
app.run("simple_dpex_func.py")
60-
app.expect_hit_breakpoint("simple_dpex_func.py:19")
60+
app.expect_hit_breakpoint(expected_location="simple_dpex_func.py:19")
6161
app.expect(
6262
r"19\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)",
6363
with_eol=True,

0 commit comments

Comments
 (0)