-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·59 lines (53 loc) · 1.59 KB
/
run.sh
File metadata and controls
executable file
·59 lines (53 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
rm -f -r Outputs
mkdir Outputs
chmod g+rwx Outputs
dir="/u/css/classes/3481/Spring2022/lab10/Tests"
tests=( error1 error2 error3 error4 error5 error6
error7 error8 error9 error10 error11 error12
error13 error14 nop irmovq
addq andq subq xorq addqfor1 addqfor2 addqfor3
addqfor4 addqfor5 addqfor6 rrmovq cmovle cmovl
cmove cmovne cmovge cmovg mrmovq1 mrmovq2
pushq1 pushq2 popq1 popq2 pushqpopq rmmovq
memfor1 memfor2 except1 except2 except3 except4 except5 except6
except7 loaduse1 loaduse2 jmp je jg jge jl jle jne
addOne sum jecall
)
numTests=0
numPasses=0
for atest in ${tests[@]}
do
infile="$dir/$atest.yo"
studoutfile="$atest.sdump"
instoutfile="$dir/$atest.idump"
rm -f $studoutfile
./yess $infile > $studoutfile
rm -f diffs
diff $instoutfile $studoutfile > diffs
if [ ! -e $studoutfile ] || [ ! -s $studoutfile ] || [ -s diffs ]; then
cp $instoutfile Outputs/
cp $infile Outputs/
mv $studoutfile Outputs/
echo "Testing $infile ... failed"
cat diffs
rm -f diffs
else
rm -f diffs
rm -f $studoutfile
echo "Testing $infile ... passed"
numPasses=$(($numPasses+1))
fi
numTests=$(($numTests+1))
done
echo " "
echo "$numPasses passed out of $numTests tests."
if [ $numPasses -ne $numTests ]; then
echo "Files saved in your Outputs directory."
echo "Input files end with a .yo."
echo "Your output files end with a .sdump."
echo "Correct output files end with a .idump."
chmod g+rw Outputs/*
else
rm -f -r Outputs
fi