test subdirectory
This commit is contained in:
parent
b4dbce76cf
commit
bf7f456967
32
test.sh
32
test.sh
@ -2,21 +2,27 @@ 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
|
||||
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
|
||||
succ=$((succ+1))
|
||||
echo "Test '$i' passed"
|
||||
rm $i.ans
|
||||
else
|
||||
rm $i.ans $i.s $i.elf
|
||||
else
|
||||
echo "Test '$i' failed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
cd ..
|
||||
fi
|
||||
done
|
||||
echo "Passed $succ/$all tests"
|
||||
rm *.elf
|
||||
rm boot.elf
|
||||
|
Loading…
Reference in New Issue
Block a user