This commit is contained in:
2026-03-23 20:01:25 +08:00
parent 995e159f6f
commit 6fc0c89072
2 changed files with 18 additions and 12 deletions

View File

@@ -2,7 +2,7 @@
# 批量测试所有.sy文件的语法解析
test_dir="/home/lingli/nudt-compiler-cpp/test/test_case/functional"
test_dir="/home/lingli/nudt-compiler-cpp/test/test_case"
compiler="/home/lingli/nudt-compiler-cpp/build/bin/compiler"
if [ ! -f "$compiler" ]; then
@@ -21,14 +21,16 @@ echo "="
for test_file in $(find "$test_dir" -name "*.sy" | sort); do
echo "测试: $(basename "$test_file")"
# 运行解析测试,将输出重定向到/dev/null
"$compiler" --emit-parse-tree "$test_file" > /dev/null 2>&1
# 运行解析测试,捕获输出
output=$("$compiler" --emit-parse-tree "$test_file" 2>&1)
exit_code=$?
if [ $? -eq 0 ]; then
if [ $exit_code -eq 0 ]; then
echo " ✓ 成功"
((success_count++))
else
echo " ✗ 失败"
echo " 错误信息: $output"
((failed_count++))
failed_tests+=($(basename "$test_file"))
fi