RVBTCC/test.sh
2024-12-23 22:44:35 +08:00

23 lines
472 B
Bash

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