riscv back
This commit is contained in:
parent
92f4b4f561
commit
2b9ed2e2a4
4 changed files with 58 additions and 13 deletions
28
test.sh
28
test.sh
|
@ -1,3 +1,25 @@
|
|||
if [ $(uname -m) != "riscv64" ]; then
|
||||
function compile() {
|
||||
riscv64-linux-gnu-gcc-12 -static $1.s -o $1.elf
|
||||
}
|
||||
function run_with_input() {
|
||||
qemu-riscv64 $1.elf < $1.in > $1.ans
|
||||
}
|
||||
function run_without_input() {
|
||||
qemu-riscv64 $1.elf > $1.ans
|
||||
}
|
||||
else
|
||||
function compile() {
|
||||
gcc $1.s -o $1.elf
|
||||
}
|
||||
function run_with_input() {
|
||||
./$1.elf < $1.in > $1.ans
|
||||
}
|
||||
function run_without_input() {
|
||||
./$1.elf > $1.ans
|
||||
}
|
||||
fi
|
||||
|
||||
cd test
|
||||
gcc ../boot.c -o boot.elf
|
||||
all_cnt=0
|
||||
|
@ -12,12 +34,12 @@ for D in *; do
|
|||
i=$(basename $i .c)
|
||||
if [ -f $i.out ]; then
|
||||
../boot.elf < $i.c > $i.s &&
|
||||
riscv64-linux-gnu-gcc-12 -static $i.s -o $i.elf
|
||||
compile $i
|
||||
if [[ $? == 0 ]]; then
|
||||
if [ -f $i.in ]; then
|
||||
qemu-riscv64 $i.elf < $i.in > $i.ans
|
||||
run_with_input $i
|
||||
else
|
||||
qemu-riscv64 $i.elf > $i.ans
|
||||
run_without_input $i
|
||||
fi
|
||||
echo $? >> $i.ans
|
||||
cmp $i.out $i.ans
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue