From 3fca2f8d024b9588b208e4b687a8ae471e4d48ab Mon Sep 17 00:00:00 2001 From: Foo Date: Sat, 12 Sep 2015 20:55:27 +0300 Subject: [PATCH] Add skip command, rename tests/failures to tests/status --- .gitignore | 4 ++-- tests/shlib/common.sh | 11 +++++++++-- tests/test.sh | 8 ++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 893e30dd..6491a772 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ build message.fail -client/powerline +/client/powerline /tests/tmp -/tests/failures +/tests/status diff --git a/tests/shlib/common.sh b/tests/shlib/common.sh index ed4504a9..1faa3333 100644 --- a/tests/shlib/common.sh +++ b/tests/shlib/common.sh @@ -13,7 +13,7 @@ if test -z "$FAILED" ; then FAIL_SUMMARY="" TMP_ROOT="$ROOT/tests/tmp" - export FAILURES_FILE="$ROOT/tests/failures" + export FAILURES_FILE="$ROOT/tests/status" fi ANSI_CLEAR="\033[0K" @@ -56,15 +56,22 @@ fail() { local test_name="$1" ; shift local fail_char="$allow_failure$1" ; shift local message="$1" ; shift + local verb="${1:-Failed}" ; shift local full_msg="$fail_char $POWERLINE_CURRENT_SUITE|$test_name :: $message" FAIL_SUMMARY="${FAIL_SUMMARY}${NL}${full_msg}" - echo "Failed: $full_msg" + echo "$verb: $full_msg" echo "$full_msg" >> "$FAILURES_FILE" if test -z "$allow_failure" ; then FAILED=1 fi } +skip() { + local test_name="$1" ; shift + local message="$1" ; shift + fail --allow-failure "$test_name" S "$message" "Skipped" +} + make_test_root() { local suffix="${POWERLINE_CURRENT_SUITE##*/}" diff --git a/tests/test.sh b/tests/test.sh index 1c6f9881..1beb5c6f 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -33,10 +33,10 @@ for script in "$ROOT"/tests/test_*/test.sh ; do fi done -if test -e tests/failures ; then - echo "Some tests failed. Summary:" - cat tests/failures - rm tests/failures +if test -e "$FAILURES_FILE" ; then + echo "Fails and skips summary:" + cat "$FAILURES_FILE" + rm "$FAILURES_FILE" fi exit_suite