Skip to content

Commit

Permalink
Added gdb tests to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
roxx30198 committed Nov 15, 2023
1 parent f38d005 commit 1554899
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 11 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
access_token: ${{ github.token }}

- name: Checkout ${{ env.PACKAGE_NAME }} repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -105,6 +105,10 @@ jobs:
os: [ubuntu-20.04, ubuntu-latest, windows-latest]
experimental: [false]
use_mlir: [false]
run_gdb: [true, false]
exclude:
- os: windows-latest
run_gdb: true

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

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

- name: Install numba-mlir
if: matrix.use_mlir
Expand All @@ -181,6 +185,13 @@ jobs:
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
&$script_path
- name: Checkout setup config
uses: actions/checkout@v4
with:
sparse-checkout: |
pyproject.toml
sparse-checkout-cone-mode: false

- name: List installed packages
run: conda list

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

- name: Run tests
if: ${{!matrix.run_gdb}}
env:
NUMBA_DPEX_USE_MLIR: ${{ matrix.use_mlir && '1' || '0' }}
run: |
pytest -q -ra --disable-warnings --pyargs ${{ env.MODULE_NAME }} -vv
- name: Run examples
if: ${{!matrix.run_gdb}}
shell: bash -l {0}
run: |
cd ${{ env.EXAMPLES_PATH }}
Expand All @@ -209,6 +222,21 @@ jobs:
python ${script} || exit 1
done
- name: Run gdb tests
if: ${{matrix.run_gdb}}
env:
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
GDB_INSTALLER: l_dpcpp_dbg_p_2023.2.0.49333_offline.sh
run: |
conda install pexpect
wget -nc -q ${{ env.GDB_URL }}
chmod +x ${{ env.GDB_INSTALLER }}
mkdir /tmp/gdb
export ONEAPI_ROOT=/tmp/gdb
./${{ env.GDB_INSTALLER }} -a -s --eula accept --install-dir $ONEAPI_ROOT
source $ONEAPI_ROOT/debugger/latest/env/vars.sh
pytest -q -ra --disable-warnings --pyargs ${{ env.MODULE_NAME }}.tests.debugging -vv
upload_anaconda:
name: Upload dppy/label/dev ['${{ matrix.os }}', python='${{ matrix.python }}']
if: ${{github.ref == 'refs/heads/main' || (startsWith(github.ref, 'refs/heads/release') == true)}}
Expand Down Expand Up @@ -285,7 +313,7 @@ jobs:
run: conda install anaconda-client

- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: IntelPython/devops-tools
fetch-depth: 0
Expand Down
2 changes: 2 additions & 0 deletions numba_dpex/tests/debugging/test_backtraces.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
https://www.sourceware.org/gdb/onlinedocs/gdb/Backtrace.html
"""
import pytest

from numba_dpex.tests._helper import skip_no_gdb

Expand All @@ -16,6 +17,7 @@
pytestmark = skip_no_gdb


@pytest.mark.xfail # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
def test_backtrace(app):
"""Simple test for backtrace.
Expand Down
6 changes: 6 additions & 0 deletions numba_dpex/tests/debugging/test_breakpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api):
Test for https://github.com/numba/numba/issues/7415
SAT-4449
"""
if api == "numba-dpex-kernel":
pytest.xfail(
"Wrong name for kernel api."
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216

variable_name = "param_a"
variable_value = "3"
condition = f"{variable_name} == {variable_value}"
Expand All @@ -73,6 +78,7 @@ def test_breakpoint_with_condition_by_function_argument(app, breakpoint, api):
app.child.expect(rf"\$1 = {variable_value}")


@pytest.mark.xfail # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
@pytest.mark.parametrize(
"breakpoint, script",
[
Expand Down
8 changes: 8 additions & 0 deletions numba_dpex/tests/debugging/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,12 @@ def test_breakpoint_by_function(file_name, function, expected):
def test_setup_breakpoint(
app, breakpoint, script, expected_location, expected_line
):
if (
breakpoint == "simple_sum.py:data_parallel_sum"
or breakpoint == "data_parallel_sum"
):
pytest.xfail(
"Expected failures for these files."
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216

setup_breakpoint(app, breakpoint, script, expected_location, expected_line)
37 changes: 29 additions & 8 deletions numba_dpex/tests/debugging/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ def test_info_args(
Issue: https://github.com/numba/numba/issues/7414
Fix: https://github.com/numba/numba/pull/7177
"""
if (
script == "simple_dpex_func.py"
or script == "side-by-side.py --api=numba-dpex-kernel"
):
pytest.xfail(
"Expected Failure for these files."
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216

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

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


@pytest.mark.xfail # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
@skip_no_numba056
def test_info_functions(app):
expected_line = r"13\s+i = dpex.get_global_id\(0\)"
Expand Down Expand Up @@ -145,7 +153,7 @@ def side_by_side_2_info_locals_case(api):
@pytest.mark.parametrize(
"env, breakpoint, script, expected_line, expected_info_locals, expected_info",
[
(
pytest.param(
{"NUMBA_OPT": 0},
"sum_local_vars.py:16",
"sum_local_vars.py",
Expand Down Expand Up @@ -175,6 +183,7 @@ def side_by_side_2_info_locals_case(api):
r"type = float64",
),
),
marks=pytest.mark.xfail,
),
# FIXME: NUMBA_OPT=1 will not able to stop at breakpoint
pytest.param(
Expand All @@ -184,36 +193,42 @@ def side_by_side_2_info_locals_case(api):
r"16\s+c\[i\] = l1 \+ l2",
("No locals.",),
(),
marks=pytest.mark.xfail,
marks=pytest.mark.xfail, # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
),
(
pytest.param(
{"NUMBA_EXTEND_VARIABLE_LIFETIMES": 1},
"side-by-side.py:18",
"side-by-side.py --api=numba-dpex-kernel",
None,
(r"param_c = 0", r"param_d = 0", r"result = 10"),
(),
marks=pytest.mark.xfail, # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
),
(
pytest.param(
{"NUMBA_EXTEND_VARIABLE_LIFETIMES": 0},
"side-by-side.py:18",
"side-by-side.py --api=numba-dpex-kernel",
None,
(r"param_c = 0", r"param_d = 0", r"result = 10"),
(),
marks=pytest.mark.xfail, # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
),
side_by_side_info_locals_case("numba"),
pytest.param(
*side_by_side_info_locals_case("numba-dpex-kernel"),
marks=[
pytest.mark.xfail(reason="dpex isn't stoping with condition")
pytest.mark.xfail(
reason="dpex isn't stoping with condition"
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
],
),
side_by_side_2_info_locals_case("numba"),
pytest.param(
*side_by_side_2_info_locals_case("numba-dpex-kernel"),
marks=[
pytest.mark.xfail(reason="dpex isn't stoping with condition")
pytest.mark.xfail(
reason="dpex isn't stoping with condition"
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
],
),
],
Expand Down Expand Up @@ -277,7 +292,9 @@ def side_by_side_2_print_array_element_case(api):
pytest.param(
*side_by_side_2_print_array_element_case("numba-dpex-kernel"),
marks=[
pytest.mark.xfail(reason="dpex isn't stoping with condition")
pytest.mark.xfail(
reason="dpex isn't stoping with condition"
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
],
),
],
Expand All @@ -294,6 +311,8 @@ def test_print_array_element(app, breakpoint, script, expected_info):
app.child.expect(expected_print)


# FIXME: crashes test execution
@pytest.mark.skip # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
def side_by_side_2_assignment_to_variable_case(api):
return (
"side-by-side-2.py:19 if param_a == 5",
Expand All @@ -316,7 +335,9 @@ def side_by_side_2_assignment_to_variable_case(api):
pytest.param(
*side_by_side_2_assignment_to_variable_case("numba-dpex-kernel"),
marks=[
pytest.mark.xfail(reason="dpex isn't stoping with condition")
pytest.mark.xfail(
reason="dpex isn't stoping with condition"
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
],
),
],
Expand Down
5 changes: 5 additions & 0 deletions numba_dpex/tests/debugging/test_side_by_side.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
def test_breakpoint_row_number(app, api):
"""Test for checking numba and numba-dpex debugging side-by-side."""

if api == "numba-dpex-kernel":
pytest.xfail(
"Wrong name for kernel api."
) # TODO: https://github.com/IntelPython/numba-dpex/issues/1216

app.breakpoint("side-by-side.py:15")
app.run("side-by-side.py --api={api}".format(api=api))

Expand Down
5 changes: 5 additions & 0 deletions numba_dpex/tests/debugging/test_stepping.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
https://www.sourceware.org/gdb/onlinedocs/gdb/Continuing-and-Stepping.html
"""

import pytest

from numba_dpex.tests._helper import skip_no_gdb

from .common import setup_breakpoint
Expand All @@ -17,6 +19,7 @@


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


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


# commands/stepi
@pytest.mark.xfail # TODO: https://github.com/IntelPython/numba-dpex/issues/1216
def test_stepi(app):
setup_breakpoint(
app,
Expand Down

0 comments on commit 1554899

Please sign in to comment.