simpler return codes for recurse

This commit is contained in:
Thomas Levine 2016-04-10 21:05:34 +00:00
parent 9bc3d63ded
commit de4a92de7a
1 changed files with 19 additions and 12 deletions

31
urchin
View File

@ -271,6 +271,14 @@ stdout_file() {
echo "${x}/$(md5 "${the_shell}")" echo "${x}/$(md5 "${the_shell}")"
} }
# Print a line of a log file
log() {
for arg in "$@"; do
printf "${arg}\t"
done
printf '\n'
}
# Root directory of the present test suite # Root directory of the present test suite
# USAGE: test_suite_root <directory> # USAGE: test_suite_root <directory>
test_suite_root() { test_suite_root() {
@ -428,12 +436,12 @@ format_urchin() {
# 1) At least one test failed. # 1) At least one test failed.
# *) Something else went wrong; Urchin should exit with the same code. # *) Something else went wrong; Urchin should exit with the same code.
recurse() { recurse() {
requested_path="${1}" test_suite_root="${1}"
potential_test="$(fullpath "${2}")" requested_path="${2}"
cycle_shell="${3}" potential_test="$(fullpath "${3}")"
TEST_SHELL="${4}"
root="$(test_suite_root "${1}")" abs="${potential_test}"
rel="${potential_test##"${test_suite_root}/"}"
for ignore in setup_dir teardown_dir setup teardown; do for ignore in setup_dir teardown_dir setup teardown; do
if test "$(basename "${potential_test}")" = "${ignore}"; then if test "$(basename "${potential_test}")" = "${ignore}"; then
@ -454,11 +462,10 @@ recurse() {
fi fi
if contains "${potential_test}" "${HT}"; then if contains "${potential_test}" "${HT}"; then
echo 'Test file names may not contain tabs (HT).' >&2 echo "${shell_list}" | while read sh; do
return 11 log "${remote}" "${sh}" "${rel}" tab '' >> "${urchin_tmp}"/log
fi done
elif [ -x "${potential_test}" ]; then
if [ -x "${potential_test}" ]; then
if [ -d "${potential_test}" ]; then if [ -d "${potential_test}" ]; then
( (
cd -- "${potential_test}" cd -- "${potential_test}"
@ -478,7 +485,7 @@ recurse() {
break break
fi fi
recurse "${requested_path}" "${test}" "${TEST_SHELL}" & recurse "${requested_path}" "${test}" &
if "${run_in_series}" || "${run_in_series_dir}"; then if "${run_in_series}" || "${run_in_series_dir}"; then
if ! wait "${!}"; then if ! wait "${!}"; then
@ -705,7 +712,7 @@ wantto run urchin on that directory.' >&2
start=$("${epoch}") start=$("${epoch}")
echo "${test_seeds}" | while read seed; do echo "${test_seeds}" | while read seed; do
set +e set +e
recurse "${root}" "$(fullpath "${seed}")""${TEST_SHELL}" recurse "${root}" "$(fullpath "${seed}")" "${TEST_SHELL}"
return_code=$? return_code=$?
set -e set -e
test "${return_code}" -eq 0 || break test "${return_code}" -eq 0 || break