aboutsummaryrefslogtreecommitdiffstats
path: root/run_test_deliverable.sh
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-03-22 16:53:48 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-03-22 16:53:48 +0000
commit561b76bdebd584d03d4e451375777651a9d74017 (patch)
treefdab95e056a212a26b65a96ae2af894e8f42b82e /run_test_deliverable.sh
parentf12ccd62ecf08774ce599a2e15d9042500d2760a (diff)
downloadCompiler-561b76bdebd584d03d4e451375777651a9d74017.tar.gz
Compiler-561b76bdebd584d03d4e451375777651a9d74017.zip
Have to work on case
Diffstat (limited to 'run_test_deliverable.sh')
-rwxr-xr-xrun_test_deliverable.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/run_test_deliverable.sh b/run_test_deliverable.sh
index ae96054..1c6e2ba 100755
--- a/run_test_deliverable.sh
+++ b/run_test_deliverable.sh
@@ -2,6 +2,7 @@
if [[ -z "$1" ]]; then
COMPILER=bin/c_compiler
+ #COMPILER=test_deliverable/c_compiler_ref.sh
else
COMPILER=bin/c_compiler
make clean
@@ -23,37 +24,38 @@ for DRIVER in test_deliverable/testcases/*_driver.c ; do
NAME=$(basename $DRIVER _driver.c)
TESTCODE=test_deliverable/testcases/$NAME.c
- >&2 echo "Test case $NAME"
+ printf "Test case %-15s :\t" $NAME
# Compile driver with normal GCC
mips-linux-gnu-gcc -c $DRIVER -o working/${NAME}_driver.o 2> working/${NAME}_driver.compile.stderr
if [[ $? -ne 0 ]]; then
- >&2 echo "ERROR : Couldn't compile driver program using GCC."
+ >&2 printf "\e[1;31mError\e[0m : Couldn't compile driver program using GCC.\n"
continue
fi
# Compile test function with compiler under test to assembly
cat $TESTCODE | $COMPILER > working/$NAME.s 2> working/${NAME}.compile.stderr
if [[ $? -ne 0 ]]; then
- >&2 echo "ERROR : Compiler returned error message."
+ >&2 printf "\e[1;31mError\e[0m : Compiler returned error message.\n"
continue
fi
# Link driver object and assembly into executable
mips-linux-gnu-gcc -static working/${NAME}.s working/${NAME}_driver.o -o working/${NAME}.elf 2> working/${NAME}.link.stderr
if [[ $? -ne 0 ]]; then
- >&2 echo "ERROR : Linker returned error message."
+ >&2 printf "\e[1;31mError\e[0m : Linker returned error message.\n"
continue
fi
# Run the actual executable
qemu-mips working/${NAME}.elf
- if [[ $? -ne 0 ]]; then
- >&2 echo "ERROR : Testcase returned $?, but expected 0."
+ RESULT=$?
+ if [[ "$RESULT" -ne 0 ]]; then
+ >&2 printf "\e[1;31mError\e[0m : Testcase returned $RESULT, but expected 0.\n"
continue
fi
- echo "pass"
+ printf "\e[1;32mPass\e[0m\n"
PASSED=$(( PASSED+1 ))
done