Skip to content
Draft
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
10 changes: 5 additions & 5 deletions ci/tools/run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if [[ "${test_module}" == "pathfinder" ]]; then
"LD:${CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS} " \
"FH:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS} " \
"BC:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS}"
pytest -ra -s -v "${PYTEST_PARALLEL_ARGS[@]}" tests/ |& tee /tmp/pathfinder_test_log.txt
CUDA_PYTHON_TEST_INSTALLED_WHEELS=1 python -I -m pytest -ra -s -v "${PYTEST_PARALLEL_ARGS[@]}" tests/ |& tee /tmp/pathfinder_test_log.txt
# Report the number of "INFO test_" lines (including zero)
# to support quick validations based on GHA log archives.
line_count=$(awk '/^INFO test_/ {count++} END {print count+0}' /tmp/pathfinder_test_log.txt)
Expand All @@ -62,9 +62,9 @@ elif [[ "${test_module}" == "bindings" ]]; then
"cuda-toolkit==${TEST_CUDA_MAJOR_MINOR}.*"
fi
echo "Running bindings tests"
${SANITIZER_CMD} pytest -rxXs -v --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/
CUDA_PYTHON_TEST_INSTALLED_WHEELS=1 ${SANITIZER_CMD} python -I -m pytest -rxXs -v --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/
if [[ "${SKIP_CYTHON_TEST}" == 0 ]]; then
${SANITIZER_CMD} pytest -rxXs -v --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/cython
CUDA_PYTHON_TEST_INSTALLED_WHEELS=1 ${SANITIZER_CMD} python -I -m pytest -rxXs -v --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/cython
fi
popd
elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then
Expand Down Expand Up @@ -111,11 +111,11 @@ elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then
echo "Installed packages before core tests:"
pip list
echo "Running core tests"
${SANITIZER_CMD} pytest -rxXs -v --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/
CUDA_PYTHON_TEST_INSTALLED_WHEELS=1 ${SANITIZER_CMD} python -I -m pytest -rxXs -v --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/
# Currently our CI always installs the latest bindings (from either major version).
# This is not compatible with the test requirements.
if [[ "${SKIP_CYTHON_TEST}" == 0 ]]; then
${SANITIZER_CMD} pytest -rxXs -v --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/cython
CUDA_PYTHON_TEST_INSTALLED_WHEELS=1 ${SANITIZER_CMD} python -I -m pytest -rxXs -v --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/cython
fi
popd
elif [[ "${test_module}" == "nightly-cuda-core" ]]; then
Expand Down
12 changes: 12 additions & 0 deletions cuda_bindings/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import functools
import importlib
import inspect
import os
import pathlib
import sys
from contextlib import contextmanager
Expand All @@ -30,6 +31,17 @@
pytest_plugins = ["cuda_python_test_helpers._pytest_plugin"]


def pytest_sessionstart(session):
if os.environ.get("CUDA_PYTHON_TEST_INSTALLED_WHEELS") == "1":
checkout = pathlib.Path(__file__).resolve().parents[2]
for name in ("cuda.pathfinder", "cuda.bindings"):
module = importlib.import_module(name)
module_path = pathlib.Path(module.__file__).resolve()
print(f"{name}: {module_path}")
if module_path.is_relative_to(checkout):
raise pytest.UsageError(f"{name} imported from the checkout: {module_path}")


def pytest_configure(config):
# When using `parallel-threads` set up mini-plugin to ensure each thread has a CUDA context
parallel_threads = getattr(config.option, "parallel_threads", 0)
Expand Down
12 changes: 12 additions & 0 deletions cuda_core/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@

pytest_plugins = ["cuda_python_test_helpers._pytest_plugin"]


def pytest_sessionstart(session):
if os.environ.get("CUDA_PYTHON_TEST_INSTALLED_WHEELS") == "1":
checkout = pathlib.Path(__file__).resolve().parents[2]
for name in ("cuda.pathfinder", "cuda.bindings", "cuda.core"):
module = importlib.import_module(name)
module_path = pathlib.Path(module.__file__).resolve()
print(f"{name}: {module_path}")
if module_path.is_relative_to(checkout):
raise pytest.UsageError(f"{name} imported from the checkout: {module_path}")


from helpers.constants import POOL_SIZE
from helpers.memory import skip_if_pinned_memory_unsupported

Expand Down
14 changes: 14 additions & 0 deletions cuda_pathfinder/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@
# SPDX-License-Identifier: Apache-2.0


import importlib
import os
from pathlib import Path

import pytest


def pytest_sessionstart(session):
if os.environ.get("CUDA_PYTHON_TEST_INSTALLED_WHEELS") == "1":
checkout = Path(__file__).resolve().parents[2]
module = importlib.import_module("cuda.pathfinder")
module_path = Path(module.__file__).resolve()
print(f"{module.__name__}: {module_path}")
if module_path.is_relative_to(checkout):
raise pytest.UsageError(f"{module.__name__} imported from the checkout: {module_path}")


def pytest_configure(config):
config.custom_info = []

Expand Down
Loading