diff options
author | David Phillips <dbphillipsnz@gmail.com> | 2016-03-13 14:07:59 +1300 |
---|---|---|
committer | David Phillips <dbphillipsnz@gmail.com> | 2016-03-13 14:07:59 +1300 |
commit | f3beb9fc8612b12a6a19a446d543dce3d90b3ac5 (patch) | |
tree | cea6e72036688b5d3b8351208cc9a281fa925591 | |
parent | ae76bffb0df0e51a16662722fb307c2f3e3fd913 (diff) | |
download | cue-bin-split-f3beb9fc8612b12a6a19a446d543dce3d90b3ac5.tar.xz |
Run test from makefile, add colour to test results
-rw-r--r-- | Makefile | 3 | ||||
-rwxr-xr-x | test/run-tests.sh | 13 |
2 files changed, 13 insertions, 3 deletions
@@ -14,6 +14,9 @@ cue-bin-split: $(OBJECTS) $(CC) -c -o $@ $< $(CFLAGS) +test: all + @./test/run-tests.sh + clean: rm -vf cue-bin-split *.o diff --git a/test/run-tests.sh b/test/run-tests.sh index c6a7cce..87137fc 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -1,13 +1,17 @@ #!/bin/sh -EXECUTABLE="$PWD/../cue-bin-split" fail() { - echo "[FAIL] $i: $@" + echo -e '[\e[1;31mFAIL\e[0m] '$i: $@ exit 1 } +pass() +{ + echo -e '[\e[0;32mPASS\e[0m] '$i: $@ +} + check_expected() { [ -z $1 ] && echo WARN: check_expected called with no argument @@ -19,6 +23,8 @@ check_expected() fi } +pushd $(dirname $0) >/dev/null +EXECUTABLE="$PWD/../cue-bin-split" for i in *.test ; do pushd ${i} >/dev/null ( . ./run.sh ) 2>stderr.tmp >stdout.tmp @@ -29,8 +35,9 @@ for i in *.test ; do check_expected stdout check_expected stderr - echo "[PASS] $i" + pass $i rm std{err,out}.tmp popd >/dev/null done +popd >/dev/null |