You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nudt-compiler-cpp/run_tests.py

39 lines
903 B

import os
import subprocess
COMPILER = "./build/bin/compiler"
TEST_DIR = "./test/test_case/performance"
pass_cnt = 0
fail_cnt = 0
print("===== SysY Batch Test Start =====")
for file in os.listdir(TEST_DIR):
if not file.endswith(".sy"):
continue
path = os.path.join(TEST_DIR, file)
print(f"[TEST] {file} ... ", end="")
result = subprocess.run(
[COMPILER, "--emit-parse-tree", path],
stdout=subprocess.DEVNULL,
stderr=subprocess.PIPE
)
if result.returncode == 0:
print("PASS")
pass_cnt += 1
else:
print("FAIL")
fail_cnt += 1
print("---- Error ----")
print(result.stderr.decode())
print("---------------")
print("===============================")
print(f"Total: {pass_cnt + fail_cnt}")
print(f"PASS : {pass_cnt}")
print(f"FAIL : {fail_cnt}")
print("===============================")