run_tests: normpath test binaries — forward-slash relative paths fail CreateProcess on Windows (#196)

'make test-c' passes TEST_BINS as 'tests/test_json.exe' etc.; Python's
subprocess on Windows hands that to CreateProcess, which rejects
forward-slash relative paths for the executable (WinError 2), so the
runner this script exists for (running tests from any Windows shell)
failed on every test. os.path.normpath makes it 'tests\test_json.exe'
on Windows and is a no-op elsewhere. Verified: all 8 suites run via
'make test-c' on Windows 11 / MinGW GCC 16.1 and paths are unchanged
on POSIX.

Co-authored-by: olorin <io@zyphyr.co>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Tom Olorin
2026-07-14 09:01:12 -07:00
committed by GitHub
parent 4a0435cbb3
commit 372f8fd633
+2 -1
View File
@@ -5,12 +5,13 @@ Used by `make test-c` so the test runner works from any shell (cmd.exe,
PowerShell, Git Bash, MSYS2) without a POSIX `for` loop. Each test binary
is a positional argument.
"""
import os
import subprocess
import sys
failed = []
for binary in sys.argv[1:]:
rc = subprocess.call([binary])
rc = subprocess.call([os.path.normpath(binary)])
if rc != 0:
failed.append(binary)
if failed: