summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-17 09:45:49 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-17 09:45:49 +0100
commitc616e9f6983c5cbe07150f9e4dfb293e6abbbe7d (patch)
tree97f0ae6c9d5fb149b153863397f45bd708fb93b8
parent0a6cc823727f95c515a1d927b9bc47027a4b1cf3 (diff)
downloadshcmdtest-c616e9f6983c5cbe07150f9e4dfb293e6abbbe7d.tar.bz2
More feedback during and after run
-rwxr-xr-xshcmdtest29
1 files changed, 28 insertions, 1 deletions
diff --git a/shcmdtest b/shcmdtest
index 77277a8..494fbec 100755
--- a/shcmdtest
+++ b/shcmdtest
@@ -3,6 +3,7 @@
TESTS=""
ONCE=""
+SCRIPT_COUNT=0
for D in "$@"; do
for TEST in "$D/"*.script; do
if test "x${ONCE}" = "x"; then
@@ -11,6 +12,7 @@ for D in "$@"; do
else
set -- "$@" "${TEST}"
fi
+ SCRIPT_COUNT=$(($SCRIPT_COUNT + 1))
done
done
@@ -25,6 +27,7 @@ mkdir "${DATADIR}"
blow_away () { rm -fr "${LOCALTMPDIR}"; }
trap blow_away 0
+SCRIPTS_RUN=0
TEST_COUNT=0
PASSES=0
FAILS=0
@@ -67,10 +70,24 @@ pass_fail () {
fi
}
+LONGEST_NAME=0
runtest () {
THIS_FAIL=0
TESTNAME="$2"
export TESTNAME
+ SCRIPTS_RUN=$(($SCRIPTS_RUN + 1))
+ echo -n "${SCRIPTS_RUN}/${SCRIPT_COUNT}: ${TESTNAME}"
+ TEST_LEN=${#TESTNAME}
+ if test $TEST_LEN -gt $LONGEST_NAME; then
+ LONGEST_NAME=$TEST_LEN
+ else
+ SPACES=$(($LONGEST_NAME - $TEST_LEN))
+ while test $SPACES -gt 0; do
+ echo -n " "
+ SPACES=$(($SPACES - 1))
+ done
+ fi
+ echo -n -e '\r'
if test -r "$1/$2.stdin"; then
# Run the test with stdin
"$1/$2.script" < "$1/$2.stdin" > "$1/$2.stdout-actual" 2> "$1/$2.stderr-actual"
@@ -123,7 +140,17 @@ done
test "x${OLD_DIR}" != "x" && teardown_once "${OLD_DIR}"
-echo "${PASSES} / ${TEST_COUNT}"
+SPACES=$((${#LONGEST_NAME} + ${#SCRIPTS_RUN} + ${#SCRIPT_COUNT} + 3))
+while test $SPACES -gt 0; do
+ echo -n " "
+ SPACES=$(($SPACES - 1))
+done
+
+echo -n -e '\r'
+
+echo "Totals: ${SCRIPTS_RUN} tests run, comprising ${TEST_COUNT}."
+echo "Of those, ${PASSES} passed and ${FAILS} failed."
+
echo "${FAILMSGS}"
for F in "$@"; do