You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
run_tests.py fails on windows, but running tests individually works #453
Platform: Windows
In README.md, the instructions say to use python3 run_tests.py --output ./test --dir ./build/cpp --config test_args.json
But this fails on windows, here is a minimal example:
> python run_tests.py --output .\test\ --dir .\build\cpp\0_Introduction\clock\Release\ --config test_args.json
Detected 1 GPU(s).
Found 1 executables
Running tests with up to 1parallel tasks
-----------------------------------------
Starting clock.exe
Command (clock.exe ): ./clock.exe
Error running clock.exe : [WinError2] The system cannot find the file specified
Progress: 1/1 runs completed.
Test Summary:
Ran 1 test runs for1 executables.
Failed runs (1):
clock.exe : Error: [WinError2] The system cannot find the file specified (code -1)
versus:
> .\build\cpp\0_Introduction\clock\Release\clock.exe
CUDA Clock sample
GPU Device 0: with compute capability 7.5 and Number of SMs 16
Average clocks/block =1531.671875
The runner finds clock.exe correctly, but fails when it tries to start it. Since the same executable runs successfully when called directly, the failure points to how run_tests.py launches the sample.
The current code builds the command as ./clock.exe and passes the executable's directory as cwd. On Windows, with the default shell=False, cwd sets the child process's working directory but does not change where Python looks for the executable. This explains the [WinError 2] failure when running the script from the repository root.
Keep the existing cwd=os.path.dirname(exe_path) so samples can still load resources relative to their executable directory. The command should also remain a list, which lets Python handle paths containing spaces.
Activity
Gauravkachwaha commentedon Nov 13, 2026
Proposed fix for running CUDA samples on Windows
The runner finds
clock.execorrectly, but fails when it tries to start it. Since the same executable runs successfully when called directly, the failure points to howrun_tests.pylaunches the sample.The current code builds the command as
./clock.exeand passes the executable's directory ascwd. On Windows, with the defaultshell=False,cwdsets the child process's working directory but does not change where Python looks for the executable. This explains the[WinError 2]failure when running the script from the repository root.The Python subprocess documentation describes this behavior and recommends using a fully qualified executable path.
Suggested change
I suggest resolving the executable to an absolute path and using that path as the first command argument:
Keep the existing
cwd=os.path.dirname(exe_path)so samples can still load resources relative to their executable directory. The command should also remain a list, which lets Python handle paths containing spaces.