merge small functions
This commit is contained in:
parent
d9ffa53e25
commit
dc90ed8578
69
urchin
69
urchin
@ -161,20 +161,13 @@ EOF
|
|||||||
mktemp_dir() {
|
mktemp_dir() {
|
||||||
# Support HP-UX mktemp that has wrong exit codes and
|
# Support HP-UX mktemp that has wrong exit codes and
|
||||||
# can't make directories.
|
# can't make directories.
|
||||||
tmp=$(mktemp /tmp/urchin.XXXXXXXX)
|
tmp=$(mktemp)
|
||||||
if test -f "${tmp}"; then
|
if test -f "${tmp}"; then
|
||||||
rm "${tmp}"
|
rm "${tmp}"
|
||||||
fi
|
fi
|
||||||
mkdir "${tmp}"
|
mkdir "${tmp}"
|
||||||
echo "${tmp}"
|
echo "${tmp}"
|
||||||
}
|
}
|
||||||
mktemp_file() {
|
|
||||||
tmp=$(mktemp /tmp/urchin.XXXXXXXX)
|
|
||||||
if ! test -f "${tmp}"; then
|
|
||||||
> "${tmp}"
|
|
||||||
fi
|
|
||||||
echo "${tmp}"
|
|
||||||
}
|
|
||||||
|
|
||||||
md5 () {
|
md5 () {
|
||||||
case "${urchin_md5}" in
|
case "${urchin_md5}" in
|
||||||
@ -198,7 +191,7 @@ epoch_date() {
|
|||||||
}
|
}
|
||||||
epoch_pax() {
|
epoch_pax() {
|
||||||
# Based on http://stackoverflow.com/a/7262588/407226
|
# Based on http://stackoverflow.com/a/7262588/407226
|
||||||
tmp="$(mktemp_file)"
|
tmp="$(mktemp)"
|
||||||
echo "ibase=8;$({ pax -wx cpio "${tmp}"; echo; } | cut -c 48-59)" | bc
|
echo "ibase=8;$({ pax -wx cpio "${tmp}"; echo; } | cut -c 48-59)" | bc
|
||||||
rm "${tmp}"
|
rm "${tmp}"
|
||||||
}
|
}
|
||||||
@ -563,33 +556,15 @@ recurse() {
|
|||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
fi
|
fi
|
||||||
else
|
elif test -n "${rel_current}"; then
|
||||||
# Skip because the file is not executable.
|
# Skip because the file is not executable.
|
||||||
echo "${shell_list}" | while read -r sh; do
|
echo "${shell_list}" | while read -r sh; do
|
||||||
printf "\t${sh}\t${rel_current}\tskip\t0\n" >> "${urchin_tmp}"/log
|
printf "\t${sh}\t${rel_current}\tskip\t0\n" >> "${urchin_tmp}"/log
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
echo ${rel_current} 3 >> /tmp/bbb
|
||||||
}
|
}
|
||||||
|
|
||||||
report_outcome() {
|
|
||||||
format="${2}"
|
|
||||||
log_file="${3}"
|
|
||||||
start="${4}"
|
|
||||||
finish="${5}"
|
|
||||||
|
|
||||||
elapsed=$(($finish - $start))
|
|
||||||
|
|
||||||
# Use a temporary file rather than a pipe because a pipe starts a sub-shell
|
|
||||||
# and thus makes the above variables local.
|
|
||||||
sorted_log_file=$(mktemp_file)
|
|
||||||
cat "${log_file}" | LC_COLLATE=C sort > "${sorted_log_file}"
|
|
||||||
|
|
||||||
rm "${sorted_log_file}"
|
|
||||||
|
|
||||||
test "${not_oks}" -eq '0'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# Defaults
|
# Defaults
|
||||||
format=urchin
|
format=urchin
|
||||||
@ -663,19 +638,23 @@ you don't need to quote the TEST_SHELL variable." >&2
|
|||||||
# Molly guard
|
# Molly guard
|
||||||
root="$(test_suite_root "${1}")"
|
root="$(test_suite_root "${1}")"
|
||||||
basename "$(fullpath "${root}")" |
|
basename "$(fullpath "${root}")" |
|
||||||
grep -i 'test' > /dev/null || "${force}"
|
grep -i 'test' > /dev/null
|
||||||
}; then
|
}; then
|
||||||
echo 'The root directory of the tests that you are running urchin on
|
molly=true
|
||||||
doesnot contain the word "test", so I am not running,
|
|
||||||
in case that was an accident. Use the -f flag if you really
|
|
||||||
wantto run urchin on that directory.' >&2
|
|
||||||
exit 12
|
|
||||||
fi
|
fi
|
||||||
test_seeds="${1}${LF}${test_seeds}" ;;
|
test_seeds="${1}${LF}${test_seeds}" ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if is_set molly && ! is_set force; then
|
||||||
|
echo 'The root directory of the tests that you are running urchin on
|
||||||
|
doesnot 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
|
||||||
|
exit 12
|
||||||
|
fi
|
||||||
|
|
||||||
# If -s was not passed, use the available default shells.
|
# If -s was not passed, use the available default shells.
|
||||||
if ! is_set "${shell_list}"; then
|
if ! is_set "${shell_list}"; then
|
||||||
if $cycle_shell; then
|
if $cycle_shell; then
|
||||||
@ -722,16 +701,26 @@ wantto run urchin on that directory.' >&2
|
|||||||
done<<EOF
|
done<<EOF
|
||||||
${test_seeds}
|
${test_seeds}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
finish=$("${epoch}")
|
finish=$("${epoch}")
|
||||||
|
|
||||||
if test "${return_code}" -le 1; then
|
if test "${return_code}" -le 1; then
|
||||||
if test -f "${urchin_tmp}"/log ; then
|
if test -f "${urchin_tmp}"/log ; then
|
||||||
echo Print output.
|
echo Print output.
|
||||||
# cat "${urchin_tmp}"/head
|
# cat "${urchin_tmp}"/head
|
||||||
# report_outcome "${root}" "${format}" "${urchin_tmp}"/log "${start}" \
|
|
||||||
# "${finish}"
|
# "${urchin_tmp}"/log
|
||||||
# cat "${urchin_tmp}"/foot
|
# elapsed=$(($finish - $start))
|
||||||
|
|
||||||
|
# # Use a temporary file rather than a pipe because a pipe starts a sub-shell
|
||||||
|
# # and thus makes the above variables local.
|
||||||
|
# sorted_log_file=$(mktemp)
|
||||||
|
# cat "${log_file}" | LC_COLLATE=C sort > "${sorted_log_file}"
|
||||||
|
|
||||||
|
# rm "${sorted_log_file}"
|
||||||
|
|
||||||
|
# test "${not_oks}" -eq '0'
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
echo 'No tests found' >&2
|
echo 'No tests found' >&2
|
||||||
return_code=2
|
return_code=2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user