Files
colibri/c/tools/run_tests.py
T
Tom Olorin 372f8fd633 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>
2026-07-14 18:01:12 +02:00

21 lines
537 B
Python

#!/usr/bin/env python3
"""Run C test binaries, exiting non-zero on the first failure.
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([os.path.normpath(binary)])
if rc != 0:
failed.append(binary)
if failed:
for f in failed:
print(f"FAILED: {f}", file=sys.stderr)
sys.exit(1)