RVBTCC/test.sh
2024-12-07 14:13:34 +08:00

21 lines
446 B
Bash

cd test
gcc ../boot.c
all=0
succ=0
for i in *.c; do
all=$((all+1))
i=$(basename $i .c)
./a.out < $i.c > $i.s &&
riscv64-linux-gnu-gcc-12 -static $i.s -o $i.c.out &&
qemu-riscv64 $i.c.out < $i.in > $i.ans
echo $? >> $i.ans
if cmp $i.out $i.ans; then
succ=$((succ+1))
echo "Test '$i' passed"
else
echo "Test '$i' failed"
fi
done
echo "Passed $succ/$all tests"
rm *.c.out *.s *.ans a.out