local variables
This commit is contained in:
parent
37e57773a6
commit
47860e56ce
82
urchin
82
urchin
|
@ -157,26 +157,6 @@ Go to https://thomaslevine.com/!/urchin/ for documentation on writing tests.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
# -------------------- Dependency checks --------------------
|
|
||||||
if command -v md5 1> /dev/null 2> /dev/null; then
|
|
||||||
urchin_md5=md5
|
|
||||||
elif command -v md5sum 1> /dev/null 2> /dev/null; then
|
|
||||||
urchin_md5=md5sum
|
|
||||||
else
|
|
||||||
echo Could not find MD5 hash command >&2
|
|
||||||
exit 10
|
|
||||||
fi
|
|
||||||
|
|
||||||
if epoch_date 2>&1 > /dev/null; then
|
|
||||||
epoch=epoch_date
|
|
||||||
elif epoch_pax 2>&1 > /dev/null; then
|
|
||||||
epoch=epoch_pax
|
|
||||||
else
|
|
||||||
echo I could not find a seconds counter. >&2
|
|
||||||
exit 10
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# -------------------- Portable wrappers --------------------
|
# -------------------- Portable wrappers --------------------
|
||||||
mktemp_dir() {
|
mktemp_dir() {
|
||||||
# Support HP-UX mktemp that has wrong exit codes and
|
# Support HP-UX mktemp that has wrong exit codes and
|
||||||
|
@ -204,6 +184,15 @@ md5 () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# -------------------- Utilities --------------------
|
# -------------------- Utilities --------------------
|
||||||
|
if command -v md5 1> /dev/null 2> /dev/null; then
|
||||||
|
urchin_md5=md5
|
||||||
|
elif command -v md5sum 1> /dev/null 2> /dev/null; then
|
||||||
|
urchin_md5=md5sum
|
||||||
|
else
|
||||||
|
echo Could not find MD5 hash command >&2
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
|
||||||
epoch_date() {
|
epoch_date() {
|
||||||
date +%s
|
date +%s
|
||||||
}
|
}
|
||||||
|
@ -214,6 +203,17 @@ epoch_pax() {
|
||||||
rm "${tmp}"
|
rm "${tmp}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if epoch_date 2>&1 > /dev/null; then
|
||||||
|
epoch=epoch_date
|
||||||
|
elif epoch_pax 2>&1 > /dev/null; then
|
||||||
|
epoch=epoch_pax
|
||||||
|
else
|
||||||
|
echo I could not find a seconds counter. >&2
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
plural () {
|
plural () {
|
||||||
# Make $1 a plural according to the number $2.
|
# Make $1 a plural according to the number $2.
|
||||||
# If $3 is supplied, use that instead of "${1}s".
|
# If $3 is supplied, use that instead of "${1}s".
|
||||||
|
@ -699,7 +699,7 @@ wantto run urchin on that directory.' >&2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if "${exit_on_not_ok}" && ! "${run_in_series}"; then
|
if is_set exit_on_not_ok && ! is_set run_in_series; then
|
||||||
echo 'You must also pass -b/--series in order to use -e/--exit-on-fail.' >&2
|
echo 'You must also pass -b/--series in order to use -e/--exit-on-fail.' >&2
|
||||||
exit 11
|
exit 11
|
||||||
fi
|
fi
|
||||||
|
@ -716,30 +716,30 @@ wantto run urchin on that directory.' >&2
|
||||||
echo >> "${urchin_tmp}"/head
|
echo >> "${urchin_tmp}"/head
|
||||||
|
|
||||||
start=$("${epoch}")
|
start=$("${epoch}")
|
||||||
echo "${test_seeds}" | while read -r seed; do
|
return_code=$(
|
||||||
set +e
|
echo "${test_seeds}" | while read -r seed; do
|
||||||
recurse "${root}" "$(fullpath "${seed}")" "${TEST_SHELL}"
|
catch recurse "${root}" "$(fullpath "${seed}")"
|
||||||
return_code=$?
|
test "${return_code}" -eq 0 || break
|
||||||
set -e
|
done|tail -n1
|
||||||
test "${return_code}" -eq 0 || break
|
)
|
||||||
done
|
|
||||||
finish=$("${epoch}")
|
finish=$("${epoch}")
|
||||||
|
|
||||||
if test "${return_code}" -le 1; then
|
|
||||||
if test -f "${urchin_tmp}"/log ; then
|
# if test "${return_code}" -le 1; then
|
||||||
echo Print output.
|
# if test -f "${urchin_tmp}"/log ; then
|
||||||
# cat "${urchin_tmp}"/head
|
# echo Print output.
|
||||||
# report_outcome "${root}" "${format}" "${urchin_tmp}"/log "${start}" \
|
# # cat "${urchin_tmp}"/head
|
||||||
# "${finish}"
|
# # report_outcome "${root}" "${format}" "${urchin_tmp}"/log "${start}" \
|
||||||
# cat "${urchin_tmp}"/foot
|
# # "${finish}"
|
||||||
else
|
# # cat "${urchin_tmp}"/foot
|
||||||
echo 'No tests found' >&2
|
# else
|
||||||
return_code=2
|
# echo 'No tests found' >&2
|
||||||
fi
|
# return_code=2
|
||||||
fi
|
# fi
|
||||||
|
# fi
|
||||||
|
|
||||||
rm -Rf "${urchin_tmp}"
|
rm -Rf "${urchin_tmp}"
|
||||||
exit "${exit_code}"
|
exit "${return_code}"
|
||||||
}
|
}
|
||||||
|
|
||||||
is_set NO_MAIN || main "$@"
|
is_set NO_MAIN || main "$@"
|
||||||
|
|
Loading…
Reference in New Issue