diff options
author | Rob Landley <rob@landley.net> | 2014-11-14 16:44:00 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-11-14 16:44:00 -0600 |
commit | 9dbcee4875c71afbaf0df42f8e5ce3b6533d6c14 (patch) | |
tree | 6947cf6a1880a169b7cb9410886a3114635abff7 | |
parent | 222fc81c91ab882279da53fe7f3de20ff4b2ce5e (diff) | |
download | toybox-9dbcee4875c71afbaf0df42f8e5ce3b6533d6c14.tar.gz |
Add color support for scripts/test.sh and new SKIP_HOST for tests expected to fail on non-toybox implementations.
-rw-r--r-- | scripts/runtest.sh | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/scripts/runtest.sh b/scripts/runtest.sh index 08be6fa0..ce4dedf9 100644 --- a/scripts/runtest.sh +++ b/scripts/runtest.sh @@ -37,6 +37,17 @@ export SKIP= # Check config to see if option is enabled, set SKIP if not. +SHOWPASS=PASS +SHOWFAIL=FAIL +SHOWSKIP=SKIP + +if tty -s <&1 +then + SHOWPASS="$(echo -e "\033[1m\033[32m${SHOWPASS}\033[0m")" + SHOWFAIL="$(echo -e "\033[1m\033[31m${SHOWFAIL}\033[0m")" + SHOWSKIP="$(echo -e "\033[1m\033[33m${SHOWSKIP}\033[0m")" +fi + optional() { option=`echo "$OPTIONFLAGS" | egrep "(^|:)$1(:|\$)"` @@ -64,9 +75,9 @@ testing() [ -n "$DEBUG" ] && set -x - if [ -n "$SKIP" ] + if [ -n "$SKIP" ] || ( [ -n "$SKIP_HOST" ] && [ -n "$TEST_HOST" ]) then - [ ! -z "$VERBOSE" ] && echo "SKIPPED: $NAME" + [ ! -z "$VERBOSE" ] && echo "$SHOWSKIP: $NAME" return 0 fi @@ -79,15 +90,16 @@ testing() if [ $? -ne 0 ] then FAILCOUNT=$[$FAILCOUNT+1] - echo "FAIL: $NAME" + echo "$SHOWFAIL: $NAME" if [ -n "$VERBOSE" ] then - echo "echo '$5' | $2" + [ ! -z "$4" ] && echo "echo -ne \"$4\" > input" + echo "echo -ne '$5' | $2" diff -u expected actual [ "$VERBOSE" == fail ] && exit 1 fi else - echo "PASS: $NAME" + echo "$SHOWPASS: $NAME" fi rm -f input expected actual |