Merge pull request #6 from scraperwiki/exit-code
Set the exit status to reflect pass/fail.
This commit is contained in:
commit
f12636e029
0
tests/urchin exit code/.test/This test passes
Executable file
0
tests/urchin exit code/.test/This test passes
Executable file
13
tests/urchin exit code/non zero exit code when a test fails
Executable file
13
tests/urchin exit code/non zero exit code when a test fails
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Borrow this test which has a failure in it (3 in fact), and
|
||||||
|
# run it using urchin:
|
||||||
|
../../urchin "../Counts should be kept of successes and failures./.test" > /dev/null
|
||||||
|
|
||||||
|
# Now invert the result, we want _this_ test to fail if the exit
|
||||||
|
# code was 0.
|
||||||
|
case $? in
|
||||||
|
0) exit 8;;
|
||||||
|
*) exit 0;;
|
||||||
|
esac
|
||||||
|
|
1
tests/urchin exit code/zero exit code when tests all pass
Executable file
1
tests/urchin exit code/zero exit code when tests all pass
Executable file
|
@ -0,0 +1 @@
|
||||||
|
../../urchin .test > /dev/null
|
1
urchin
1
urchin
|
@ -111,6 +111,7 @@ urchin_go() {
|
||||||
set -- $(grep -e 'passed$' "$logfile"|wc -l) $(grep -e 'failed$' "$logfile"|wc -l)
|
set -- $(grep -e 'passed$' "$logfile"|wc -l) $(grep -e 'failed$' "$logfile"|wc -l)
|
||||||
printf '%s\n' "$1 $(plural test "$1") passed."
|
printf '%s\n' "$1 $(plural test "$1") passed."
|
||||||
printf '%s\n' "$2 $(plural test "$2") failed."
|
printf '%s\n' "$2 $(plural test "$2") failed."
|
||||||
|
return "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
urchin_molly_guard() {
|
urchin_molly_guard() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user