fix molly guard

This commit is contained in:
Thomas Levine 2016-03-02 21:18:40 +00:00
parent 9fecb802cb
commit 918bf31ec5

28
urchin
View File

@ -445,6 +445,7 @@ validate_strings() {
} }
} }
main() {
cycle_shell=true cycle_shell=true
shell_list="${urchin_tmp}"/shell_list shell_list="${urchin_tmp}"/shell_list
run_in_series=false run_in_series=false
@ -491,6 +492,7 @@ you don't need to quote the TEST_SHELL variable." > /dev/stderr
shift shift
done done
# -------------------- VALIDATE INPUT -------------------- #
if ! "${cycle_shell}" && test -f "${shell_list}"; then if ! "${cycle_shell}" && test -f "${shell_list}"; then
echo "The -n/--disable-cycling and -s/--shell options clash with each other." >&2 echo "The -n/--disable-cycling and -s/--shell options clash with each other." >&2
urchin_exit 11 urchin_exit 11
@ -543,11 +545,20 @@ if "${exit_on_not_ok}" && ! "${run_in_series}"; then
urchin_exit 11 urchin_exit 11
fi fi
# Run or present the Molly guard. # Molly guard.
root="$(urchin_root "${1}")" root="$(urchin_root "${1}")"
if basename "$(fullpath "${root}")" | if ! {
grep -i 'test' > /dev/null || "${force}"; then basename "$(fullpath "${root}")" |
grep -i 'test' > /dev/null || "${force}"
}; then
echo 'The root directory of the tests that you are running urchin on
does not contain the word "test", so I am not running,
in case that was an accident. Use the -f flag if you really
want to run urchin on that directory.' >&2
urchin_exit 1
fi
# -------------------- REALLY RUN -------------------- #
start=$(date +%s) start=$(date +%s)
# 1 test file or folder to run # 1 test file or folder to run
@ -560,11 +571,6 @@ if basename "$(fullpath "${root}")" |
report_outcome "${root}" "${tap_format}" "${urchin_tmp}"/log "${start}" \ report_outcome "${root}" "${tap_format}" "${urchin_tmp}"/log "${start}" \
"${finish}" "${finish}"
urchin_exit "${?}" urchin_exit "${?}"
else }
echo 'The root directory of the tests that you are running urchin on
does not contain the word "test", so I am not running, main "$@"
in case that was an accident. Use the -f flag if you really
want to run urchin on that directory.' >&2
exit_code=1
fi
urchin_exit "${exit_code}"