Skip to content

Commit 6ca670d

Browse files
authored
Merge pull request #1209 from roxx30198/ci_gdb
Added gdb tests in CI
2 parents f38d005 + 1554899 commit 6ca670d

File tree

7 files changed

+86
-11
lines changed

7 files changed

+86
-11
lines changed

.github/workflows/conda-package.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
access_token: ${{ github.token }}
4545

4646
- name: Checkout ${{ env.PACKAGE_NAME }} repo
47-
uses: actions/checkout@v3
47+
uses: actions/checkout@v4
4848
with:
4949
fetch-depth: 0
5050

@@ -105,6 +105,10 @@ jobs:
105105
os: [ubuntu-20.04, ubuntu-latest, windows-latest]
106106
experimental: [false]
107107
use_mlir: [false]
108+
run_gdb: [true, false]
109+
exclude:
110+
- os: windows-latest
111+
run_gdb: true
108112

109113
continue-on-error: ${{ matrix.experimental || matrix.use_mlir }}
110114

@@ -168,7 +172,7 @@ jobs:
168172
# We want to make sure that all dependecies install automatically.
169173
# intel::intel-opencl-rt is needed for set-intel-ocl-icd-registry.ps1
170174
- name: Install builded package
171-
run: mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} intel::intel-opencl-rt pytest -c ${{ env.CHANNEL_PATH }}
175+
run: mamba install ${{ env.PACKAGE_NAME }}=${{ env.PACKAGE_VERSION }} intel::intel-opencl-rt pytest-cov -c ${{ env.CHANNEL_PATH }}
172176

173177
- name: Install numba-mlir
174178
if: matrix.use_mlir
@@ -181,6 +185,13 @@ jobs:
181185
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
182186
&$script_path
183187
188+
- name: Checkout setup config
189+
uses: actions/checkout@v4
190+
with:
191+
sparse-checkout: |
192+
pyproject.toml
193+
sparse-checkout-cone-mode: false
194+
184195
- name: List installed packages
185196
run: conda list
186197

@@ -194,12 +205,14 @@ jobs:
194205
run: python -c "import dpnp, dpctl, numba_dpex; dpctl.lsplatform()"
195206

196207
- name: Run tests
208+
if: ${{!matrix.run_gdb}}
197209
env:
198210
NUMBA_DPEX_USE_MLIR: ${{ matrix.use_mlir && '1' || '0' }}
199211
run: |
200212
pytest -q -ra --disable-warnings --pyargs ${{ env.MODULE_NAME }} -vv
201213
202214
- name: Run examples
215+
if: ${{!matrix.run_gdb}}
203216
shell: bash -l {0}
204217
run: |
205218
cd ${{ env.EXAMPLES_PATH }}
@@ -209,6 +222,21 @@ jobs:
209222
python ${script} || exit 1
210223
done
211224
225+
- name: Run gdb tests
226+
if: ${{matrix.run_gdb}}
227+
env:
228+
GDB_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/fcea1bcd-6a63-4849-b304-906ff71dc2c0/l_dpcpp_dbg_p_2023.2.0.49333_offline.sh
229+
GDB_INSTALLER: l_dpcpp_dbg_p_2023.2.0.49333_offline.sh
230+
run: |
231+
conda install pexpect
232+
wget -nc -q ${{ env.GDB_URL }}
233+
chmod +x ${{ env.GDB_INSTALLER }}
234+
mkdir /tmp/gdb
235+
export ONEAPI_ROOT=/tmp/gdb
236+
./${{ env.GDB_INSTALLER }} -a -s --eula accept --install-dir $ONEAPI_ROOT
237+
source $ONEAPI_ROOT/debugger/latest/env/vars.sh
238+
pytest -q -ra --disable-warnings --pyargs ${{ env.MODULE_NAME }}.tests.debugging -vv
239+
212240
upload_anaconda:
213241
name: Upload dppy/label/dev ['${{ matrix.os }}', python='${{ matrix.python }}']
214242
if: ${{github.ref == 'refs/heads/main' || (startsWith(github.ref, 'refs/heads/release') == true)}}
@@ -285,7 +313,7 @@ jobs:
285313
run: conda install anaconda-client
286314

287315
- name: Checkout repo
288-
uses: actions/checkout@v2
316+
uses: actions/checkout@v4
289317
with:
290318
repository: IntelPython/devops-tools
291319
fetch-depth: 0

numba_dpex/tests/debugging/test_backtraces.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
99
https://www.sourceware.org/gdb/onlinedocs/gdb/Backtrace.html
1010
"""
11+
import pytest
1112

1213
from numba_dpex.tests._helper import skip_no_gdb
1314

@@ -16,6 +17,7 @@
1617
pytestmark = skip_no_gdb
1718

1819

20+
@pytest.mark.xfail # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
1921
def test_backtrace(app):
2022
"""Simple test for backtrace.
2123

numba_dpex/tests/debugging/test_breakpoints.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api):
5757
Test for https://github.com/numba/numba/issues/7415
5858
SAT-4449
5959
"""
60+
if api == "numba-dpex-kernel":
61+
pytest.xfail(
62+
"Wrong name for kernel api."
63+
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
64+
6065
variable_name = "param_a"
6166
variable_value = "3"
6267
condition = f"{variable_name} == {variable_value}"
@@ -73,6 +78,7 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api):
7378
app.child.expect(rf"\$1 = {variable_value}")
7479

7580

81+
@pytest.mark.xfail # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
7682
@pytest.mark.parametrize(
7783
"breakpoint, script",
7884
[

numba_dpex/tests/debugging/test_common.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,12 @@ def test_breakpoint_by_function(file_name, function, expected):
5050
def test_setup_breakpoint(
5151
app, breakpoint, script, expected_location, expected_line
5252
):
53+
if (
54+
breakpoint == "simple_sum.py:data_parallel_sum"
55+
or breakpoint == "data_parallel_sum"
56+
):
57+
pytest.xfail(
58+
"Expected failures for these files."
59+
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
60+
5361
setup_breakpoint(app, breakpoint, script, expected_location, expected_line)

numba_dpex/tests/debugging/test_info.py

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ def test_info_args(
7070
Issue: https://github.com/numba/numba/issues/7414
7171
Fix: https://github.com/numba/numba/pull/7177
7272
"""
73+
if (
74+
script == "simple_dpex_func.py"
75+
or script == "side-by-side.py --api=numba-dpex-kernel"
76+
):
77+
pytest.xfail(
78+
"Expected Failure for these files."
79+
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
7380

7481
setup_breakpoint(app, breakpoint, script, expected_line=expected_line)
7582

@@ -90,6 +97,7 @@ def test_info_args(
9097
app.child.expect(expected_whatis)
9198

9299

100+
@pytest.mark.xfail # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
93101
@skip_no_numba056
94102
def test_info_functions(app):
95103
expected_line = r"13\s+i = dpex.get_global_id\(0\)"
@@ -145,7 +153,7 @@ def side_by_side_2_info_locals_case(api):
145153
@pytest.mark.parametrize(
146154
"env, breakpoint, script, expected_line, expected_info_locals, expected_info",
147155
[
148-
(
156+
pytest.param(
149157
{"NUMBA_OPT": 0},
150158
"sum_local_vars.py:16",
151159
"sum_local_vars.py",
@@ -175,6 +183,7 @@ def side_by_side_2_info_locals_case(api):
175183
r"type = float64",
176184
),
177185
),
186+
marks=pytest.mark.xfail,
178187
),
179188
# FIXME: NUMBA_OPT=1 will not able to stop at breakpoint
180189
pytest.param(
@@ -184,36 +193,42 @@ def side_by_side_2_info_locals_case(api):
184193
r"16\s+c\[i\] = l1 \+ l2",
185194
("No locals.",),
186195
(),
187-
marks=pytest.mark.xfail,
196+
marks=pytest.mark.xfail, # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
188197
),
189-
(
198+
pytest.param(
190199
{"NUMBA_EXTEND_VARIABLE_LIFETIMES": 1},
191200
"side-by-side.py:18",
192201
"side-by-side.py --api=numba-dpex-kernel",
193202
None,
194203
(r"param_c = 0", r"param_d = 0", r"result = 10"),
195204
(),
205+
marks=pytest.mark.xfail, # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
196206
),
197-
(
207+
pytest.param(
198208
{"NUMBA_EXTEND_VARIABLE_LIFETIMES": 0},
199209
"side-by-side.py:18",
200210
"side-by-side.py --api=numba-dpex-kernel",
201211
None,
202212
(r"param_c = 0", r"param_d = 0", r"result = 10"),
203213
(),
214+
marks=pytest.mark.xfail, # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
204215
),
205216
side_by_side_info_locals_case("numba"),
206217
pytest.param(
207218
*side_by_side_info_locals_case("numba-dpex-kernel"),
208219
marks=[
209-
pytest.mark.xfail(reason="dpex isn't stoping with condition")
220+
pytest.mark.xfail(
221+
reason="dpex isn't stoping with condition"
222+
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
210223
],
211224
),
212225
side_by_side_2_info_locals_case("numba"),
213226
pytest.param(
214227
*side_by_side_2_info_locals_case("numba-dpex-kernel"),
215228
marks=[
216-
pytest.mark.xfail(reason="dpex isn't stoping with condition")
229+
pytest.mark.xfail(
230+
reason="dpex isn't stoping with condition"
231+
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
217232
],
218233
),
219234
],
@@ -277,7 +292,9 @@ def side_by_side_2_print_array_element_case(api):
277292
pytest.param(
278293
*side_by_side_2_print_array_element_case("numba-dpex-kernel"),
279294
marks=[
280-
pytest.mark.xfail(reason="dpex isn't stoping with condition")
295+
pytest.mark.xfail(
296+
reason="dpex isn't stoping with condition"
297+
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
281298
],
282299
),
283300
],
@@ -294,6 +311,8 @@ def test_print_array_element(app, breakpoint, script, expected_info):
294311
app.child.expect(expected_print)
295312

296313

314+
# FIXME: crashes test execution
315+
@pytest.mark.skip # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
297316
def side_by_side_2_assignment_to_variable_case(api):
298317
return (
299318
"side-by-side-2.py:19 if param_a == 5",
@@ -316,7 +335,9 @@ def side_by_side_2_assignment_to_variable_case(api):
316335
pytest.param(
317336
*side_by_side_2_assignment_to_variable_case("numba-dpex-kernel"),
318337
marks=[
319-
pytest.mark.xfail(reason="dpex isn't stoping with condition")
338+
pytest.mark.xfail(
339+
reason="dpex isn't stoping with condition"
340+
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
320341
],
321342
),
322343
],

numba_dpex/tests/debugging/test_side_by_side.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
def test_breakpoint_row_number(app, api):
1919
"""Test for checking numba and numba-dpex debugging side-by-side."""
2020

21+
if api == "numba-dpex-kernel":
22+
pytest.xfail(
23+
"Wrong name for kernel api."
24+
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
25+
2126
app.breakpoint("side-by-side.py:15")
2227
app.run("side-by-side.py --api={api}".format(api=api))
2328

numba_dpex/tests/debugging/test_stepping.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
https://www.sourceware.org/gdb/onlinedocs/gdb/Continuing-and-Stepping.html
1010
"""
1111

12+
import pytest
13+
1214
from numba_dpex.tests._helper import skip_no_gdb
1315

1416
from .common import setup_breakpoint
@@ -17,6 +19,7 @@
1719

1820

1921
# commands/next
22+
@pytest.mark.xfail # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
2023
def test_next(app):
2124
setup_breakpoint(
2225
app,
@@ -31,6 +34,7 @@ def test_next(app):
3134

3235

3336
# commands/step_dpex_func
37+
@pytest.mark.xfail # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
3438
def test_step(app):
3539
setup_breakpoint(
3640
app,
@@ -46,6 +50,7 @@ def test_step(app):
4650

4751

4852
# commands/stepi
53+
@pytest.mark.xfail # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
4954
def test_stepi(app):
5055
setup_breakpoint(
5156
app,

0 commit comments

Comments
 (0)