RVBTCC/test.sh

29 lines
607 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
2024-12-24 01:55:26 +00:00
for D in *; do
if [ -d "${D}" ]; then
echo "Testing subdirectory '$D'"
cd $D
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
2024-12-07 06:13:34 +00:00
succ=$((succ+1))
echo "Test '$i' passed"
2024-12-24 01:55:26 +00:00
rm $i.ans $i.s $i.elf
else
2024-12-07 06:13:34 +00:00
echo "Test '$i' failed"
2024-12-24 01:55:26 +00:00
fi
done
cd ..
fi
2024-12-07 06:13:34 +00:00
done
echo "Passed $succ/$all tests"
2024-12-24 01:55:26 +00:00
rm boot.elf