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_functional_tests.sh

34 lines
902 B

OUTPUT_DIR="test_outputs"
mkdir -p "$OUTPUT_DIR"
echo "=== 编译器功能测试 ==="
echo "结果将保存到 $OUTPUT_DIR/ 目录"
echo ""
for test in test/test_case/functional/*.sy; do
name=$(basename "$test" .sy)
echo "正在测试: $name"
# 检查是否有对应的输入文件
in_file="test/test_case/functional/${name}.in"
out_file="$OUTPUT_DIR/${name}.ll"
if [ -f "$in_file" ]; then
echo " 使用输入文件: $in_file"
echo " 输出保存到: $out_file"
echo ""
./build/bin/compiler --emit-ir "$test" < "$in_file" 2>&1 | tee "$out_file"
else
echo " 输出保存到: $out_file"
echo ""
./build/bin/compiler --emit-ir "$test" 2>&1 | tee "$out_file"
fi
echo ""
echo "--- 测试完成 ---"
echo ""
done
echo "所有测试完成!"
echo "查看结果: ls -la $OUTPUT_DIR/"