diff --git a/20-defensive/tf-20.py b/20-defensive/tf-20.py old mode 100644 new mode 100755 diff --git a/21-tantrum/tf-21.py b/21-tantrum/tf-21.py old mode 100644 new mode 100755 diff --git a/33-restful/autorun b/33-restful/autorun new file mode 100644 index 0000000..ca62ed3 --- /dev/null +++ b/33-restful/autorun @@ -0,0 +1,27 @@ +2 +../pride-and-prejudice.txt +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +1 diff --git a/34-the-c-flow/tf-34.py b/34-the-c-flow/tf-34.py old mode 100644 new mode 100755 diff --git a/test/test.sh b/test/test.sh index f899337..f74ada3 100755 --- a/test/test.sh +++ b/test/test.sh @@ -1,7 +1,11 @@ #!/bin/bash function msg() { - echo $(date +%T) "$@" + echo "$@" +} + +function date_diff() { + date -u -d @"$(($2 - $1))" +"%-Hh %-Mm %-Ss" } # Move to a predictable place. @@ -17,15 +21,21 @@ else fi files=$(echo *.txt) - +suite_start=$(date +"%s") for dir in $styles_to_test ; do cd $dir for file in $files ; do for exe in * ; do if [ -x $exe ]; then - msg testing $(basename $dir)/$exe with $file + msg $(date +%T) testing $(basename $dir)/$exe with $file expected=$mydir/$file - actual=$(./$exe ../$file) + test_start=$(date +"%s") + if [ -e $dir/autorun ] ; then + actual=$(./$exe /dev/null result=$? total=$((total+1)) @@ -36,17 +46,18 @@ for dir in $styles_to_test ; do echo "$actual" | paste $expected - | column -t echo failures=$(($failures+1)) - msg $exe FAILED! + msg $exe FAILED in $(date_diff $test_start $test_end)! else - msg passed. + msg $exe passed in $(date_diff $test_start $test_end). fi fi done done cd $mydir done +suite_end=$(date +"%s") -msg $(date +%T) Ran $total tests with $failures failures. +msg Ran $total tests with $failures failures in $(date_diff $suite_start $suite_end). if [ $failures -ne 0 ]; then msg FAILED! exit $failures