Add skip command, rename tests/failures to tests/status

This commit is contained in:
Foo 2015-09-12 20:55:27 +03:00
parent 96f9c62d86
commit 3fca2f8d02
3 changed files with 15 additions and 8 deletions

4
.gitignore vendored
View File

@ -10,7 +10,7 @@ build
message.fail message.fail
client/powerline /client/powerline
/tests/tmp /tests/tmp
/tests/failures /tests/status

View File

@ -13,7 +13,7 @@ if test -z "$FAILED" ; then
FAIL_SUMMARY="" FAIL_SUMMARY=""
TMP_ROOT="$ROOT/tests/tmp" TMP_ROOT="$ROOT/tests/tmp"
export FAILURES_FILE="$ROOT/tests/failures" export FAILURES_FILE="$ROOT/tests/status"
fi fi
ANSI_CLEAR="\033[0K" ANSI_CLEAR="\033[0K"
@ -56,15 +56,22 @@ fail() {
local test_name="$1" ; shift local test_name="$1" ; shift
local fail_char="$allow_failure$1" ; shift local fail_char="$allow_failure$1" ; shift
local message="$1" ; shift local message="$1" ; shift
local verb="${1:-Failed}" ; shift
local full_msg="$fail_char $POWERLINE_CURRENT_SUITE|$test_name :: $message" local full_msg="$fail_char $POWERLINE_CURRENT_SUITE|$test_name :: $message"
FAIL_SUMMARY="${FAIL_SUMMARY}${NL}${full_msg}" FAIL_SUMMARY="${FAIL_SUMMARY}${NL}${full_msg}"
echo "Failed: $full_msg" echo "$verb: $full_msg"
echo "$full_msg" >> "$FAILURES_FILE" echo "$full_msg" >> "$FAILURES_FILE"
if test -z "$allow_failure" ; then if test -z "$allow_failure" ; then
FAILED=1 FAILED=1
fi fi
} }
skip() {
local test_name="$1" ; shift
local message="$1" ; shift
fail --allow-failure "$test_name" S "$message" "Skipped"
}
make_test_root() { make_test_root() {
local suffix="${POWERLINE_CURRENT_SUITE##*/}" local suffix="${POWERLINE_CURRENT_SUITE##*/}"

View File

@ -33,10 +33,10 @@ for script in "$ROOT"/tests/test_*/test.sh ; do
fi fi
done done
if test -e tests/failures ; then if test -e "$FAILURES_FILE" ; then
echo "Some tests failed. Summary:" echo "Fails and skips summary:"
cat tests/failures cat "$FAILURES_FILE"
rm tests/failures rm "$FAILURES_FILE"
fi fi
exit_suite exit_suite