From 74dfb9d88dd32d66409123f4c7be89faf194be42 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Tue, 21 Feb 2017 18:38:03 -0500 Subject: [PATCH] test: Make test status more clear --- test.sh | 2 +- test/test-bashfmt.sh | 1 + test/test-commit-message.sh | 5 ++++- test/test-gofmt.sh | 1 + test/test-golint.sh | 2 +- test/test-headerfmt.sh | 1 + test/test-omv.sh | 6 +++++- test/test-reproducible.sh | 2 +- test/test-shell.sh | 2 +- test/test-yamlfmt.sh | 5 +++-- 10 files changed, 19 insertions(+), 8 deletions(-) diff --git a/test.sh b/test.sh index 5bcfc608..c399f7ae 100755 --- a/test.sh +++ b/test.sh @@ -27,8 +27,8 @@ run-test ./test/test-gotest.sh # do these longer tests only when running on ci if env | grep -q -e '^TRAVIS=true$' -e '^JENKINS_URL=' -e '^BUILD_TAG=jenkins'; then - run-test ./test/test-gotest.sh --race run-test ./test/test-shell.sh + run-test ./test/test-gotest.sh --race fi # FIXME: this now fails everywhere :( diff --git a/test/test-bashfmt.sh b/test/test-bashfmt.sh index 1ff3a977..6f378e4c 100755 --- a/test/test-bashfmt.sh +++ b/test/test-bashfmt.sh @@ -29,3 +29,4 @@ bad_files=$( if [[ -n "${bad_files}" ]]; then fail_test "The following bash files are not properly formatted: ${bad_files}" fi +echo 'PASS' diff --git a/test/test-commit-message.sh b/test/test-commit-message.sh index 217af9fb..6b544c3b 100755 --- a/test/test-commit-message.sh +++ b/test/test-commit-message.sh @@ -1,5 +1,7 @@ #!/bin/bash -e +echo running test-commit-message.sh + travis_regex='^\([a-z0-9]\(\(, \)\|[a-z0-9]\)\+[a-z0-9]: \)\+[A-Z0-9][^:]\+[^:.]$' # Testing the regex itself. @@ -45,7 +47,7 @@ travis_regex='^\([a-z0-9]\(\(, \)\|[a-z0-9]\)\+[a-z0-9]: \)\+[A-Z0-9][^:]\+[^:.] [[ $(echo "nope a: bar, foo: barfoofoo: Nope" | grep -c "$travis_regex") -eq 0 ]] test_commit_message() { - echo Testing commit message $1 + echo "Testing commit message $1" if ! git log --format=%s $1 | head -n 1 | grep -q "$travis_regex" then echo "FAIL: Commit message should match the following regex: '$travis_regex'" @@ -67,3 +69,4 @@ then test_commit_message $commit done fi +echo 'PASS' diff --git a/test/test-gofmt.sh b/test/test-gofmt.sh index 085fee87..d89fef02 100755 --- a/test/test-gofmt.sh +++ b/test/test-gofmt.sh @@ -27,3 +27,4 @@ bad_files=$(find_files | xargs $GOFMT -l) if [[ -n "${bad_files}" ]]; then fail_test "The following golang files are not properly formatted: ${bad_files}" fi +echo 'PASS' diff --git a/test/test-golint.sh b/test/test-golint.sh index 5d61de00..643dfed5 100755 --- a/test/test-golint.sh +++ b/test/test-golint.sh @@ -67,4 +67,4 @@ if [ "$DELTA" -gt "$THRESHOLD" ]; then echo "Maximum threshold is: $THRESHOLD %" fail_test "`golint` - FAILED" fi -echo PASS +echo 'PASS' diff --git a/test/test-headerfmt.sh b/test/test-headerfmt.sh index 6b26c963..640ddb20 100755 --- a/test/test-headerfmt.sh +++ b/test/test-headerfmt.sh @@ -28,3 +28,4 @@ bad_files=$( if [[ -n "${bad_files}" ]]; then fail_test "The following file headers are not properly formatted: ${bad_files}" fi +echo 'PASS' diff --git a/test/test-omv.sh b/test/test-omv.sh index e06c4ce5..eda9f442 100755 --- a/test/test-omv.sh +++ b/test/test-omv.sh @@ -18,4 +18,8 @@ done # return to original dir cd "$CWD" >/dev/null -exit $RET +if [ ! $RET -eq 0 ]; then + echo 'FAIL' + exit $RET +fi +echo 'PASS' diff --git a/test/test-reproducible.sh b/test/test-reproducible.sh index 0a8538a7..8fd65c04 100755 --- a/test/test-reproducible.sh +++ b/test/test-reproducible.sh @@ -36,4 +36,4 @@ if [[ -n "${failures}" ]]; then echo "${failures}" exit 1 fi -echo PASS +echo 'PASS' diff --git a/test/test-shell.sh b/test/test-shell.sh index 2ade9cb6..71cba92d 100755 --- a/test/test-shell.sh +++ b/test/test-shell.sh @@ -78,4 +78,4 @@ if [[ -n "${failures}" ]]; then echo "${failures}" exit 1 fi -echo PASS +echo 'PASS' diff --git a/test/test-yamlfmt.sh b/test/test-yamlfmt.sh index a3c3aaf3..e13d4b43 100755 --- a/test/test-yamlfmt.sh +++ b/test/test-yamlfmt.sh @@ -1,6 +1,8 @@ #!/bin/bash # check for any yaml files that aren't properly formatted +exit 0 # i give up, we're skipping this entirely, help wanted to fix this + . test/util.sh echo running test-yamlfmt.sh @@ -8,8 +10,6 @@ set -o errexit set -o nounset set -o pipefail -exit 0 # i give up, we're skipping this entirely, help wanted to fix this - #if env | grep -q -e '^TRAVIS=true$' -e '^JENKINS_URL=' -e '^BUILD_TAG=jenkins'; then # echo "Travis and Jenkins give wonky results here, skipping test!" # exit 0 @@ -63,3 +63,4 @@ bad_files=$( if [[ -n "${bad_files}" ]]; then fail_test "The following yaml files are not properly formatted: ${bad_files}" fi +echo 'PASS'