-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_compiler.sh
50 lines (39 loc) · 1.13 KB
/
test_compiler.sh
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
#!/bin/bash
make clean
make -B
if [ $? -ne 0 ]; then
echo "==========================="
echo "Failed to build "
make clean
exit
fi
PASSED=0
FAILED=0
for i in compiler_tests/*; do
for j in ${i}/*; do
nj=${j%.c}
#Skips driver . c files
if [[ ${j} == *"driver.c" ]]; then
continue;
fi
echo "==========================="
echo "Input file : ${j}"
#pipe = [./scope.o < ${j}]
python3 ./bin/typedef.py < ${j} | ./bin/scope.o | ./bin/c_compiler_program > bin/test_program.s
#./bin/c_compiler < ./scope.o < ${j} > bin/test_program.s
mips-linux-gnu-gcc -mfp32 -o bin/test_program.o -c bin/test_program.s
mips-linux-gnu-gcc -mfp32 -static -o bin/test_program bin/test_program.o ${nj}_driver.c
if qemu-mips bin/test_program;
then
echo "PASS"
PASSED=$(( ${PASSED}+1 ));
else
echo "FAIL"
FAILED=$(( ${FAILED}+1 ));
fi
done
done
echo "########################################"
echo "Passed ${PASSED} , Failed ${FAILED}".
echo ""
make clean