From aaf4dc93676f51bb8c81c32faa783433349c5a32 Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Sun, 28 Feb 2016 09:36:48 +0000 Subject: [PATCH] Automatic commit with j --- urchin | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/urchin b/urchin index dd16409..39c2100 100755 --- a/urchin +++ b/urchin @@ -39,6 +39,8 @@ indent() { fi } +# Recurse prints its exit code to stdout so that we don't have to +# set +e to read it. recurse() { potential_test="$1" shell_for_sh_tests="$2" @@ -51,7 +53,7 @@ recurse() { if [ -d "$potential_test" ]; then ( - cd -- "$potential_test" + cd -- "$potential_test" > /dev/null [ -f setup_dir ] && . ./setup_dir > /dev/null if [ -n "$ZSH_VERSION" ]; then @@ -62,10 +64,7 @@ recurse() { for test in *; do [ -f setup ] && . ./setup > /dev/null - set +e - recurse "${test}" "$shell_for_sh_tests" "$TEST_SHELL" - exit_code=$? - set -e + exit_code=$(recurse "${test}" "$shell_for_sh_tests" "$TEST_SHELL") if $exit_on_fail && test $exit_code -ne 0; then [ -f teardown ] && . ./teardown > /dev/null @@ -76,7 +75,7 @@ recurse() { [ -f teardown ] && . ./teardown > /dev/null done [ -f teardown_dir ] && . ./teardown_dir > /dev/null - ) + ) || ( echo 1 && return; ) else stdout_file="$tmp/stdout$(urchin_path "$potential_test")" mkdir -p "$(dirname "$stdout_file")" @@ -108,9 +107,10 @@ recurse() { printf "${potential_test}\t${result}\n" >> "$tmp"/log if $exit_on_fail && test 0 -ne $exit_code; then - return 1 + echo 1 && return fi fi + echo 0 } report_outcome() { @@ -327,9 +327,8 @@ if fullpath "$1" | grep -Fi 'test' > /dev/null || $force # 1 test folder # 2 shell to invoke test scripts with # 3 TEST_SHELL - recurse "$1" "$shell_for_sh_tests" "$TEST_SHELL" || : - + exit_code=$(recurse "$1" "$shell_for_sh_tests" "$TEST_SHELL") + urchin_exit $exit_code else urchin_molly_guard fi -urchin_exit