This repository has been archived by the owner on Aug 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
test_testcase.sh
50 lines (34 loc) · 1.62 KB
/
test_testcase.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/compiler compiler_tests/functions/call_constant_external.c \
> working/output/compiled.txt
#!/bin/bash
echo "=================================================================================="
echo " Cleaning the temporaries and outputs "
echo "=================================================================================="
make clean
echo "=================================================================================="
echo " Compiling "
echo "=================================================================================="
make all
echo "=================================================================================="
echo " Running test "
echo "=================================================================================="
COMPILER=bin/c_compiler
input_dir="compiler_tests/misc/enum1"
output_dir="temp/"
rm -r ${output_dir}
mkdir -p ${output_dir}
# Compile test function with compiler under test
${COMPILER} -S ${input_dir}.c -o ${output_dir}testcase.s
# Compile driver with normal GCC
mips-linux-gnu-gcc -mfp32 -o ${output_dir}object_file.o -c ${output_dir}testcase.s
# Link driver object and assembly into executable
mips-linux-gnu-gcc -mfp32 -static -o ${output_dir}EXEC ${output_dir}object_file.o ${input_dir}_driver.c
# Run the actual executable
qemu-mips ${output_dir}EXEC
# Check result output
ret=$?
if [[ $ret -ne 0 ]]; then
echo "FAILED! Testcase returned $ret, but expected 0."
else
echo "PASSED!"
fi