From 20d2d2fbf001f1011e3771d322bd92fdd42d830e Mon Sep 17 00:00:00 2001 From: Xun Yang <x299yang@uwaterloo.ca> Date: Sat, 4 Apr 2020 12:02:15 -0400 Subject: [PATCH] run code for multiple test cases --- testAssemble.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 testAssemble.sh diff --git a/testAssemble.sh b/testAssemble.sh new file mode 100644 index 0000000..178d1de --- /dev/null +++ b/testAssemble.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# can supply folder name as argument to run 1 test test case +# run one case: ./testAssemble.sh J1_00_Step0.java +# run all cases: ./testAssemble.sh + +cd output + +if [ "$#" -eq 0 ]; then + # assemble and link and output results of running each test case + for d in ./*/; do + cd $d + echo "-----------------------------------" + echo "Run generated code for " + $d + + for filename in ./*.s; do + /u/cs444/bin/nasm -O1 -f elf -g -F dwarf $filename + done + ld -melf_i386 -o main ./*.o + + # run main + ./main + + # echo the exit code + echo $? + echo "-----------------------------------" + + cd .. + done +else + cd $1 + for filename in ./*.s; do + /u/cs444/bin/nasm -O1 -f elf -g -F dwarf $filename + done + ld -melf_i386 -o main ./*.o + + # run main + ./main + + # echo the exit code + echo $? +fi -- GitLab