Compare commits
4 Commits
tap
...
exit-on-fa
Author | SHA1 | Date | |
---|---|---|---|
|
1941bf716a | ||
|
9f175f19b3 | ||
|
9043430750 | ||
|
f2d63b2953 |
0
tests/.die-on-fail/1 should run.
Executable file
0
tests/.die-on-fail/1 should run.
Executable file
1
tests/.die-on-fail/2 should run.
Executable file
1
tests/.die-on-fail/2 should run.
Executable file
@@ -0,0 +1 @@
|
||||
false
|
1
tests/.die-on-fail/3 should not run.
Executable file
1
tests/.die-on-fail/3 should not run.
Executable file
@@ -0,0 +1 @@
|
||||
false
|
1
tests/.die-on-fail/4 should not run.
Executable file
1
tests/.die-on-fail/4 should not run.
Executable file
@@ -0,0 +1 @@
|
||||
false
|
11
tests/Die on fail.
Executable file
11
tests/Die on fail.
Executable file
@@ -0,0 +1,11 @@
|
||||
tmp=$(mktemp)
|
||||
../urchin -e -f ./.die-on-fail > $tmp
|
||||
result=$?
|
||||
|
||||
grep '1 should run.' $tmp
|
||||
grep '2 should run.' $tmp
|
||||
grep -v '3 should not run.' $tmp
|
||||
grep -v '4 should not run.' $tmp
|
||||
|
||||
rm $tmp
|
||||
exit $result
|
17
urchin
17
urchin
@@ -47,6 +47,13 @@ recurse() {
|
||||
|
||||
# $2 instead of $indent_level so it doesn't clash
|
||||
recurse "${test}" $(( $2 + 1 )) "$shell_for_sh_tests"
|
||||
exit_code=$?
|
||||
|
||||
if $exit_on_fail && test $exit_code -ne 0; then
|
||||
[ -f teardown ] && [ -x teardown ] && ./teardown >> "$stdout_file"
|
||||
[ -f teardown_dir ] && [ -x teardown_dir ] && ./teardown_dir >> "$stdout_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
[ -f teardown ] && [ -x teardown ] && ./teardown >> "$stdout_file"
|
||||
done
|
||||
@@ -67,7 +74,6 @@ recurse() {
|
||||
fi
|
||||
exit_code="$?"
|
||||
|
||||
|
||||
[ -f teardown ] && [ -x teardown ] && ./teardown >> "$stdout_file"
|
||||
|
||||
indent $indent_level
|
||||
@@ -86,6 +92,10 @@ recurse() {
|
||||
cat "$stdout_file"
|
||||
printf '\033[0m'
|
||||
fi
|
||||
|
||||
if $exit_on_fail && test 0 -ne $exit_code; then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
[ $indent_level -eq 0 ] && rm "$stdout_file"
|
||||
}
|
||||
@@ -105,6 +115,9 @@ $USAGE
|
||||
|
||||
-s <shell> Invoke test scripts that either have no shebang line at all or
|
||||
have shebang line "#!/bin/sh" with the specified shell.
|
||||
-e Stop running if any single test fails. This is helpful if you want
|
||||
to use Urchin to run things other than tests, such as a set of
|
||||
configuration scripts.
|
||||
-f Force running even if the test directory's name does not
|
||||
contain the word "test".
|
||||
-h This help.
|
||||
@@ -170,9 +183,11 @@ urchin_molly_guard() {
|
||||
|
||||
shell_for_sh_tests=
|
||||
force=false
|
||||
exit_on_fail=false
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-e) exit_on_fail=true;;
|
||||
-f) force=true;;
|
||||
-s)
|
||||
shift
|
||||
|
Reference in New Issue
Block a user