diff options
author | Haidong Ji | 2022-04-15 15:51:30 -0500 |
---|---|---|
committer | Haidong Ji | 2022-04-15 15:51:30 -0500 |
commit | 442a49ad5a48d417345959b903ae6a6d32d55759 (patch) | |
tree | c7127bb497e5e439018b1915e0136eec2c9cb124 /22_tests_power/run_all.sh |
Excellent fundamentals and displine training, many tools and techniques
exercises: gdb, emacs, valgrind, git
Diffstat (limited to '22_tests_power/run_all.sh')
-rwxr-xr-x | 22_tests_power/run_all.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/22_tests_power/run_all.sh b/22_tests_power/run_all.sh new file mode 100755 index 0000000..68f709d --- /dev/null +++ b/22_tests_power/run_all.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +for i in /usr/local/l2p/power/power*.o +do + test=`basename $i | sed 's/power//' | sed 's/.o//'` + if [ "$test" == "" ] + then + echo "**Testing correct implementation **" + else + echo "**Testing broken implementation ${test} **" + fi + echo "-------------------------------------" + echo "" + gcc -o test-power test-power.c $i + if [ "$?" != "0" ] + then + echo "Could not compile test-power.c with $i" > /dev/stderr + exit 1 + fi + ./test-power + if [ "$?" != 0 ] + then + if [ "$test" == "" ] + then + echo "Your test program falsely failed the correct implementation!" > /dev/stderr + exit 1 + fi + else + if [ "$test" != "" ] + then + echo "Your test program did not identify $i as broken!" > /dev/stderr + exit 1 + fi + fi + echo "" +done |