Files
agentmc/run_tests.sh

24 lines
627 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# 统一测试入口。用法: ./run_tests.sh
cd "$(dirname "$0")"
total=0; fail=0
for t in tests/test_*.py; do
name=$(basename "$t")
out=$(python3 "$t" 2>&1)
if echo "$out" | grep -qE "全部通过|通过$"; then
n=$(echo "$out" | grep -c "^ ✓")
total=$((total+n))
printf ' %-24s ✓ %2d 项\n' "$name" "$n"
else
fail=$((fail+1))
printf ' %-24s ✗ 失败\n' "$name"
echo "$out" | tail -5 | sed 's/^/ /'
fi
done
echo
if [ $fail -eq 0 ]; then
echo "全部通过:$total 项,0 失败"
else
echo "失败 $fail 个套件(共 $total 项通过)"; exit 1
fi