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