Resolve bare executable names before splitting legacy command strings. Run real-process invocation regressions from the existing test runner. Assisted-by: OpenAI GPT-6 (Codex) <noreply@openai.com> Assisted-by: OpenAI GPT-6 Luna <noreply@openai.com>
53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import glob
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
argv0_dir = os.path.dirname(sys.argv[0])
|
|
project_dir = os.path.abspath(os.path.join(argv0_dir, ".."))
|
|
test_dir = os.path.join(project_dir, "test")
|
|
program = os.path.abspath(os.path.join("md2html", "md2html"))
|
|
|
|
if __name__ == "__main__":
|
|
err_count = 0
|
|
|
|
os.chdir(test_dir)
|
|
|
|
print("Testing program invocation:")
|
|
sys.stdout.flush()
|
|
p = subprocess.run([sys.executable, "prog-tests.py", program])
|
|
if p.returncode != 0:
|
|
err_count += 1
|
|
print()
|
|
|
|
for testsuite in glob.glob('*.txt'):
|
|
print("Testing {}".format(testsuite))
|
|
sys.stdout.flush()
|
|
sys.stderr.flush()
|
|
args = [
|
|
sys.executable,
|
|
"run-testsuite.py",
|
|
"-s", testsuite,
|
|
"-p", str(program)
|
|
]
|
|
p = subprocess.run(args)
|
|
if p.returncode != 0:
|
|
err_count += 1
|
|
print()
|
|
|
|
print("Testing pathological inputs:")
|
|
sys.stdout.flush()
|
|
sys.stderr.flush()
|
|
args = [
|
|
sys.executable,
|
|
"pathological-tests.py",
|
|
"-p", str(program)
|
|
]
|
|
p = subprocess.run(args)
|
|
if p.returncode != 0:
|
|
err_count += 1
|
|
|
|
sys.exit(err_count)
|