From c180b16495f561fd3d08aee0114bb6a90c53f22e Mon Sep 17 00:00:00 2001 From: jmaccabe Date: Sat, 28 Sep 2013 03:28:47 -0400 Subject: [PATCH 1/6] Added metrics Keep track of time for each test and the full suite. --- test/test.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/test/test.sh b/test/test.sh index f899337..f3afb19 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,17 @@ 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 + test_start=$(date +"%s") actual=$(./$exe ../$file) + test_end=$(date +"%s") echo "$actual" | diff -b $expected - > /dev/null result=$? total=$((total+1)) @@ -36,17 +42,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 From 69e590b85170a5805917048ef223eea80e6ae52b Mon Sep 17 00:00:00 2001 From: jmaccabe Date: Sat, 28 Sep 2013 03:31:56 -0400 Subject: [PATCH 2/6] Autorun for test expecting input Added autorun file for 15 so test suite could continue. --- 15-restful/autorun | 27 +++++++++++++++++++++++++++ test/test.sh | 6 +++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 15-restful/autorun diff --git a/15-restful/autorun b/15-restful/autorun new file mode 100644 index 0000000..ca62ed3 --- /dev/null +++ b/15-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/test/test.sh b/test/test.sh index f3afb19..50c2207 100755 --- a/test/test.sh +++ b/test/test.sh @@ -30,7 +30,11 @@ for dir in $styles_to_test ; do msg $(date +%T) testing $(basename $dir)/$exe with $file expected=$mydir/$file test_start=$(date +"%s") - actual=$(./$exe ../$file) + if [ -e $dir/autorun ] ; then + actual=$(./$exe /dev/null result=$? From 30b22f3db819007d18f340ace2d04b413577551a Mon Sep 17 00:00:00 2001 From: jmaccabe Date: Sat, 28 Sep 2013 03:41:29 -0400 Subject: [PATCH 3/6] More test suite tweaks Added an ugly hack for 16 and 17 to pass. --- test/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.sh b/test/test.sh index 50c2207..f74ada3 100755 --- a/test/test.sh +++ b/test/test.sh @@ -33,7 +33,7 @@ for dir in $styles_to_test ; do if [ -e $dir/autorun ] ; then actual=$(./$exe /dev/null From 6fac456bf713b77c89a38c2b7ec60c263a3a9149 Mon Sep 17 00:00:00 2001 From: jmaccabe Date: Sat, 28 Sep 2013 04:05:31 -0400 Subject: [PATCH 4/6] Another autorun Added autorun to 33. --- 33-restful/autorun | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 33-restful/autorun 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 From 71a73673acb0163b07b09ac332dab65f0198d724 Mon Sep 17 00:00:00 2001 From: jmaccabe Date: Sat, 28 Sep 2013 04:11:14 -0400 Subject: [PATCH 5/6] Marking executable Marking some of the new tests executable for the test suite. --- 20-defensive/tf-20.py | 0 21-tantrum/tf-21.py | 0 34-the-c-flow/tf-34.py | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 20-defensive/tf-20.py mode change 100644 => 100755 21-tantrum/tf-21.py mode change 100644 => 100755 34-the-c-flow/tf-34.py 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/34-the-c-flow/tf-34.py b/34-the-c-flow/tf-34.py old mode 100644 new mode 100755 From ac01772b1867cde263965b6c26267d9bd98e30c5 Mon Sep 17 00:00:00 2001 From: jmaccabe Date: Sat, 28 Sep 2013 04:14:02 -0400 Subject: [PATCH 6/6] Remove cruft Delete lingering file from old pull. --- 15-restful/autorun | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 15-restful/autorun diff --git a/15-restful/autorun b/15-restful/autorun deleted file mode 100644 index ca62ed3..0000000 --- a/15-restful/autorun +++ /dev/null @@ -1,27 +0,0 @@ -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