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
client/powerline
/client/powerline
/tests/tmp
/tests/failures
/tests/status

View File

@ -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##*/}"

View File

@ -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