This commit is contained in:
Thomas Levine 2016-01-27 10:31:51 +00:00
parent 508e695dc3
commit 1c93e9a5c2

17
urchin
View File

@ -91,6 +91,7 @@ recurse() {
result=skip result=skip
fi fi
echo "${result}" >> "$logfile"
if $tap_format; then if $tap_format; then
n=$(grep -ce '^\(success\|fail\|skip\)' "$logfile") n=$(grep -ce '^\(success\|fail\|skip\)' "$logfile")
@ -104,8 +105,7 @@ recurse() {
else else
skip='' skip=''
fi fi
echo "${not}ok $((n + 1)) - ${skip}${potential_test}" echo "${not}ok $n - ${skip}${potential_test}"
echo "${result} ${potential_test}" >> "$logfile"
if [ "$result" == fail ]; then if [ "$result" == fail ]; then
echo '# ------------ Begin output ------------' echo '# ------------ Begin output ------------'
sed 's/^/# /' "$stdout_file" sed 's/^/# /' "$stdout_file"
@ -118,20 +118,17 @@ recurse() {
# On success, print a green '✓' # On success, print a green '✓'
printf '\033[32m✓ \033[0m' printf '\033[32m✓ \033[0m'
printf '%s\n' "${potential_test}" printf '%s\n' "${potential_test}"
printf '%s\n' "${potential_test} passed" >> "$logfile"
;; ;;
fail) fail)
# On fail, print a red '✗' # On fail, print a red '✗'
printf '\033[31m✗ \033[0m' printf '\033[31m✗ \033[0m'
printf '%s\n' "${potential_test}" printf '%s\n' "${potential_test}"
printf '%s\n' "${potential_test} failed" >> "$logfile"
printf '\033[31m' # Print output captured from failed test in red. printf '\033[31m' # Print output captured from failed test in red.
cat "$stdout_file" cat "$stdout_file"
printf '\033[0m' printf '\033[0m'
;; ;;
skip) skip)
printf ' %s\n' "${potential_test}" printf ' %s\n' "${potential_test}"
printf '%s\n' "${potential_test} skipped" >> "$logfile"
;; ;;
esac esac
fi fi
@ -177,10 +174,11 @@ plural () {
} }
urchin_go() { urchin_go() {
rm -f "$logfile"
if "$tap_format"; then if "$tap_format"; then
printf \#\ printf \#\
fi fi
echo Running tests at $(date +%Y-%m-%dT%H:%M:%S) | tee "$logfile" echo Running tests at $(date +%Y-%m-%dT%H:%M:%S)
start=$(date +%s) start=$(date +%s)
# Determine the environment variable to define for test scripts # Determine the environment variable to define for test scripts
@ -205,9 +203,9 @@ urchin_go() {
echo "# Took $elapsed $(plural second $elapsed)." echo "# Took $elapsed $(plural second $elapsed)."
else else
echo "Done, took $elapsed $(plural second $elapsed)." echo "Done, took $elapsed $(plural second $elapsed)."
passed=$(grep -c 'passed$' "$logfile") passed=$(grep -c '^success' "$logfile")
failed=$(grep -c 'failed$' "$logfile") failed=$(grep -c '^fail' "$logfile")
skipped=$(grep -c 'skipped$' "$logfile") skipped=$(grep -c '^skip' "$logfile")
printf '%s\n' "$passed $(plural test "$passed") passed." printf '%s\n' "$passed $(plural test "$passed") passed."
printf '%s\n' "$skipped $(plural test "$skipped") skipped." printf '%s\n' "$skipped $(plural test "$skipped") skipped."
@ -215,6 +213,7 @@ urchin_go() {
printf '%s\n' "$failed $(plural test "$failed") failed." printf '%s\n' "$failed $(plural test "$failed") failed."
printf '\033[m' printf '\033[m'
fi fi
rm -f "$logfile"
test -z "$failed" || test "$failed" -eq '0' test -z "$failed" || test "$failed" -eq '0'
} }