This commit is contained in:
Thomas Levine 2016-04-11 16:20:20 +00:00
parent bd4d06bef6
commit 6fea07d8cf
1 changed files with 14 additions and 19 deletions

33
urchin
View File

@ -322,15 +322,6 @@ test_suite_root() {
fi fi
} }
# Print the return code of a command, and suppress printing.
catch() {
if eval "${*}" &> /dev/null; then
echo 0
else
echo "$?"
fi
}
# -------------------- Printing output -------------------- # -------------------- Printing output --------------------
# Format functions may read a log file from stdin. # Format functions may read a log file from stdin.
@ -484,14 +475,17 @@ recurse() {
meta_finalize=' meta_finalize='
if test -f .urchin_dir && grep series ./.urchin_dir > /dev/null || if test -f .urchin_dir && grep series ./.urchin_dir > /dev/null ||
"${run_in_series_root}"; then "${run_in_series_root}"; then
return_code=$(catch wait "${!}") set +e
if "${exit_on_not_ok}" && test "${exit_code}" -ne 0; then wait ${!}
eval "$(dot_if_exists teardown_dir)" return_code=$?
set -e
if "${exit_on_not_ok}" && test "${return_code}" -ne 0; then
eval "$(meta_dot_if_exists teardown_dir)"
return $return_code return $return_code
fi fi
fi fi
' '
dot_if_exists() { meta_dot_if_exists() {
echo " echo "
if test -f ${1}; then if test -f ${1}; then
. ./${1} . ./${1}
@ -503,7 +497,7 @@ recurse() {
( (
cd -- "${abs_current}" cd -- "${abs_current}"
eval "$(dot_if_exists setup_dir)" eval "$(meta_dot_if_exists setup_dir)"
for test in *; do for test in *; do
if test "${test}" = '*' && ! test -e "${test}"; then if test "${test}" = '*' && ! test -e "${test}"; then
@ -517,13 +511,13 @@ recurse() {
done done
wait wait
eval "$(dot_if_exists teardown_dir)" eval "$(meta_dot_if_exists teardown_dir)"
) )
elif [ -f "${abs_current}" ]; then elif [ -f "${abs_current}" ]; then
cd -- "$(dirname -- "${abs_current}")" cd -- "$(dirname -- "${abs_current}")"
echo "${shell_list}" | while read -r sh; do echo "${shell_list}" | while read -r sh; do
( (
eval "$(dot_if_exists setup)" eval "$(meta_dot_if_exists setup)"
out_file="$(stdout_file "${urchin_tmp}" "${rel_current}" "${sh}")" out_file="$(stdout_file "${urchin_tmp}" "${rel_current}" "${sh}")"
@ -541,7 +535,7 @@ recurse() {
finish=$("${epoch}") finish=$("${epoch}")
elapsed=$(($finish - $start)) elapsed=$(($finish - $start))
eval "$(dot_if_exists teardown)" eval "$(meta_dot_if_exists teardown)"
case "${exit_code}" in case "${exit_code}" in
0) result=ok ;; 0) result=ok ;;
@ -700,11 +694,11 @@ want to run urchin on that directory.' >&2
start=$("${epoch}") start=$("${epoch}")
while read -r seed; do while read -r seed; do
root="$(test_suite_root "${seed}")" root="$(fullpath "$(test_suite_root "${seed}")")"
abs="$(fullpath "${seed}")" abs="$(fullpath "${seed}")"
set +e set +e
recurse "${root}" "${abs}" "${abs}" \ recurse "${root}" "${abs}" "${root}" \
"${run_in_series}" "${exit_on_not_ok}" "${run_in_series}" "${exit_on_not_ok}"
return_code=$? return_code=$?
set -e set -e
@ -742,4 +736,5 @@ EOF
exit "${return_code}" exit "${return_code}"
} }
echo "kill -$$"
is_set NO_MAIN || main "$@" is_set NO_MAIN || main "$@"