RVBTCC/test.sh

23 lines
472 B
Bash
Raw Normal View History

2024-12-07 06:13:34 +00:00
cd test
2024-12-23 14:42:31 +00:00
gcc ../boot.c -o boot.elf
2024-12-07 06:13:34 +00:00
all=0
succ=0
for i in *.c; do
all=$((all+1))
i=$(basename $i .c)
2024-12-23 14:42:31 +00:00
./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
2024-12-07 06:13:34 +00:00
echo $? >> $i.ans
if cmp $i.out $i.ans; then
succ=$((succ+1))
echo "Test '$i' passed"
2024-12-08 03:40:47 +00:00
rm $i.ans
2024-12-07 06:13:34 +00:00
else
echo "Test '$i' failed"
2024-12-08 07:41:38 +00:00
exit 1
2024-12-07 06:13:34 +00:00
fi
done
echo "Passed $succ/$all tests"
2024-12-23 14:42:31 +00:00
rm *.elf