Skip to content

Enable GDB tests in conda recipe #579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ recursive-include numba_dppy *.spir

include versioneer.py
include numba_dppy/_version.py

recursive-include numba_dppy/examples *
2 changes: 2 additions & 0 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ build:
number: {{ GIT_DESCRIBE_NUMBER }}
script_env:
- WHEELS_OUTPUT_FOLDER
- NUMBA_DPPY_TESTING_GDB_ENABLE

requirements:
build:
Expand All @@ -34,6 +35,7 @@ requirements:
test:
requires:
- pytest
- pexpect

about:
home: https://github.com/IntelPython/numba-dppy
Expand Down
41 changes: 40 additions & 1 deletion conda-recipe/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,46 @@

set -euxo pipefail

pytest -q -ra --disable-warnings --pyargs numba_dppy -vv
DEBUGGER_VERSION=10.1.2
if [[ -v ONEAPI_ROOT ]]; then
DEBUGGER_DIR="${ONEAPI_ROOT}/debugger/${DEBUGGER_VERSION}"
else
DEBUGGER_DIR="/opt/intel/oneapi/debugger/${DEBUGGER_VERSION}"
fi

if [[ -d "${DEBUGGER_DIR}" ]]; then
echo "Using debugger from: ${DEBUGGER_DIR}"
set +x
# shellcheck disable=SC1091
. "${DEBUGGER_DIR}/env/vars.sh"
set -x
else
echo "Debugger is not installed: ${DEBUGGER_DIR}"
fi

PYARGS="-k test_debug_dppy_numba -k dummy"
pytest -q -ra --disable-warnings --pyargs numba_dppy -vv ${PYARGS}

exit 0

# PYTEST_ARGS="-q -ra --disable-warnings"
# PYARGS="numba_dppy -vv"
# DEBUGGER_VERSION=10.1.2

# if [ -n "$NUMBA_DPPY_TESTING_GDB_ENABLE" ]; then
# PYARGS="$PYARGS -k test_debug_dppy_numba"

# # Activate debugger
# if [[ -v ONEAPI_ROOT ]]; then
# set +ux
# # shellcheck disable=SC1090
# source "${ONEAPI_ROOT}/debugger/${DEBUGGER_VERSION}/env/vars.sh"
# set -ux
# fi
# fi

# # shellcheck disable=SC2086
# pytest $PYTEST_ARGS --pyargs $PYARGS

if [[ -v ONEAPI_ROOT ]]; then
set +u
Expand Down
32 changes: 26 additions & 6 deletions numba_dppy/tests/test_debug_dppy_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,26 @@

pexpect = pytest.importorskip("pexpect")

pytestmark = pytest.mark.skipif(
not shutil.which("gdb-oneapi"),
reason="Intel® Distribution for GDB* is not available",
)

def module_loaded(module_name):
import subprocess

lsmod = subprocess.Popen(["lsmod"], stdout=subprocess.PIPE)
grep = subprocess.Popen(["grep", module_name], stdin=lsmod.stdout)
grep.communicate()
return grep.returncode == 0


pytestmark = [
pytest.mark.skipif(
not shutil.which("gdb-oneapi"),
reason="Intel® Distribution for GDB* is not available",
),
pytest.mark.skipif(
not module_loaded("igfxdcd"),
reason="Module igfxdcd is not loaded",
),
]


# TODO: go to helper
Expand All @@ -45,8 +61,8 @@ def spawn(self):
env["NUMBA_OPT"] = "0"

self.child = pexpect.spawn("gdb-oneapi -q python", env=env, encoding="utf-8")
if config.DEBUG:
self.child.logfile = sys.stdout
# if config.DEBUG:
self.child.logfile = sys.stdout

def setup_gdb(self):
self.child.expect("(gdb)", timeout=5)
Expand Down Expand Up @@ -108,6 +124,10 @@ def app():
return gdb()


def test_dummy():
assert True


@pytest.mark.parametrize("api", ["numba", "numba-dppy"])
def test_breakpoint_row_number(app, api):
app.breakpoint("dppy_numba_basic.py:25")
Expand Down