Repository navigation
Fix run_tests.py failing on Windows due to relative executable paths - #464
Open
rjmcgee53192 wants to merge 1 commit into
Open
rjmcgee53192 wants to merge 1 commit into
rjmcgee53192 wants to merge 1 commit into
Conversation
Invoke each test executable via its absolute, OS-native path instead of a
POSIX-style relative path ('./name.exe'), which does not resolve on
Windows. The executable is still run with its own directory as the working
directory. Adds unit tests covering the path-construction logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
run_tests.pyfailing on Windows due to relative executable paths (fixes #453)Problem
On Windows,
run_tests.pybuilds the test command as a POSIX-stylerelative path:
That relative path does not resolve on Windows, so every test fails —
while running the same binaries individually (e.g. double-clicking or
typing the name in a shell) works fine. Reported in issue #453.
Fix
build_test_command()inrun_tests.py, which constructs thecommand from the executable's absolute, OS-native path via
pathlib(str(Path(executable).resolve())). This resolves correctlyon every platform.
run_single_test_instance()now uses this helper for the argv, and thecwdit passes tosubprocess.runis also absolute (the executable'sown directory, as before — unchanged behavior, since some samples
depend on relative asset paths).
args,global_args) and the status mapping(Passed / Waived / Failed / Timeout / Error) are unchanged.
Tests
New unit test module
test_run_tests.py(no GPU, toolkit, or buildrequired — runs anywhere with Python 3):
Coverage: absolute-path construction (absolute and relative inputs),
no
./prefix regression check, string/Path inputs, subprocess receivingthe absolute path with the executable's directory as cwd, argument
forwarding, status-code mapping, timeout, and unexpected-error handling.
Honest note
This was developed on Linux — on-Windows execution of the harness was
not possible on this machine, so the fix is verified by unit tests and
code review, not by a Windows run. A maintainer running
python run_tests.py --output ./test --dir ./build/cpp --config test_args.jsonon Windows would be the real confirmation that #453 is closed.