accept multiple test things
This commit is contained in:
parent
375e8a3137
commit
12f975a0ca
57
urchin
57
urchin
|
@ -48,6 +48,9 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Kill subprocesses on interrupt.
|
||||||
|
trap "kill -$$" SIGHUP SIGINT SIGTERM
|
||||||
|
|
||||||
DEFAULT_SHELLS='sh bash dash mksh zsh'
|
DEFAULT_SHELLS='sh bash dash mksh zsh'
|
||||||
if [ -n "${ZSH_VERSION}" ]; then
|
if [ -n "${ZSH_VERSION}" ]; then
|
||||||
# avoid "no matches found: *" error when directories are empty
|
# avoid "no matches found: *" error when directories are empty
|
||||||
|
@ -55,6 +58,27 @@ if [ -n "${ZSH_VERSION}" ]; then
|
||||||
emulate sh
|
emulate sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
validate_test_arg() {
|
||||||
|
# Must be a file or directory
|
||||||
|
if [ ! -e "${1}" ]; then
|
||||||
|
echo "No such file or directory: '${1}'" >&2
|
||||||
|
echo "${USAGE}" >&2
|
||||||
|
urchin_exit 11
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Molly guard
|
||||||
|
root="$(urchin_root "${1}")"
|
||||||
|
if ! {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
sort_python() {
|
sort_python() {
|
||||||
python -c 'import sys
|
python -c 'import sys
|
||||||
|
@ -493,6 +517,7 @@ validate_strings() {
|
||||||
main() {
|
main() {
|
||||||
cycle_shell=true
|
cycle_shell=true
|
||||||
shell_list="${urchin_tmp}"/shell_list
|
shell_list="${urchin_tmp}"/shell_list
|
||||||
|
test_spec_list="${urchin_tmp}"/test_list
|
||||||
run_in_series=false
|
run_in_series=false
|
||||||
force=false
|
force=false
|
||||||
exit_on_not_ok=false
|
exit_on_not_ok=false
|
||||||
|
@ -549,7 +574,9 @@ main() {
|
||||||
urchin_exit;;
|
urchin_exit;;
|
||||||
-*) urchin_help >&2
|
-*) urchin_help >&2
|
||||||
urchin_exit 11;;
|
urchin_exit 11;;
|
||||||
*) break;;
|
*) validate_strings "${1}" 'Test file names'
|
||||||
|
validate_test_arg "${1}"
|
||||||
|
echo "${1}" >> "${test_spec_list}" ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
@ -573,15 +600,6 @@ main() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify argument for main stuff
|
|
||||||
if [ "${#}" != '1' ] || [ ! -e "${1}" ]; then
|
|
||||||
if [ -n "${1}" ] && [ ! -e "${1}" ]; then
|
|
||||||
echo "No such file or directory: '${1}'" >&2
|
|
||||||
fi
|
|
||||||
echo "${USAGE}" >&2
|
|
||||||
urchin_exit 11
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Warn about strange sort commands
|
# Warn about strange sort commands
|
||||||
weird_string='@ b\n- d\n? a\n~ c\n! e\n'
|
weird_string='@ b\n- d\n? a\n~ c\n! e\n'
|
||||||
sort_result="$(printf "${weird_string}" | sort | cut -d\ -f2 | tr -d '\n')"
|
sort_result="$(printf "${weird_string}" | sort | cut -d\ -f2 | tr -d '\n')"
|
||||||
|
@ -615,19 +633,6 @@ main() {
|
||||||
urchin_exit 11
|
urchin_exit 11
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Molly guard.
|
|
||||||
root="$(urchin_root "${1}")"
|
|
||||||
if ! {
|
|
||||||
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 -------------------- #
|
# -------------------- REALLY RUN -------------------- #
|
||||||
start=$(date +%s)
|
start=$(date +%s)
|
||||||
|
|
||||||
|
@ -635,7 +640,11 @@ main() {
|
||||||
# 2 urchin root
|
# 2 urchin root
|
||||||
# 3 Should we cycle shells?
|
# 3 Should we cycle shells?
|
||||||
# 4 TEST_SHELL
|
# 4 TEST_SHELL
|
||||||
recurse "$(fullpath "${1}")" "${root}" "${cycle_shell}" "${TEST_SHELL}" || :
|
while read seed; do
|
||||||
|
recurse "$(fullpath "${seed}")" "${root}" "${cycle_shell}" \
|
||||||
|
"${TEST_SHELL}" || break
|
||||||
|
break
|
||||||
|
done < "${shell_list}"
|
||||||
finish=$(date +%s)
|
finish=$(date +%s)
|
||||||
|
|
||||||
test $(cat "${urchin_tmp}"/log | wc -l) -gt 0 || {
|
test $(cat "${urchin_tmp}"/log | wc -l) -gt 0 || {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user