2024-12-07 06:13:34 +00:00
|
|
|
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"
|
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-08 03:40:47 +00:00
|
|
|
rm *.c.out a.out
|