diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 349e764..0f46540 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -15,11 +15,6 @@ RUN apt install -y \ python3.10-venv \ vim -# the mkdir command bypasses a profiler error, which allows us to run it with -# host code only to at least check that the profiler parameters are correctly -# provided; without this line, some tests will fail -RUN mkdir -p /usr/lib/x86_64-linux-gnu/nsight-compute/sections - # we create the virtualenv here so that the devcontainer.json setting # python.defaultInterpreterPath can be used to find it; if we do it in the # post_create.sh script, the virtualenv will not be loaded and features like diff --git a/tests/fixtures/fixtures.py b/tests/fixtures/fixtures.py index a1d4e17..6e50541 100644 --- a/tests/fixtures/fixtures.py +++ b/tests/fixtures/fixtures.py @@ -27,6 +27,11 @@ def fixtures_path(tests_path): return os.path.join(tests_path, "fixtures") +@pytest.fixture(scope="session") +def scripts_path(fixtures_path: str): + return os.path.join(fixtures_path, "scripts") + + @pytest.fixture(scope="session") def compiler_cpp_17_fpath(fixtures_path: str): return os.path.join(fixtures_path, "compiler", "cpp_17.cu") diff --git a/tests/fixtures/scripts/ncu b/tests/fixtures/scripts/ncu new file mode 100755 index 0000000..4d059e5 --- /dev/null +++ b/tests/fixtures/scripts/ncu @@ -0,0 +1,7 @@ +#!/bin/bash + +# this is a mock of nsight compute cli tool that just executes the program +# given as the last argument +"${@: -1}" + +echo "==WARNING== No kernels were profiled" diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 674392d..7448adc 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -37,6 +37,11 @@ def copy_source_to_group( return destination_fpath +@pytest.fixture(autouse=True, scope="session") +def before_all(scripts_path: str): + os.environ["PATH"] = scripts_path + os.pathsep + os.environ["PATH"] + + @pytest.fixture(autouse=True, scope="function") def before_each(plugin: NVCCPlugin): shutil.rmtree(plugin.workdir, ignore_errors=True) # before test