From 48430973f491dbe68766d86abf90752ad7e7e79b Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Thu, 2 Dec 2021 12:22:16 +0300 Subject: [PATCH 01/40] Make test parameterized and add description --- numba_dppy/tests/test_debug_dppy_numba.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/numba_dppy/tests/test_debug_dppy_numba.py b/numba_dppy/tests/test_debug_dppy_numba.py index 388a94b588..0e9fca2f83 100644 --- a/numba_dppy/tests/test_debug_dppy_numba.py +++ b/numba_dppy/tests/test_debug_dppy_numba.py @@ -160,21 +160,20 @@ def test_break_conditional(app): @skip_no_numba055 -def test_break_conditional_with_func_arg(app): - app.breakpoint("simple_dppy_func.py:23 if a_in_func == 3") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:23") - app.child.expect(r"23\s+result = a_in_func \+ b_in_func") +@pytest.mark.parametrize("breakpoint", ["simple_dppy_func.py:23", "func_sum"]) +@pytest.mark.parametrize("condition", ["a_in_func == 3"]) +def test_breakpoint_with_condition_by_function_argument( + app, breakpoint, condition +): + """Function breakpoints and argument initializing - app.print("a_in_func") - - app.child.expect(r"\$1 = 3") + Test that it is possible to set conditional breakpoint at the beginning + of the function and use a function argument in the condition. + Test for https://github.com/numba/numba/issues/7415 + """ -@skip_no_numba055 -def test_break_conditional_by_func_name_with_func_arg(app): - app.breakpoint("func_sum if a_in_func == 3") + app.breakpoint(f"{breakpoint} if {condition}") app.run("simple_dppy_func.py") app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:23") From fa4da05adfacab9821b5a3a1eef93737b41897a7 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 3 Dec 2021 15:26:46 +0300 Subject: [PATCH 02/40] Use side-by-side scenario --- numba_dppy/tests/test_debug_dppy_numba.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/numba_dppy/tests/test_debug_dppy_numba.py b/numba_dppy/tests/test_debug_dppy_numba.py index 0e9fca2f83..c0bfd6b2d4 100644 --- a/numba_dppy/tests/test_debug_dppy_numba.py +++ b/numba_dppy/tests/test_debug_dppy_numba.py @@ -160,8 +160,10 @@ def test_break_conditional(app): @skip_no_numba055 -@pytest.mark.parametrize("breakpoint", ["simple_dppy_func.py:23", "func_sum"]) -@pytest.mark.parametrize("condition", ["a_in_func == 3"]) +@pytest.mark.parametrize( + "breakpoint", ["side-by-side.py:25", "common_loop_body_242"] +) +@pytest.mark.parametrize("condition", ["param_a == 3"]) def test_breakpoint_with_condition_by_function_argument( app, breakpoint, condition ): @@ -174,12 +176,12 @@ def test_breakpoint_with_condition_by_function_argument( """ app.breakpoint(f"{breakpoint} if {condition}") - app.run("simple_dppy_func.py") + app.run("side-by-side.py") - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:23") - app.child.expect(r"23\s+result = a_in_func \+ b_in_func") + app.child.expect(r"Thread .* hit Breakpoint .* at side-by-side.py:25") + app.child.expect(r"25\s+param_c = param_a \+ 10") - app.print("a_in_func") + app.print("param_a") app.child.expect(r"\$1 = 3") From b434ecdbc3bfd8b1afc9c335f7a240120bf114a0 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 3 Dec 2021 16:00:23 +0300 Subject: [PATCH 03/40] Test with different api --- numba_dppy/tests/test_debug_dppy_numba.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/numba_dppy/tests/test_debug_dppy_numba.py b/numba_dppy/tests/test_debug_dppy_numba.py index c0bfd6b2d4..b3aec11c37 100644 --- a/numba_dppy/tests/test_debug_dppy_numba.py +++ b/numba_dppy/tests/test_debug_dppy_numba.py @@ -161,12 +161,15 @@ def test_break_conditional(app): @skip_no_numba055 @pytest.mark.parametrize( - "breakpoint", ["side-by-side.py:25", "common_loop_body_242"] + "api, breakpoint", + [ + ("numba", "side-by-side.py:25"), + ("numba-dppy-kernel", "side-by-side.py:25"), + ("numba", "common_loop_body_242"), + ("numba-dppy-kernel", "common_loop_body"), + ], ) -@pytest.mark.parametrize("condition", ["param_a == 3"]) -def test_breakpoint_with_condition_by_function_argument( - app, breakpoint, condition -): +def test_breakpoint_with_condition_by_function_argument(app, api, breakpoint): """Function breakpoints and argument initializing Test that it is possible to set conditional breakpoint at the beginning @@ -174,16 +177,18 @@ def test_breakpoint_with_condition_by_function_argument( Test for https://github.com/numba/numba/issues/7415 """ + variable_name = "param_a" + variable_value = "3" + condition = f"{variable_name} == {variable_value}" app.breakpoint(f"{breakpoint} if {condition}") - app.run("side-by-side.py") + app.run(f"side-by-side.py --api={api}") app.child.expect(r"Thread .* hit Breakpoint .* at side-by-side.py:25") - app.child.expect(r"25\s+param_c = param_a \+ 10") - app.print("param_a") + app.print(variable_name) - app.child.expect(r"\$1 = 3") + app.child.expect(fr"\$1 = {variable_value}") # commands/break_file_func From 88f7caae923b321d552e120f6a6b5f4e51e2155f Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 3 Dec 2021 16:08:32 +0300 Subject: [PATCH 04/40] Switch order for api and breakpoint --- numba_dppy/tests/test_debug_dppy_numba.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/numba_dppy/tests/test_debug_dppy_numba.py b/numba_dppy/tests/test_debug_dppy_numba.py index b3aec11c37..df1e7badd2 100644 --- a/numba_dppy/tests/test_debug_dppy_numba.py +++ b/numba_dppy/tests/test_debug_dppy_numba.py @@ -161,15 +161,15 @@ def test_break_conditional(app): @skip_no_numba055 @pytest.mark.parametrize( - "api, breakpoint", + "breakpoint, api", [ - ("numba", "side-by-side.py:25"), - ("numba-dppy-kernel", "side-by-side.py:25"), - ("numba", "common_loop_body_242"), - ("numba-dppy-kernel", "common_loop_body"), + ("side-by-side.py:25", "numba"), + ("side-by-side.py:25", "numba-dppy-kernel"), + ("common_loop_body_242", "numba"), + ("common_loop_body", "numba-dppy-kernel"), ], ) -def test_breakpoint_with_condition_by_function_argument(app, api, breakpoint): +def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): """Function breakpoints and argument initializing Test that it is possible to set conditional breakpoint at the beginning From e93b41fb808275f05f0c8987675672707a4f678a Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Thu, 16 Dec 2021 21:01:26 +0300 Subject: [PATCH 05/40] Move test_debug_dppy_numba.py to numba_dppy/tests/debugging --- numba_dppy/tests/debugging/__init__.py | 19 +++++++++++++++++++ .../{ => debugging}/test_debug_dppy_numba.py | 1 + 2 files changed, 20 insertions(+) create mode 100644 numba_dppy/tests/debugging/__init__.py rename numba_dppy/tests/{ => debugging}/test_debug_dppy_numba.py (99%) diff --git a/numba_dppy/tests/debugging/__init__.py b/numba_dppy/tests/debugging/__init__.py new file mode 100644 index 0000000000..e8ce169780 --- /dev/null +++ b/numba_dppy/tests/debugging/__init__.py @@ -0,0 +1,19 @@ +################################################################################ +# Numba-DPPY +# +# Copyright 2020-2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + +from . import * diff --git a/numba_dppy/tests/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_debug_dppy_numba.py similarity index 99% rename from numba_dppy/tests/test_debug_dppy_numba.py rename to numba_dppy/tests/debugging/test_debug_dppy_numba.py index df1e7badd2..6c0cc2086b 100644 --- a/numba_dppy/tests/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_debug_dppy_numba.py @@ -176,6 +176,7 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): of the function and use a function argument in the condition. Test for https://github.com/numba/numba/issues/7415 + SAT-4449 """ variable_name = "param_a" variable_value = "3" From 1da64f727f4110b95b5e1d54fa64486c629bf061 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Thu, 16 Dec 2021 21:09:01 +0300 Subject: [PATCH 06/40] Extract tests/debugging/gdb.py --- numba_dppy/tests/debugging/gdb.py | 104 ++++++++++++++++++ .../tests/debugging/test_debug_dppy_numba.py | 86 +-------------- 2 files changed, 105 insertions(+), 85 deletions(-) create mode 100644 numba_dppy/tests/debugging/gdb.py diff --git a/numba_dppy/tests/debugging/gdb.py b/numba_dppy/tests/debugging/gdb.py new file mode 100644 index 0000000000..abe5731617 --- /dev/null +++ b/numba_dppy/tests/debugging/gdb.py @@ -0,0 +1,104 @@ +#! /usr/bin/env python +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import os +import pathlib +import sys + +import pytest + +import numba_dppy +from numba_dppy import config + +pexpect = pytest.importorskip("pexpect") + + +class gdb: + def __init__(self): + self.spawn() + self.setup_gdb() + + def __del__(self): + self.teardown_gdb() + + def spawn(self): + env = os.environ.copy() + env["NUMBA_OPT"] = "0" + env["NUMBA_EXTEND_VARIABLE_LIFETIMES"] = "1" + + self.child = pexpect.spawn( + "gdb-oneapi -q python", env=env, encoding="utf-8" + ) + if config.DEBUG: + self.child.logfile = sys.stdout + + def setup_gdb(self): + self.child.expect("(gdb)", timeout=5) + self.child.sendline("set breakpoint pending on") + self.child.expect("(gdb)", timeout=5) + self.child.sendline("set style enabled off") # disable colors symbols + + def teardown_gdb(self): + self.child.sendintr() + self.child.expect("(gdb)", timeout=5) + self.child.sendline("quit") + self.child.expect("Quit anyway?", timeout=5) + self.child.sendline("y") + + def _command(self, command): + self.child.expect("(gdb)", timeout=5) + self.child.sendline(command) + + def breakpoint(self, breakpoint): + self._command("break " + breakpoint) + + def run(self, script): + self._command("run " + self.script_path(script)) + + def backtrace(self): + self._command("backtrace") + + def print(self, var): + self._command("print " + var) + + def info_args(self): + self._command("info args") + + def info_functions(self, function): + self._command("info functions " + function) + + def info_locals(self): + self._command("info locals") + + def next(self): + self._command("next") + + def ptype(self, var): + self._command("ptype " + var) + + def whatis(self, var): + self._command("whatis " + var) + + def step(self): + self._command("step") + + def stepi(self): + self._command("stepi") + + @staticmethod + def script_path(script): + package_path = pathlib.Path(numba_dppy.__file__).parent + return str(package_path / "examples/debug" / script) diff --git a/numba_dppy/tests/debugging/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_debug_dppy_numba.py index 6c0cc2086b..5851759e62 100644 --- a/numba_dppy/tests/debugging/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_debug_dppy_numba.py @@ -13,18 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os -import pathlib import shutil -import sys import pytest -import numba_dppy -from numba_dppy import config from numba_dppy.numba_support import numba_version -pexpect = pytest.importorskip("pexpect") +from .gdb import gdb pytestmark = pytest.mark.skipif( not shutil.which("gdb-oneapi"), @@ -37,85 +32,6 @@ ) -# TODO: go to helper -class gdb: - def __init__(self): - self.spawn() - self.setup_gdb() - - def __del__(self): - self.teardown_gdb() - - def spawn(self): - env = os.environ.copy() - env["NUMBA_OPT"] = "0" - env["NUMBA_EXTEND_VARIABLE_LIFETIMES"] = "1" - - self.child = pexpect.spawn( - "gdb-oneapi -q python", env=env, encoding="utf-8" - ) - if config.DEBUG: - self.child.logfile = sys.stdout - - def setup_gdb(self): - self.child.expect("(gdb)", timeout=5) - self.child.sendline("set breakpoint pending on") - self.child.expect("(gdb)", timeout=5) - self.child.sendline("set style enabled off") # disable colors symbols - - def teardown_gdb(self): - self.child.sendintr() - self.child.expect("(gdb)", timeout=5) - self.child.sendline("quit") - self.child.expect("Quit anyway?", timeout=5) - self.child.sendline("y") - - def _command(self, command): - self.child.expect("(gdb)", timeout=5) - self.child.sendline(command) - - def breakpoint(self, breakpoint): - self._command("break " + breakpoint) - - def run(self, script): - self._command("run " + self.script_path(script)) - - def backtrace(self): - self._command("backtrace") - - def print(self, var): - self._command("print " + var) - - def info_args(self): - self._command("info args") - - def info_functions(self, function): - self._command("info functions " + function) - - def info_locals(self): - self._command("info locals") - - def next(self): - self._command("next") - - def ptype(self, var): - self._command("ptype " + var) - - def whatis(self, var): - self._command("whatis " + var) - - def step(self): - self._command("step") - - def stepi(self): - self._command("stepi") - - @staticmethod - def script_path(script): - package_path = pathlib.Path(numba_dppy.__file__).parent - return str(package_path / "examples/debug" / script) - - @pytest.fixture def app(): return gdb() From 78e3360b47b5e094c7d51936c30b013dc547b79b Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Thu, 16 Dec 2021 21:12:17 +0300 Subject: [PATCH 07/40] Move app() to conftests.py --- numba_dppy/tests/debugging/conftest.py | 23 +++++++++++++++++++ .../tests/debugging/test_debug_dppy_numba.py | 7 ------ 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 numba_dppy/tests/debugging/conftest.py diff --git a/numba_dppy/tests/debugging/conftest.py b/numba_dppy/tests/debugging/conftest.py new file mode 100644 index 0000000000..e22cca9c6f --- /dev/null +++ b/numba_dppy/tests/debugging/conftest.py @@ -0,0 +1,23 @@ +#! /usr/bin/env python +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pytest + +from .gdb import gdb + + +@pytest.fixture +def app(): + return gdb() diff --git a/numba_dppy/tests/debugging/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_debug_dppy_numba.py index 5851759e62..10bfc8dabd 100644 --- a/numba_dppy/tests/debugging/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_debug_dppy_numba.py @@ -19,8 +19,6 @@ from numba_dppy.numba_support import numba_version -from .gdb import gdb - pytestmark = pytest.mark.skipif( not shutil.which("gdb-oneapi"), reason="Intel® Distribution for GDB* is not available", @@ -32,11 +30,6 @@ ) -@pytest.fixture -def app(): - return gdb() - - @pytest.mark.parametrize("api", ["numba", "numba-dppy-kernel"]) def test_breakpoint_row_number(app, api): """Test for checking numba and numba-dppy debugging side-by-side.""" From 0fbec723a482191a2afdde9ae76fbe5117997598 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Thu, 16 Dec 2021 21:19:17 +0300 Subject: [PATCH 08/40] Move skip_no_numba055 to tests/_helper.py --- numba_dppy/tests/_helper.py | 4 ++++ numba_dppy/tests/debugging/test_debug_dppy_numba.py | 7 +------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/numba_dppy/tests/_helper.py b/numba_dppy/tests/_helper.py index 4c4ef91a76..b57a64620f 100644 --- a/numba_dppy/tests/_helper.py +++ b/numba_dppy/tests/_helper.py @@ -20,6 +20,7 @@ from numba.tests.support import captured_stdout from numba_dppy import config +from numba_dppy.numba_support import numba_version def has_opencl_gpu(): @@ -113,6 +114,9 @@ def platform_not_supported(device_type): pytest.param("level_zero:gpu:0", marks=skip_no_level_zero_gpu), ] +skip_no_numba055 = pytest.mark.skipif( + numba_version < (0, 55), reason="Need Numba 0.55 or higher" +) @contextlib.contextmanager def override_config(name, value, config=config): diff --git a/numba_dppy/tests/debugging/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_debug_dppy_numba.py index 10bfc8dabd..0a19ea2f54 100644 --- a/numba_dppy/tests/debugging/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_debug_dppy_numba.py @@ -17,7 +17,7 @@ import pytest -from numba_dppy.numba_support import numba_version +from numba_dppy.tests._helper import skip_no_numba055 pytestmark = pytest.mark.skipif( not shutil.which("gdb-oneapi"), @@ -25,11 +25,6 @@ ) -skip_no_numba055 = pytest.mark.skipif( - numba_version < (0, 55), reason="Need Numba 0.55 or higher" -) - - @pytest.mark.parametrize("api", ["numba", "numba-dppy-kernel"]) def test_breakpoint_row_number(app, api): """Test for checking numba and numba-dppy debugging side-by-side.""" From e8cd9f7c0d27619d2288db93d34ec7ae43474866 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Thu, 16 Dec 2021 21:27:29 +0300 Subject: [PATCH 09/40] Move skip_no_gdb to tests/_helper.py --- numba_dppy/tests/_helper.py | 7 +++++++ numba_dppy/tests/debugging/test_debug_dppy_numba.py | 9 ++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/numba_dppy/tests/_helper.py b/numba_dppy/tests/_helper.py index b57a64620f..93191c04b8 100644 --- a/numba_dppy/tests/_helper.py +++ b/numba_dppy/tests/_helper.py @@ -14,6 +14,7 @@ # limitations under the License. import contextlib +import shutil import dpctl import pytest @@ -118,6 +119,12 @@ def platform_not_supported(device_type): numba_version < (0, 55), reason="Need Numba 0.55 or higher" ) +skip_no_gdb = pytest.mark.skipif( + not shutil.which("gdb-oneapi"), + reason="Intel® Distribution for GDB* is not available", +) + + @contextlib.contextmanager def override_config(name, value, config=config): """ diff --git a/numba_dppy/tests/debugging/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_debug_dppy_numba.py index 0a19ea2f54..b79cf5051c 100644 --- a/numba_dppy/tests/debugging/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_debug_dppy_numba.py @@ -13,16 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import shutil - import pytest -from numba_dppy.tests._helper import skip_no_numba055 +from numba_dppy.tests._helper import skip_no_gdb, skip_no_numba055 -pytestmark = pytest.mark.skipif( - not shutil.which("gdb-oneapi"), - reason="Intel® Distribution for GDB* is not available", -) +pytestmark = skip_no_gdb @pytest.mark.parametrize("api", ["numba", "numba-dppy-kernel"]) From 969c0d8d2eceb5a38441de1bce1b490c5d652b72 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Thu, 16 Dec 2021 21:28:29 +0300 Subject: [PATCH 10/40] Extract tests for breakpoints in tests/debugging/test_breakpoints.py --- .../tests/debugging/test_breakpoints.py | 53 +++++++++++++++++++ .../tests/debugging/test_debug_dppy_numba.py | 33 ------------ 2 files changed, 53 insertions(+), 33 deletions(-) create mode 100644 numba_dppy/tests/debugging/test_breakpoints.py diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py new file mode 100644 index 0000000000..035b48d563 --- /dev/null +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -0,0 +1,53 @@ +#! /usr/bin/env python +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pytest + +from numba_dppy.tests._helper import skip_no_numba055, skip_no_gdb + +pytestmark = skip_no_gdb + + +@skip_no_numba055 +@pytest.mark.parametrize( + "breakpoint, api", + [ + ("side-by-side.py:25", "numba"), + ("side-by-side.py:25", "numba-dppy-kernel"), + ("common_loop_body_242", "numba"), + ("common_loop_body", "numba-dppy-kernel"), + ], +) +def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): + """Function breakpoints and argument initializing + + Test that it is possible to set conditional breakpoint at the beginning + of the function and use a function argument in the condition. + + Test for https://github.com/numba/numba/issues/7415 + SAT-4449 + """ + variable_name = "param_a" + variable_value = "3" + condition = f"{variable_name} == {variable_value}" + + app.breakpoint(f"{breakpoint} if {condition}") + app.run(f"side-by-side.py --api={api}") + + app.child.expect(r"Thread .* hit Breakpoint .* at side-by-side.py:25") + + app.print(variable_name) + + app.child.expect(fr"\$1 = {variable_value}") diff --git a/numba_dppy/tests/debugging/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_debug_dppy_numba.py index b79cf5051c..68d63fb675 100644 --- a/numba_dppy/tests/debugging/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_debug_dppy_numba.py @@ -58,39 +58,6 @@ def test_break_conditional(app): app.child.expect(r"\$1 = 1") -@skip_no_numba055 -@pytest.mark.parametrize( - "breakpoint, api", - [ - ("side-by-side.py:25", "numba"), - ("side-by-side.py:25", "numba-dppy-kernel"), - ("common_loop_body_242", "numba"), - ("common_loop_body", "numba-dppy-kernel"), - ], -) -def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): - """Function breakpoints and argument initializing - - Test that it is possible to set conditional breakpoint at the beginning - of the function and use a function argument in the condition. - - Test for https://github.com/numba/numba/issues/7415 - SAT-4449 - """ - variable_name = "param_a" - variable_value = "3" - condition = f"{variable_name} == {variable_value}" - - app.breakpoint(f"{breakpoint} if {condition}") - app.run(f"side-by-side.py --api={api}") - - app.child.expect(r"Thread .* hit Breakpoint .* at side-by-side.py:25") - - app.print(variable_name) - - app.child.expect(fr"\$1 = {variable_value}") - - # commands/break_file_func def test_break_file_function(app): app.breakpoint("simple_sum.py:data_parallel_sum") From 2f0d12d27e326d7c58e6fa0b26c75dbd77376801 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 10:29:38 +0300 Subject: [PATCH 11/40] Move test_break_conditional to test_breakpoints.py --- numba_dppy/tests/debugging/test_breakpoints.py | 17 +++++++++++++++++ .../tests/debugging/test_debug_dppy_numba.py | 13 ------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index 035b48d563..1002a63928 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -51,3 +51,20 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): app.print(variable_name) app.child.expect(fr"\$1 = {variable_value}") + + +# commands/break_conditional +def test_break_conditional(app): + """ + + """ + + app.breakpoint("simple_sum.py:24 if i == 1") + app.run("simple_sum.py") + + app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:24") + app.child.expect(r"24\s+c\[i\] = a\[i\] \+ b\[i\]") + + app.print("i") + + app.child.expect(r"\$1 = 1") diff --git a/numba_dppy/tests/debugging/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_debug_dppy_numba.py index 68d63fb675..78e8902c2a 100644 --- a/numba_dppy/tests/debugging/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_debug_dppy_numba.py @@ -45,19 +45,6 @@ def test_backtrace(app): app.child.expect(r"#1.*__main__::kernel_sum .* at simple_dppy_func.py:30") -# commands/break_conditional -def test_break_conditional(app): - app.breakpoint("simple_sum.py:24 if i == 1") - app.run("simple_sum.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:24") - app.child.expect(r"24\s+c\[i\] = a\[i\] \+ b\[i\]") - - app.print("i") - - app.child.expect(r"\$1 = 1") - - # commands/break_file_func def test_break_file_function(app): app.breakpoint("simple_sum.py:data_parallel_sum") From 129f7119b66883ab3c54015ebcff560d482decbd Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 10:41:01 +0300 Subject: [PATCH 12/40] Move tests to test_breakpoints.py - test_break_file_function - test_break_function - test_break_nested_function Also improved docstrings for tests. --- .../tests/debugging/test_breakpoints.py | 38 ++++++++++++++++++- .../tests/debugging/test_debug_dppy_numba.py | 27 ------------- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index 1002a63928..8142d43127 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -53,7 +53,43 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): app.child.expect(fr"\$1 = {variable_value}") -# commands/break_conditional + +def test_break_file_function(app): + """Set a breakpoint at the given location specified by file name and function name. + + commands/break_file_func + """ + app.breakpoint("simple_sum.py:data_parallel_sum") + app.run("simple_sum.py") + + app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:23") + app.child.expect(r"23\s+i = dppy.get_global_id\(0\)") + + +def test_break_function(app): + """Set a breakpoint at the given location specified by function name. + + commands/break_func + """ + app.breakpoint("data_parallel_sum") + app.run("simple_sum.py") + + app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:23") + app.child.expect(r"23\s+i = dppy.get_global_id\(0\)") + + +def test_break_nested_function(app): + """Set a breakpoint at the given location specified by file name and nested function name. + + commands/break_nested_func + """ + app.breakpoint("simple_dppy_func.py:func_sum") + app.run("simple_dppy_func.py") + + app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:23") + app.child.expect(r"23\s+result = a_in_func \+ b_in_func") + + def test_break_conditional(app): """ diff --git a/numba_dppy/tests/debugging/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_debug_dppy_numba.py index 78e8902c2a..3642c8d3bd 100644 --- a/numba_dppy/tests/debugging/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_debug_dppy_numba.py @@ -45,33 +45,6 @@ def test_backtrace(app): app.child.expect(r"#1.*__main__::kernel_sum .* at simple_dppy_func.py:30") -# commands/break_file_func -def test_break_file_function(app): - app.breakpoint("simple_sum.py:data_parallel_sum") - app.run("simple_sum.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:23") - app.child.expect(r"23\s+i = dppy.get_global_id\(0\)") - - -# commands/break_func -def test_break_function(app): - app.breakpoint("data_parallel_sum") - app.run("simple_sum.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:23") - app.child.expect(r"23\s+i = dppy.get_global_id\(0\)") - - -# commands/break_nested_func -def test_break_nested_function(app): - app.breakpoint("simple_dppy_func.py:func_sum") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:23") - app.child.expect(r"23\s+result = a_in_func \+ b_in_func") - - @skip_no_numba055 def test_info_args(app): app.breakpoint("simple_dppy_func.py:29") From f3a533a435894101617ff2c0beaed6bc3ca31f77 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 10:42:09 +0300 Subject: [PATCH 13/40] Add docstring for test_breakpoints.py module --- numba_dppy/tests/debugging/test_breakpoints.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index 8142d43127..b5aa375e4a 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -12,6 +12,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +"""Tests for Setting Breakpoints + +https://www.sourceware.org/gdb/onlinedocs/gdb/Set-Breaks.html +""" + import pytest From f622c56782accef30e24655ed0e48643f6f24ebf Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 10:43:41 +0300 Subject: [PATCH 14/40] Add docstring for test_break_conditional --- numba_dppy/tests/debugging/test_breakpoints.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index b5aa375e4a..99eec810da 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -96,8 +96,9 @@ def test_break_nested_function(app): def test_break_conditional(app): - """ + """Set a breakpoint with condition. + commands/break_conditional """ app.breakpoint("simple_sum.py:24 if i == 1") From 3b9d49e6ce90b260df32f763014f58a6dc1d1a40 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 10:56:08 +0300 Subject: [PATCH 15/40] Add common_loop_body_native_function_name --- numba_dppy/tests/debugging/test_breakpoints.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index 99eec810da..63cc000e59 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -25,14 +25,20 @@ pytestmark = skip_no_gdb +common_loop_body_native_function_name = { + "numba": "common_loop_body_242", + "numba-dppy-kernel": "common_loop_body", +} + + @skip_no_numba055 @pytest.mark.parametrize( "breakpoint, api", [ ("side-by-side.py:25", "numba"), ("side-by-side.py:25", "numba-dppy-kernel"), - ("common_loop_body_242", "numba"), - ("common_loop_body", "numba-dppy-kernel"), + (common_loop_body_native_function_name["numba"], "numba"), + (common_loop_body_native_function_name["numba-dppy-kernel"], "numba-dppy-kernel"), ], ) def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): From 015d6b7434c0c723ffb10cc35cd8b8b896964603 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 10:59:28 +0300 Subject: [PATCH 16/40] Add test_side_by_side.py --- .../tests/debugging/test_debug_dppy_numba.py | 11 ------- .../tests/debugging/test_side_by_side.py | 33 +++++++++++++++++++ 2 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 numba_dppy/tests/debugging/test_side_by_side.py diff --git a/numba_dppy/tests/debugging/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_debug_dppy_numba.py index 3642c8d3bd..f4ce011207 100644 --- a/numba_dppy/tests/debugging/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_debug_dppy_numba.py @@ -20,17 +20,6 @@ pytestmark = skip_no_gdb -@pytest.mark.parametrize("api", ["numba", "numba-dppy-kernel"]) -def test_breakpoint_row_number(app, api): - """Test for checking numba and numba-dppy debugging side-by-side.""" - - app.breakpoint("side-by-side.py:25") - app.run("side-by-side.py --api={api}".format(api=api)) - - app.child.expect(r"Breakpoint .* at side-by-side.py:25") - app.child.expect(r"25\s+param_c = param_a \+ 10") - - # commands/backtrace def test_backtrace(app): app.breakpoint("simple_dppy_func.py:23") diff --git a/numba_dppy/tests/debugging/test_side_by_side.py b/numba_dppy/tests/debugging/test_side_by_side.py new file mode 100644 index 0000000000..0a7ef4dfd4 --- /dev/null +++ b/numba_dppy/tests/debugging/test_side_by_side.py @@ -0,0 +1,33 @@ +#! /usr/bin/env python +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for side-by-side.py script""" + + +import pytest + +from numba_dppy.tests._helper import skip_no_gdb + +pytestmark = skip_no_gdb + + +@pytest.mark.parametrize("api", ["numba", "numba-dppy-kernel"]) +def test_breakpoint_row_number(app, api): + """Test for checking numba and numba-dppy debugging side-by-side.""" + + app.breakpoint("side-by-side.py:25") + app.run("side-by-side.py --api={api}".format(api=api)) + + app.child.expect(r"Breakpoint .* at side-by-side.py:25") + app.child.expect(r"25\s+param_c = param_a \+ 10") From fb72b8995d102c046a83a9785a0d0540f3cc4ce3 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 11:26:21 +0300 Subject: [PATCH 17/40] Add test_stepping.py --- .../tests/debugging/test_debug_dppy_numba.py | 58 -------------- numba_dppy/tests/debugging/test_stepping.py | 80 +++++++++++++++++++ 2 files changed, 80 insertions(+), 58 deletions(-) create mode 100644 numba_dppy/tests/debugging/test_stepping.py diff --git a/numba_dppy/tests/debugging/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_debug_dppy_numba.py index f4ce011207..95709aa7d2 100644 --- a/numba_dppy/tests/debugging/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_debug_dppy_numba.py @@ -107,61 +107,3 @@ def test_local_variables(app): app.whatis("l1") app.child.expect(r"type = float64") - - -# commands/next -def test_next(app): - app.breakpoint("simple_dppy_func.py:30") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:30") - app.child.expect( - r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" - ) - - app.next() - app.next() - - app.child.expect(r"Done\.\.\.") - - -# commands/step_dppy_func -def test_step(app): - app.breakpoint("simple_dppy_func.py:30") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:30") - app.child.expect( - r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" - ) - - app.step() - app.step() - - app.child.expect(r"__main__::func_sum \(.*\) at simple_dppy_func.py:23") - app.child.expect(r"23\s+result = a_in_func \+ b_in_func") - - -# commands/stepi -def test_stepi(app): - app.breakpoint("simple_dppy_func.py:30") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:30") - app.child.expect( - r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" - ) - - app.stepi() - - app.child.expect( - r"0x[0-f]+\s+30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" - ) - - app.stepi() - - app.child.expect(r"Switching to Thread") - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:30") - app.child.expect( - r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" - ) diff --git a/numba_dppy/tests/debugging/test_stepping.py b/numba_dppy/tests/debugging/test_stepping.py new file mode 100644 index 0000000000..a368b25398 --- /dev/null +++ b/numba_dppy/tests/debugging/test_stepping.py @@ -0,0 +1,80 @@ +#! /usr/bin/env python +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for Continuing and Stepping + +https://www.sourceware.org/gdb/onlinedocs/gdb/Continuing-and-Stepping.html +""" + +from numba_dppy.tests._helper import skip_no_gdb + +pytestmark = skip_no_gdb + + +# commands/next +def test_next(app): + app.breakpoint("simple_dppy_func.py:30") + app.run("simple_dppy_func.py") + + app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:30") + app.child.expect( + r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" + ) + + app.next() + app.next() + + app.child.expect(r"Done\.\.\.") + + +# commands/step_dppy_func +def test_step(app): + app.breakpoint("simple_dppy_func.py:30") + app.run("simple_dppy_func.py") + + app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:30") + app.child.expect( + r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" + ) + + app.step() + app.step() + + app.child.expect(r"__main__::func_sum \(.*\) at simple_dppy_func.py:23") + app.child.expect(r"23\s+result = a_in_func \+ b_in_func") + + +# commands/stepi +def test_stepi(app): + app.breakpoint("simple_dppy_func.py:30") + app.run("simple_dppy_func.py") + + app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:30") + app.child.expect( + r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" + ) + + app.stepi() + + app.child.expect( + r"0x[0-f]+\s+30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" + ) + + app.stepi() + + app.child.expect(r"Switching to Thread") + app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:30") + app.child.expect( + r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" + ) From 96471299fa6a08175802e898353bfd7b0c57ea9a Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 11:27:49 +0300 Subject: [PATCH 18/40] Fix black and pre-commit --- numba_dppy/tests/debugging/test_breakpoints.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index 63cc000e59..493308a6ca 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -20,7 +20,7 @@ import pytest -from numba_dppy.tests._helper import skip_no_numba055, skip_no_gdb +from numba_dppy.tests._helper import skip_no_gdb, skip_no_numba055 pytestmark = skip_no_gdb @@ -38,7 +38,10 @@ ("side-by-side.py:25", "numba"), ("side-by-side.py:25", "numba-dppy-kernel"), (common_loop_body_native_function_name["numba"], "numba"), - (common_loop_body_native_function_name["numba-dppy-kernel"], "numba-dppy-kernel"), + ( + common_loop_body_native_function_name["numba-dppy-kernel"], + "numba-dppy-kernel", + ), ], ) def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): @@ -64,7 +67,6 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): app.child.expect(fr"\$1 = {variable_value}") - def test_break_file_function(app): """Set a breakpoint at the given location specified by file name and function name. From 31720a615efb8aafd54ed84a7cb033f0d2f34a79 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 11:32:55 +0300 Subject: [PATCH 19/40] Add test_info.py --- .../tests/debugging/test_debug_dppy_numba.py | 79 +-------------- numba_dppy/tests/debugging/test_info.py | 97 +++++++++++++++++++ 2 files changed, 98 insertions(+), 78 deletions(-) create mode 100644 numba_dppy/tests/debugging/test_info.py diff --git a/numba_dppy/tests/debugging/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_debug_dppy_numba.py index 95709aa7d2..45b52a1b72 100644 --- a/numba_dppy/tests/debugging/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_debug_dppy_numba.py @@ -13,9 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pytest - -from numba_dppy.tests._helper import skip_no_gdb, skip_no_numba055 +from numba_dppy.tests._helper import skip_no_gdb pytestmark = skip_no_gdb @@ -32,78 +30,3 @@ def test_backtrace(app): app.child.expect(r"#0.*__main__::func_sum .* at simple_dppy_func.py:23") app.child.expect(r"#1.*__main__::kernel_sum .* at simple_dppy_func.py:30") - - -@skip_no_numba055 -def test_info_args(app): - app.breakpoint("simple_dppy_func.py:29") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:29") - app.child.expect(r"29\s+i = dppy.get_global_id\(0\)") - - app.info_args() - - app.child.expect(r"a_in_kernel = {meminfo = ") - app.child.expect(r"b_in_kernel = {meminfo = ") - app.child.expect(r"c_in_kernel = {meminfo = ") - - app.print("a_in_kernel") - app.child.expect(r"\$1 = {meminfo = ") - - app.ptype("a_in_kernel") - app.child.expect(r"type = struct array\(float32, 1d, C\).*}\)") - - app.whatis("a_in_kernel") - app.child.expect(r"type = array\(float32, 1d, C\) \({.*}\)") - - -# commands/info_func -@skip_no_numba055 -def test_info_functions(app): - app.breakpoint("simple_sum.py:23") - app.run("simple_sum.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:23") - app.child.expect(r"23\s+i = dppy.get_global_id\(0\)") - - app.info_functions("data_parallel_sum") - - app.child.expect(r"22:\s+.*__main__::data_parallel_sum\(.*\)") - - -# commands/local_variables_0 -@skip_no_numba055 -def test_local_variables(app): - app.breakpoint("sum_local_vars.py:26") - app.run("sum_local_vars.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at sum_local_vars.py:26") - app.child.expect(r"26\s+c\[i\] = l1 \+ l2") - - app.info_locals() - - app.child.expect(r"i = 0") - app.child.expect(r"l1 = [0-9]\.[0-9]{3}") - app.child.expect(r"l2 = [0-9]\.[0-9]{3}") - - app.print("a") - app.child.expect(r"\$1 = {meminfo = ") - - app.print("l1") - app.child.expect(r"\$2 = [0-9]\.[0-9]{3}") - - app.print("l2") - app.child.expect(r"\$3 = [0-9]\.[0-9]{3}") - - app.ptype("a") - app.child.expect(r"type = struct array\(float32, 1d, C\).*}\)") - - app.whatis("a") - app.child.expect(r"type = array\(float32, 1d, C\) \({.*}\)") - - app.ptype("l1") - app.child.expect(r"type = float64") - - app.whatis("l1") - app.child.expect(r"type = float64") diff --git a/numba_dppy/tests/debugging/test_info.py b/numba_dppy/tests/debugging/test_info.py new file mode 100644 index 0000000000..5739d1fe72 --- /dev/null +++ b/numba_dppy/tests/debugging/test_info.py @@ -0,0 +1,97 @@ +#! /usr/bin/env python +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for Information About a Frame + +https://www.sourceware.org/gdb/onlinedocs/gdb/Frame-Info.html +""" + +from numba_dppy.tests._helper import skip_no_gdb, skip_no_numba055 + +pytestmark = skip_no_gdb + + +@skip_no_numba055 +def test_info_args(app): + app.breakpoint("simple_dppy_func.py:29") + app.run("simple_dppy_func.py") + + app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:29") + app.child.expect(r"29\s+i = dppy.get_global_id\(0\)") + + app.info_args() + + app.child.expect(r"a_in_kernel = {meminfo = ") + app.child.expect(r"b_in_kernel = {meminfo = ") + app.child.expect(r"c_in_kernel = {meminfo = ") + + app.print("a_in_kernel") + app.child.expect(r"\$1 = {meminfo = ") + + app.ptype("a_in_kernel") + app.child.expect(r"type = struct array\(float32, 1d, C\).*}\)") + + app.whatis("a_in_kernel") + app.child.expect(r"type = array\(float32, 1d, C\) \({.*}\)") + + +# commands/info_func +@skip_no_numba055 +def test_info_functions(app): + app.breakpoint("simple_sum.py:23") + app.run("simple_sum.py") + + app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:23") + app.child.expect(r"23\s+i = dppy.get_global_id\(0\)") + + app.info_functions("data_parallel_sum") + + app.child.expect(r"22:\s+.*__main__::data_parallel_sum\(.*\)") + + +# commands/local_variables_0 +@skip_no_numba055 +def test_local_variables(app): + app.breakpoint("sum_local_vars.py:26") + app.run("sum_local_vars.py") + + app.child.expect(r"Thread .* hit Breakpoint .* at sum_local_vars.py:26") + app.child.expect(r"26\s+c\[i\] = l1 \+ l2") + + app.info_locals() + + app.child.expect(r"i = 0") + app.child.expect(r"l1 = [0-9]\.[0-9]{3}") + app.child.expect(r"l2 = [0-9]\.[0-9]{3}") + + app.print("a") + app.child.expect(r"\$1 = {meminfo = ") + + app.print("l1") + app.child.expect(r"\$2 = [0-9]\.[0-9]{3}") + + app.print("l2") + app.child.expect(r"\$3 = [0-9]\.[0-9]{3}") + + app.ptype("a") + app.child.expect(r"type = struct array\(float32, 1d, C\).*}\)") + + app.whatis("a") + app.child.expect(r"type = array\(float32, 1d, C\) \({.*}\)") + + app.ptype("l1") + app.child.expect(r"type = float64") + + app.whatis("l1") + app.child.expect(r"type = float64") From 54586cc4f202df5ae269521f5fefaef0cea76628 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 11:38:49 +0300 Subject: [PATCH 20/40] Add test_backtraces.py --- .../{test_debug_dppy_numba.py => test_backtraces.py} | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) rename numba_dppy/tests/debugging/{test_debug_dppy_numba.py => test_backtraces.py} (87%) diff --git a/numba_dppy/tests/debugging/test_debug_dppy_numba.py b/numba_dppy/tests/debugging/test_backtraces.py similarity index 87% rename from numba_dppy/tests/debugging/test_debug_dppy_numba.py rename to numba_dppy/tests/debugging/test_backtraces.py index 45b52a1b72..fca2765ad1 100644 --- a/numba_dppy/tests/debugging/test_debug_dppy_numba.py +++ b/numba_dppy/tests/debugging/test_backtraces.py @@ -12,14 +12,22 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +"""Tests for Backtraces + +https://www.sourceware.org/gdb/onlinedocs/gdb/Backtrace.html +""" from numba_dppy.tests._helper import skip_no_gdb pytestmark = skip_no_gdb -# commands/backtrace def test_backtrace(app): + """Simple test for backtrace. + + commands/backtrace + """ + app.breakpoint("simple_dppy_func.py:23") app.run("simple_dppy_func.py") From d7cc7792886fdf704fe44ded8e54d6796b14e2cd Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 15:55:57 +0300 Subject: [PATCH 21/40] Add file:function case to test_breakpoint_with_condition_by_function_argument --- numba_dppy/tests/debugging/test_breakpoints.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index 493308a6ca..b7876e0ffc 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -42,6 +42,14 @@ common_loop_body_native_function_name["numba-dppy-kernel"], "numba-dppy-kernel", ), + ( + f'side-by-side.py:{common_loop_body_native_function_name["numba"]}', + "numba", + ), + ( + f'side-by-side.py:{common_loop_body_native_function_name["numba-dppy-kernel"]}', + "numba-dppy-kernel", + ), ], ) def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): From e60e57a2e5ee333dd372fecd3c60ee1e81b7228e Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 16:06:52 +0300 Subject: [PATCH 22/40] Add breakpoint_api_cases --- .../tests/debugging/test_breakpoints.py | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index b7876e0ffc..150da46888 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -30,28 +30,19 @@ "numba-dppy-kernel": "common_loop_body", } +breakpoint_api_cases = [ + ("side-by-side.py:25", "numba"), + ("side-by-side.py:25", "numba-dppy-kernel"), + *((fn, api) for api, fn in common_loop_body_native_function_name.items()), + *( + (f"side-by-side.py:{fn}", api) + for api, fn in common_loop_body_native_function_name.items() + ), +] + @skip_no_numba055 -@pytest.mark.parametrize( - "breakpoint, api", - [ - ("side-by-side.py:25", "numba"), - ("side-by-side.py:25", "numba-dppy-kernel"), - (common_loop_body_native_function_name["numba"], "numba"), - ( - common_loop_body_native_function_name["numba-dppy-kernel"], - "numba-dppy-kernel", - ), - ( - f'side-by-side.py:{common_loop_body_native_function_name["numba"]}', - "numba", - ), - ( - f'side-by-side.py:{common_loop_body_native_function_name["numba-dppy-kernel"]}', - "numba-dppy-kernel", - ), - ], -) +@pytest.mark.parametrize("breakpoint, api", breakpoint_api_cases) def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): """Function breakpoints and argument initializing From 8103dfc4afc5beff19def61df5fbe83cd8e379b0 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 16:24:44 +0300 Subject: [PATCH 23/40] Add test_breakpoint_common --- .../tests/debugging/test_breakpoints.py | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index 150da46888..b10bf23965 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -66,16 +66,29 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): app.child.expect(fr"\$1 = {variable_value}") -def test_break_file_function(app): - """Set a breakpoint at the given location specified by file name and function name. - - commands/break_file_func - """ - app.breakpoint("simple_sum.py:data_parallel_sum") - app.run("simple_sum.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:23") - app.child.expect(r"23\s+i = dppy.get_global_id\(0\)") +@pytest.mark.parametrize( + "breakpoint, script, expected_location, expected_line", + [ + # location specified by file name and function name + # commands/break_file_func + ( + "simple_sum.py:data_parallel_sum", + "simple_sum.py", + "simple_sum.py:23", + r"23\s+i = dppy.get_global_id\(0\)", + ) + ], +) +def test_breakpoint_common( + app, breakpoint, script, expected_location, expected_line +): + """Set a breakpoint in the given script.""" + + app.breakpoint(breakpoint) + app.run(script) + + app.child.expect(fr"Thread .* hit Breakpoint .* at {expected_location}") + app.child.expect(expected_line) def test_break_function(app): From 82d9bb132427ec7edd7092fc5d7743df1ee10985 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 16:29:56 +0300 Subject: [PATCH 24/40] Replace test_break_function with parameter --- .../tests/debugging/test_breakpoints.py | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index b10bf23965..f3e0191958 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -76,7 +76,15 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): "simple_sum.py", "simple_sum.py:23", r"23\s+i = dppy.get_global_id\(0\)", - ) + ), + # location specified by function name + # commands/break_func + ( + "data_parallel_sum", + "simple_sum.py", + "simple_sum.py:23", + r"23\s+i = dppy.get_global_id\(0\)", + ), ], ) def test_breakpoint_common( @@ -91,18 +99,6 @@ def test_breakpoint_common( app.child.expect(expected_line) -def test_break_function(app): - """Set a breakpoint at the given location specified by function name. - - commands/break_func - """ - app.breakpoint("data_parallel_sum") - app.run("simple_sum.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:23") - app.child.expect(r"23\s+i = dppy.get_global_id\(0\)") - - def test_break_nested_function(app): """Set a breakpoint at the given location specified by file name and nested function name. From 6bb940b8580bafab929d4618aba3313365367360 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 16:33:55 +0300 Subject: [PATCH 25/40] Replace test_break_nested_function with parameter --- .../tests/debugging/test_breakpoints.py | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index f3e0191958..2b774389e5 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -85,6 +85,14 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): "simple_sum.py:23", r"23\s+i = dppy.get_global_id\(0\)", ), + # location specified by file name and nested function name + # commands/break_nested_func + ( + "simple_dppy_func.py:func_sum", + "simple_dppy_func.py", + "simple_dppy_func.py:23", + r"23\s+result = a_in_func \+ b_in_func", + ), ], ) def test_breakpoint_common( @@ -99,18 +107,6 @@ def test_breakpoint_common( app.child.expect(expected_line) -def test_break_nested_function(app): - """Set a breakpoint at the given location specified by file name and nested function name. - - commands/break_nested_func - """ - app.breakpoint("simple_dppy_func.py:func_sum") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:23") - app.child.expect(r"23\s+result = a_in_func \+ b_in_func") - - def test_break_conditional(app): """Set a breakpoint with condition. From 3ed7e60693eb65e6d3311f4fa48543ba8cfcf512 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 16:43:35 +0300 Subject: [PATCH 26/40] Add test_breakpoint_with_condition_common --- .../tests/debugging/test_breakpoints.py | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index 2b774389e5..154199281c 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -107,18 +107,37 @@ def test_breakpoint_common( app.child.expect(expected_line) -def test_break_conditional(app): - """Set a breakpoint with condition. - - commands/break_conditional - """ +@pytest.mark.parametrize( + "breakpoint, script, expected_location, expected_line, variable_name, variable_value", + [ + # commands/break_conditional + ( + "simple_sum.py:24 if i == 1", + "simple_sum.py", + "simple_sum.py:24", + r"24\s+c\[i\] = a\[i\] \+ b\[i\]", + "i", + "1", + ) + ], +) +def test_breakpoint_with_condition_common( + app, + breakpoint, + script, + expected_location, + expected_line, + variable_name, + variable_value, +): + """Set a breakpoint with condition and check value of variable.""" - app.breakpoint("simple_sum.py:24 if i == 1") - app.run("simple_sum.py") + app.breakpoint(breakpoint) + app.run(script) - app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:24") - app.child.expect(r"24\s+c\[i\] = a\[i\] \+ b\[i\]") + app.child.expect(fr"Thread .* hit Breakpoint .* at {expected_location}") + app.child.expect(expected_line) - app.print("i") + app.print(variable_name) - app.child.expect(r"\$1 = 1") + app.child.expect(fr"\$1 = {variable_value}") From d4d8f7a938d0c6c1c638ae6c9bcee6e91a1a1e55 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 17:30:09 +0300 Subject: [PATCH 27/40] Add common.py with script_path() and breakpoint_by_mark() --- numba_dppy/tests/debugging/common.py | 42 ++++++++++++++++++++++++++++ numba_dppy/tests/debugging/gdb.py | 7 ++--- 2 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 numba_dppy/tests/debugging/common.py diff --git a/numba_dppy/tests/debugging/common.py b/numba_dppy/tests/debugging/common.py new file mode 100644 index 0000000000..969c250bf0 --- /dev/null +++ b/numba_dppy/tests/debugging/common.py @@ -0,0 +1,42 @@ +#! /usr/bin/env python +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Common tools for testing debugging""" + +import pathlib + +import numba_dppy + + +def script_path(script): + package_path = pathlib.Path(numba_dppy.__file__).parent + return str(package_path / "examples/debug" / script) + + +def line_number(file_path, text): + """Return line number of the text in the file""" + with open(file_path, "r") as lines: + for line_number, line in enumerate(lines): + if text in line: + return line_number + 1 + + raise RuntimeError(f"Can not find {text} in {file_path}") + + +def breakpoint_by_mark(script, mark): + """Return breakpoint for the mark in the script + + Example: breakpoint_by_mark("script.py", "Set here") -> "script.py:25" + """ + return f"{script}:{line_number(script_path(script), mark)}" diff --git a/numba_dppy/tests/debugging/gdb.py b/numba_dppy/tests/debugging/gdb.py index abe5731617..dee0b89b57 100644 --- a/numba_dppy/tests/debugging/gdb.py +++ b/numba_dppy/tests/debugging/gdb.py @@ -15,14 +15,14 @@ import os -import pathlib import sys import pytest -import numba_dppy from numba_dppy import config +from .common import script_path + pexpect = pytest.importorskip("pexpect") @@ -100,5 +100,4 @@ def stepi(self): @staticmethod def script_path(script): - package_path = pathlib.Path(numba_dppy.__file__).parent - return str(package_path / "examples/debug" / script) + return script_path(script) From 678ccaffcc313f3b06c099339f90a4305bf2b689 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 17:49:51 +0300 Subject: [PATCH 28/40] Add test_common.py --- numba_dppy/tests/debugging/test_common.py | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 numba_dppy/tests/debugging/test_common.py diff --git a/numba_dppy/tests/debugging/test_common.py b/numba_dppy/tests/debugging/test_common.py new file mode 100644 index 0000000000..2893495377 --- /dev/null +++ b/numba_dppy/tests/debugging/test_common.py @@ -0,0 +1,27 @@ +#! /usr/bin/env python +# Copyright 2021 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for common tools""" + +import pytest + +from .common import breakpoint_by_mark + + +@pytest.mark.parametrize( + "file_name, mark, expected", + [("side-by-side.py", "Set breakpoint here", "side-by-side.py:25")], +) +def test_breakpoint_by_mark(file_name, mark, expected): + assert expected == breakpoint_by_mark(file_name, mark) From 94edf42dfddd9740e2ce66dbef35e40a9f953122 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 17:50:52 +0300 Subject: [PATCH 29/40] Add side_by_side_breakpoint --- numba_dppy/examples/debug/side-by-side.py | 2 +- numba_dppy/tests/debugging/test_breakpoints.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/numba_dppy/examples/debug/side-by-side.py b/numba_dppy/examples/debug/side-by-side.py index 51468b7902..887b6cb389 100644 --- a/numba_dppy/examples/debug/side-by-side.py +++ b/numba_dppy/examples/debug/side-by-side.py @@ -22,7 +22,7 @@ def common_loop_body(param_a, param_b): - param_c = param_a + 10 # Set breakpoint + param_c = param_a + 10 # Set breakpoint here param_d = param_b * 0.5 result = param_c + param_d return result diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index 154199281c..a51a0af4ae 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -22,17 +22,23 @@ from numba_dppy.tests._helper import skip_no_gdb, skip_no_numba055 +from .common import breakpoint_by_mark + pytestmark = skip_no_gdb +side_by_side_breakpoint = breakpoint_by_mark( + "side-by-side.py", "Set breakpoint here" +) + common_loop_body_native_function_name = { "numba": "common_loop_body_242", "numba-dppy-kernel": "common_loop_body", } breakpoint_api_cases = [ - ("side-by-side.py:25", "numba"), - ("side-by-side.py:25", "numba-dppy-kernel"), + (side_by_side_breakpoint, "numba"), + (side_by_side_breakpoint, "numba-dppy-kernel"), *((fn, api) for api, fn in common_loop_body_native_function_name.items()), *( (f"side-by-side.py:{fn}", api) @@ -59,7 +65,9 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): app.breakpoint(f"{breakpoint} if {condition}") app.run(f"side-by-side.py --api={api}") - app.child.expect(r"Thread .* hit Breakpoint .* at side-by-side.py:25") + app.child.expect( + fr"Thread .* hit Breakpoint .* at {side_by_side_breakpoint}" + ) app.print(variable_name) From 99a86506d9a7c2b10928a285825a501c3070437a Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 18:00:18 +0300 Subject: [PATCH 30/40] Use marks for simple_sum.py --- numba_dppy/examples/debug/simple_sum.py | 4 ++-- numba_dppy/tests/debugging/test_breakpoints.py | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/numba_dppy/examples/debug/simple_sum.py b/numba_dppy/examples/debug/simple_sum.py index a69f3cee04..9daa041b19 100644 --- a/numba_dppy/examples/debug/simple_sum.py +++ b/numba_dppy/examples/debug/simple_sum.py @@ -20,8 +20,8 @@ @dppy.kernel(debug=True) def data_parallel_sum(a, b, c): - i = dppy.get_global_id(0) - c[i] = a[i] + b[i] + i = dppy.get_global_id(0) # Function breakpoint location + c[i] = a[i] + b[i] # Condition breakpoint location global_size = 10 diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index a51a0af4ae..a1983cf8f4 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -31,6 +31,13 @@ "side-by-side.py", "Set breakpoint here" ) +simple_sum_function_breakpoint = breakpoint_by_mark( + "simple_sum.py", "Function breakpoint location" +) +simple_sum_condition_breakpoint = breakpoint_by_mark( + "simple_sum.py", "Condition breakpoint location" +) + common_loop_body_native_function_name = { "numba": "common_loop_body_242", "numba-dppy-kernel": "common_loop_body", @@ -82,7 +89,7 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): ( "simple_sum.py:data_parallel_sum", "simple_sum.py", - "simple_sum.py:23", + simple_sum_function_breakpoint, r"23\s+i = dppy.get_global_id\(0\)", ), # location specified by function name @@ -90,7 +97,7 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): ( "data_parallel_sum", "simple_sum.py", - "simple_sum.py:23", + simple_sum_function_breakpoint, r"23\s+i = dppy.get_global_id\(0\)", ), # location specified by file name and nested function name @@ -120,9 +127,9 @@ def test_breakpoint_common( [ # commands/break_conditional ( - "simple_sum.py:24 if i == 1", + f"{simple_sum_condition_breakpoint} if i == 1", "simple_sum.py", - "simple_sum.py:24", + simple_sum_condition_breakpoint, r"24\s+c\[i\] = a\[i\] \+ b\[i\]", "i", "1", From ab5c486bec63368ed7d815725f6e341a927f1d40 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 18:48:37 +0300 Subject: [PATCH 31/40] Add breakpoint_by_function() --- numba_dppy/examples/debug/simple_sum.py | 2 +- numba_dppy/tests/debugging/common.py | 9 +++++++-- numba_dppy/tests/debugging/test_breakpoints.py | 15 ++++++--------- numba_dppy/tests/debugging/test_common.py | 10 +++++++++- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/numba_dppy/examples/debug/simple_sum.py b/numba_dppy/examples/debug/simple_sum.py index 9daa041b19..a333c66855 100644 --- a/numba_dppy/examples/debug/simple_sum.py +++ b/numba_dppy/examples/debug/simple_sum.py @@ -20,7 +20,7 @@ @dppy.kernel(debug=True) def data_parallel_sum(a, b, c): - i = dppy.get_global_id(0) # Function breakpoint location + i = dppy.get_global_id(0) c[i] = a[i] + b[i] # Condition breakpoint location diff --git a/numba_dppy/tests/debugging/common.py b/numba_dppy/tests/debugging/common.py index 969c250bf0..79ebf36937 100644 --- a/numba_dppy/tests/debugging/common.py +++ b/numba_dppy/tests/debugging/common.py @@ -34,9 +34,14 @@ def line_number(file_path, text): raise RuntimeError(f"Can not find {text} in {file_path}") -def breakpoint_by_mark(script, mark): +def breakpoint_by_mark(script, mark, offset=0): """Return breakpoint for the mark in the script Example: breakpoint_by_mark("script.py", "Set here") -> "script.py:25" """ - return f"{script}:{line_number(script_path(script), mark)}" + return f"{script}:{line_number(script_path(script), mark) + offset}" + + +def breakpoint_by_function(script, function): + """Return breakpoint for the function in the script""" + return breakpoint_by_mark(script, f"def {function}", 1) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index a1983cf8f4..8170473e4d 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -22,18 +22,15 @@ from numba_dppy.tests._helper import skip_no_gdb, skip_no_numba055 -from .common import breakpoint_by_mark +from .common import breakpoint_by_function, breakpoint_by_mark pytestmark = skip_no_gdb -side_by_side_breakpoint = breakpoint_by_mark( - "side-by-side.py", "Set breakpoint here" +side_by_side_breakpoint = breakpoint_by_function( + "side-by-side.py", "common_loop_body" ) -simple_sum_function_breakpoint = breakpoint_by_mark( - "simple_sum.py", "Function breakpoint location" -) simple_sum_condition_breakpoint = breakpoint_by_mark( "simple_sum.py", "Condition breakpoint location" ) @@ -89,7 +86,7 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): ( "simple_sum.py:data_parallel_sum", "simple_sum.py", - simple_sum_function_breakpoint, + breakpoint_by_function("simple_sum.py", "data_parallel_sum"), r"23\s+i = dppy.get_global_id\(0\)", ), # location specified by function name @@ -97,7 +94,7 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): ( "data_parallel_sum", "simple_sum.py", - simple_sum_function_breakpoint, + breakpoint_by_function("simple_sum.py", "data_parallel_sum"), r"23\s+i = dppy.get_global_id\(0\)", ), # location specified by file name and nested function name @@ -105,7 +102,7 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): ( "simple_dppy_func.py:func_sum", "simple_dppy_func.py", - "simple_dppy_func.py:23", + breakpoint_by_function("simple_dppy_func.py", "func_sum"), r"23\s+result = a_in_func \+ b_in_func", ), ], diff --git a/numba_dppy/tests/debugging/test_common.py b/numba_dppy/tests/debugging/test_common.py index 2893495377..e479a470d4 100644 --- a/numba_dppy/tests/debugging/test_common.py +++ b/numba_dppy/tests/debugging/test_common.py @@ -16,7 +16,7 @@ import pytest -from .common import breakpoint_by_mark +from .common import breakpoint_by_function, breakpoint_by_mark @pytest.mark.parametrize( @@ -25,3 +25,11 @@ ) def test_breakpoint_by_mark(file_name, mark, expected): assert expected == breakpoint_by_mark(file_name, mark) + + +@pytest.mark.parametrize( + "file_name, function, expected", + [("side-by-side.py", "common_loop_body", "side-by-side.py:25")], +) +def test_breakpoint_by_function(file_name, function, expected): + assert expected == breakpoint_by_function(file_name, function) From eeb57b1fa3257808950820fcd4acc89ccc7f056b Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 21:07:15 +0300 Subject: [PATCH 32/40] Add setup_breakpoint() --- numba_dppy/tests/debugging/common.py | 26 +++++++++++++++++++++++ numba_dppy/tests/debugging/test_common.py | 24 ++++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/numba_dppy/tests/debugging/common.py b/numba_dppy/tests/debugging/common.py index 79ebf36937..91e3446549 100644 --- a/numba_dppy/tests/debugging/common.py +++ b/numba_dppy/tests/debugging/common.py @@ -45,3 +45,29 @@ def breakpoint_by_mark(script, mark, offset=0): def breakpoint_by_function(script, function): """Return breakpoint for the function in the script""" return breakpoint_by_mark(script, f"def {function}", 1) + + +def setup_breakpoint( + app, + breakpoint: str, + script=None, + expected_location=None, + expected_line=None, +): + if not script: + script = breakpoint.split(" ")[0].split(":")[0] + + if not expected_location: + expected_location = breakpoint.split(" ")[0] + if not expected_location.split(":")[-1].isnumeric(): + expected_location = breakpoint_by_function( + script, expected_location.split(":")[-1] + ) + + app.breakpoint(breakpoint) + app.run(script) + + app.child.expect(fr"Thread .* hit Breakpoint .* at {expected_location}") + + if expected_line: + app.child.expect(expected_line) diff --git a/numba_dppy/tests/debugging/test_common.py b/numba_dppy/tests/debugging/test_common.py index e479a470d4..f89185988e 100644 --- a/numba_dppy/tests/debugging/test_common.py +++ b/numba_dppy/tests/debugging/test_common.py @@ -16,7 +16,7 @@ import pytest -from .common import breakpoint_by_function, breakpoint_by_mark +from .common import breakpoint_by_function, breakpoint_by_mark, setup_breakpoint @pytest.mark.parametrize( @@ -33,3 +33,25 @@ def test_breakpoint_by_mark(file_name, mark, expected): ) def test_breakpoint_by_function(file_name, function, expected): assert expected == breakpoint_by_function(file_name, function) + + +@pytest.mark.parametrize( + "breakpoint, script, expected_location, expected_line", + [ + ( + "simple_sum.py:24", + "simple_sum.py", + "simple_sum.py:24", + r"24\s+c\[i\] = a\[i\] \+ b\[i\]", + ), + ("simple_sum.py:24", "simple_sum.py", "simple_sum.py:24", None), + ("simple_sum.py:24", "simple_sum.py", None, None), + ("simple_sum.py:24", None, None, None), + ("simple_sum.py:data_parallel_sum", None, None, None), + ("data_parallel_sum", "simple_sum.py", None, None), + ], +) +def test_setup_breakpoint( + app, breakpoint, script, expected_location, expected_line +): + setup_breakpoint(app, breakpoint, script, expected_location, expected_line) From 0d562abc1c5b070ad1ea1c300bcd4954d1db6e16 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 21:28:56 +0300 Subject: [PATCH 33/40] Use setup_breakpoint --- .../tests/debugging/test_breakpoints.py | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index 8170473e4d..d77cf70197 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -22,7 +22,7 @@ from numba_dppy.tests._helper import skip_no_gdb, skip_no_numba055 -from .common import breakpoint_by_function, breakpoint_by_mark +from .common import breakpoint_by_function, breakpoint_by_mark, setup_breakpoint pytestmark = skip_no_gdb @@ -79,14 +79,13 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): @pytest.mark.parametrize( - "breakpoint, script, expected_location, expected_line", + "breakpoint, script, expected_line", [ # location specified by file name and function name # commands/break_file_func ( "simple_sum.py:data_parallel_sum", - "simple_sum.py", - breakpoint_by_function("simple_sum.py", "data_parallel_sum"), + None, r"23\s+i = dppy.get_global_id\(0\)", ), # location specified by function name @@ -94,39 +93,30 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): ( "data_parallel_sum", "simple_sum.py", - breakpoint_by_function("simple_sum.py", "data_parallel_sum"), r"23\s+i = dppy.get_global_id\(0\)", ), # location specified by file name and nested function name # commands/break_nested_func ( "simple_dppy_func.py:func_sum", - "simple_dppy_func.py", - breakpoint_by_function("simple_dppy_func.py", "func_sum"), + None, r"23\s+result = a_in_func \+ b_in_func", ), ], ) def test_breakpoint_common( - app, breakpoint, script, expected_location, expected_line + app, breakpoint, script, expected_line ): """Set a breakpoint in the given script.""" - - app.breakpoint(breakpoint) - app.run(script) - - app.child.expect(fr"Thread .* hit Breakpoint .* at {expected_location}") - app.child.expect(expected_line) + setup_breakpoint(app, breakpoint, script=script, expected_line=expected_line) @pytest.mark.parametrize( - "breakpoint, script, expected_location, expected_line, variable_name, variable_value", + "breakpoint, expected_line, variable_name, variable_value", [ # commands/break_conditional ( f"{simple_sum_condition_breakpoint} if i == 1", - "simple_sum.py", - simple_sum_condition_breakpoint, r"24\s+c\[i\] = a\[i\] \+ b\[i\]", "i", "1", @@ -136,19 +126,13 @@ def test_breakpoint_common( def test_breakpoint_with_condition_common( app, breakpoint, - script, - expected_location, expected_line, variable_name, variable_value, ): """Set a breakpoint with condition and check value of variable.""" - app.breakpoint(breakpoint) - app.run(script) - - app.child.expect(fr"Thread .* hit Breakpoint .* at {expected_location}") - app.child.expect(expected_line) + setup_breakpoint(app, breakpoint, expected_line=expected_line) app.print(variable_name) From 3e53fd269dba68305dc725a396a6b7f09ba047e7 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 21:33:43 +0300 Subject: [PATCH 34/40] Remove expected_line --- .../tests/debugging/test_breakpoints.py | 38 +++++-------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/numba_dppy/tests/debugging/test_breakpoints.py b/numba_dppy/tests/debugging/test_breakpoints.py index d77cf70197..58ec8008ea 100644 --- a/numba_dppy/tests/debugging/test_breakpoints.py +++ b/numba_dppy/tests/debugging/test_breakpoints.py @@ -79,60 +79,40 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api): @pytest.mark.parametrize( - "breakpoint, script, expected_line", + "breakpoint, script", [ # location specified by file name and function name # commands/break_file_func - ( - "simple_sum.py:data_parallel_sum", - None, - r"23\s+i = dppy.get_global_id\(0\)", - ), + ("simple_sum.py:data_parallel_sum", None), # location specified by function name # commands/break_func - ( - "data_parallel_sum", - "simple_sum.py", - r"23\s+i = dppy.get_global_id\(0\)", - ), + ("data_parallel_sum", "simple_sum.py"), # location specified by file name and nested function name # commands/break_nested_func - ( - "simple_dppy_func.py:func_sum", - None, - r"23\s+result = a_in_func \+ b_in_func", - ), + ("simple_dppy_func.py:func_sum", None), ], ) -def test_breakpoint_common( - app, breakpoint, script, expected_line -): +def test_breakpoint_common(app, breakpoint, script): """Set a breakpoint in the given script.""" - setup_breakpoint(app, breakpoint, script=script, expected_line=expected_line) + setup_breakpoint(app, breakpoint, script=script) @pytest.mark.parametrize( - "breakpoint, expected_line, variable_name, variable_value", + "breakpoint, variable_name, variable_value", [ # commands/break_conditional - ( - f"{simple_sum_condition_breakpoint} if i == 1", - r"24\s+c\[i\] = a\[i\] \+ b\[i\]", - "i", - "1", - ) + (f"{simple_sum_condition_breakpoint} if i == 1", "i", "1"), ], ) def test_breakpoint_with_condition_common( app, breakpoint, - expected_line, variable_name, variable_value, ): """Set a breakpoint with condition and check value of variable.""" - setup_breakpoint(app, breakpoint, expected_line=expected_line) + setup_breakpoint(app, breakpoint) app.print(variable_name) From 34fc8454c88d9e3309576d329777ebe212ca8d43 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Fri, 17 Dec 2021 21:44:56 +0300 Subject: [PATCH 35/40] Use setup_breakpoint --- numba_dppy/tests/debugging/test_backtraces.py | 13 ++++---- numba_dppy/tests/debugging/test_info.py | 30 ++++++++--------- numba_dppy/tests/debugging/test_stepping.py | 32 ++++++++----------- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/numba_dppy/tests/debugging/test_backtraces.py b/numba_dppy/tests/debugging/test_backtraces.py index fca2765ad1..c812e9231e 100644 --- a/numba_dppy/tests/debugging/test_backtraces.py +++ b/numba_dppy/tests/debugging/test_backtraces.py @@ -19,6 +19,8 @@ from numba_dppy.tests._helper import skip_no_gdb +from .common import setup_breakpoint + pytestmark = skip_no_gdb @@ -27,12 +29,11 @@ def test_backtrace(app): commands/backtrace """ - - app.breakpoint("simple_dppy_func.py:23") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:23") - app.child.expect(r"23\s+result = a_in_func \+ b_in_func") + setup_breakpoint( + app, + "simple_dppy_func.py:23", + expected_line=r"23\s+result = a_in_func \+ b_in_func", + ) app.backtrace() diff --git a/numba_dppy/tests/debugging/test_info.py b/numba_dppy/tests/debugging/test_info.py index 5739d1fe72..51e1581493 100644 --- a/numba_dppy/tests/debugging/test_info.py +++ b/numba_dppy/tests/debugging/test_info.py @@ -19,16 +19,18 @@ from numba_dppy.tests._helper import skip_no_gdb, skip_no_numba055 +from .common import setup_breakpoint + pytestmark = skip_no_gdb @skip_no_numba055 def test_info_args(app): - app.breakpoint("simple_dppy_func.py:29") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:29") - app.child.expect(r"29\s+i = dppy.get_global_id\(0\)") + setup_breakpoint( + app, + "simple_dppy_func.py:29", + expected_line=r"29\s+i = dppy.get_global_id\(0\)", + ) app.info_args() @@ -49,11 +51,11 @@ def test_info_args(app): # commands/info_func @skip_no_numba055 def test_info_functions(app): - app.breakpoint("simple_sum.py:23") - app.run("simple_sum.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_sum.py:23") - app.child.expect(r"23\s+i = dppy.get_global_id\(0\)") + setup_breakpoint( + app, + "simple_sum.py:23", + expected_line=r"23\s+i = dppy.get_global_id\(0\)", + ) app.info_functions("data_parallel_sum") @@ -63,11 +65,9 @@ def test_info_functions(app): # commands/local_variables_0 @skip_no_numba055 def test_local_variables(app): - app.breakpoint("sum_local_vars.py:26") - app.run("sum_local_vars.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at sum_local_vars.py:26") - app.child.expect(r"26\s+c\[i\] = l1 \+ l2") + setup_breakpoint( + app, "sum_local_vars.py:26", expected_line=r"26\s+c\[i\] = l1 \+ l2" + ) app.info_locals() diff --git a/numba_dppy/tests/debugging/test_stepping.py b/numba_dppy/tests/debugging/test_stepping.py index a368b25398..236184bf87 100644 --- a/numba_dppy/tests/debugging/test_stepping.py +++ b/numba_dppy/tests/debugging/test_stepping.py @@ -19,17 +19,17 @@ from numba_dppy.tests._helper import skip_no_gdb +from .common import setup_breakpoint + pytestmark = skip_no_gdb # commands/next def test_next(app): - app.breakpoint("simple_dppy_func.py:30") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:30") - app.child.expect( - r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" + setup_breakpoint( + app, + "simple_dppy_func.py:30", + expected_line=r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)", ) app.next() @@ -40,12 +40,10 @@ def test_next(app): # commands/step_dppy_func def test_step(app): - app.breakpoint("simple_dppy_func.py:30") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:30") - app.child.expect( - r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" + setup_breakpoint( + app, + "simple_dppy_func.py:30", + expected_line=r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)", ) app.step() @@ -57,12 +55,10 @@ def test_step(app): # commands/stepi def test_stepi(app): - app.breakpoint("simple_dppy_func.py:30") - app.run("simple_dppy_func.py") - - app.child.expect(r"Thread .* hit Breakpoint .* at simple_dppy_func.py:30") - app.child.expect( - r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)" + setup_breakpoint( + app, + "simple_dppy_func.py:30", + expected_line=r"30\s+c_in_kernel\[i\] = func_sum\(a_in_kernel\[i\], b_in_kernel\[i\]\)", ) app.stepi() From 3f5d744208aeb236212ce4376a2ec938b73e59fa Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Mon, 20 Dec 2021 18:06:13 +0300 Subject: [PATCH 36/40] Skip if no GDB for test_common.py --- numba_dppy/tests/debugging/test_common.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/numba_dppy/tests/debugging/test_common.py b/numba_dppy/tests/debugging/test_common.py index f89185988e..601012c66d 100644 --- a/numba_dppy/tests/debugging/test_common.py +++ b/numba_dppy/tests/debugging/test_common.py @@ -16,8 +16,12 @@ import pytest +from numba_dppy.tests._helper import skip_no_gdb + from .common import breakpoint_by_function, breakpoint_by_mark, setup_breakpoint +pytestmark = skip_no_gdb + @pytest.mark.parametrize( "file_name, mark, expected", From 4d614c3d96e46272913525d26839c5c1e22b463f Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Tue, 21 Dec 2021 13:06:20 +0300 Subject: [PATCH 37/40] Add examples into package --- MANIFEST.in | 2 ++ setup.py | 1 + 2 files changed, 3 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index 4c02572c56..895fc6f2b4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,3 +6,5 @@ recursive-include numba_dppy *.spir include versioneer.py include numba_dppy/_version.py + +recursive-include numba_dppy/examples * diff --git a/setup.py b/setup.py index 31d3026bee..894bf633e6 100644 --- a/setup.py +++ b/setup.py @@ -152,6 +152,7 @@ def spirv_compile(): setup_requires=build_requires, install_requires=install_requires, include_package_data=True, + zip_safe=False, ext_modules=get_ext_modules(), author="Intel Corporation", classifiers=[ From f13911654fab681aec4e0fb31a1604aae7deb806 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Wed, 22 Dec 2021 11:01:56 +0300 Subject: [PATCH 38/40] Print more info for testing --- .github/workflows/conda-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index f83de335bf..b0761ecace 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -207,7 +207,7 @@ jobs: run: | # echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd export OCL_ICD_FILENAMES=libintelocl.so - python -m pytest --pyargs $MODULE_NAME + python -m pytest -q -ra --disable-warnings --pyargs $MODULE_NAME -vv test_windows: needs: build_windows @@ -275,7 +275,7 @@ jobs: run: echo "NUMBA_DPPY_TESTING_SKIP_NO_DPNP=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Run tests run: | - python -m pytest --pyargs ${{ env.MODULE_NAME }} + python -m pytest -q -ra --disable-warnings --pyargs ${{ env.MODULE_NAME }} -vv upload_linux: needs: test_linux From 933b014f607036a9e340e51428d41c4c202b74e8 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Wed, 22 Dec 2021 11:07:29 +0300 Subject: [PATCH 39/40] Skip tests with app() if pexpect not installed --- numba_dppy/tests/debugging/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/numba_dppy/tests/debugging/conftest.py b/numba_dppy/tests/debugging/conftest.py index e22cca9c6f..e3c72e9204 100644 --- a/numba_dppy/tests/debugging/conftest.py +++ b/numba_dppy/tests/debugging/conftest.py @@ -15,9 +15,9 @@ import pytest -from .gdb import gdb - @pytest.fixture def app(): + from .gdb import gdb + return gdb() From 9768b572c41a84c78a0c9d55189f3d64f3143237 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Wed, 22 Dec 2021 12:02:22 +0300 Subject: [PATCH 40/40] Add pexpect in test dependencies --- conda-recipe/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index a459037ab3..ca4ab7a300 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -37,6 +37,7 @@ test: requires: - pytest - {{ compiler('dpcpp') }} # [not osx] + - pexpect about: home: https://github.com/IntelPython/numba-dppy