Compare commits

...

3 Commits

Author SHA1 Message Date
Thomas Levine
61315d377e remote 2016-04-08 07:32:01 +00:00
Thomas Levine
7daa85cd32 remote host names 2016-04-08 07:08:05 +00:00
Thomas Levine
90b2f93de6 output format to support remotes 2016-04-08 06:56:22 +00:00

88
urchin
View File

@ -149,14 +149,23 @@ fi
stdout_file() {
the_test="${1}"
the_shell="${2}"
host="${3}"
if test -n "${host}"; then
# This assumes the tests ran on a remote and have been copied.
x="${urchin_tmp}/remote/${host}/stdout${the_test}"
else
# This can be run during the tests.
x="${urchin_tmp}/stdout$(fullpath "$the_test")"
mkdir -p "${x}"
fi
x="${urchin_tmp}/stdout$(fullpath "$the_test")"
mkdir -p "${x}"
case "${urchin_md5}" in
md5sum) y=$(echo "${the_shell}" | md5sum | cut -d\ -f1) ;;
md5) y=$(echo "${the_shell}" | md5 | sed 's/.* //') ;;
*) echo md5 command is not configured >&2; urchin_exit 1;;
esac
echo "${x}/${y}"
}
@ -353,16 +362,23 @@ report_outcome() {
start="${4}"
finish="${5}"
host="${6}"
if test -n "${host}"; then
onhost=" on ${host}"
fi
escaped_root="$(fullpath "${root}" | sed 's/\//\\\//g')"
elapsed=$(($finish - $start))
if "${tap_format}"; then
printf \#\
fi
if "${print_margins}" || "${tap_format}"; then
echo Running tests at $(date +%Y-%m-%dT%H:%M:%S)
if $tap_format; then printf \#\ ; fi
echo Ran tests at $(date +%Y-%m-%dT%H:%M:%S) with the following shells:
if $tap_format; then printf \#\ ; fi
cat "${shell_list}" | tr '\n' \
echo
fi
for number in n oks skips not_oks; do
eval "${number}=0"
done
@ -402,13 +418,13 @@ report_outcome() {
fi
if test -z "${the_shell}"; then
the_shell='File is not executable.'
the_shell='File is not executable'
fi
echo "${not}ok $n - ${path} (${the_shell}) ${skip}"
echo "${not}ok $n - ${path} (${the_shell}${onhost}) ${skip}"
if { test "${result}" = not_ok && "${print_not_ok_stdout}"; } ||
{ test "${result}" = ok && "${print_ok_stdout}"; }; then
echo '# ------------ Begin output ------------'
sed 's/^/# /' "$(stdout_file "${abspath}" "${the_shell}")"
sed 's/^/# /' "$(stdout_file "${abspath}" "${the_shell}" "${host}")"
echo '# ------------ End output ------------'
fi
echo "# Previous test took ${file_elapsed} seconds."
@ -431,7 +447,7 @@ report_outcome() {
else
printf "${success_mark} "
fi
echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))"
echo "${the_shell}${onhost} (${file_elapsed} $(plural second $file_elapsed))"
fi
;;
not_ok)
@ -442,23 +458,23 @@ report_outcome() {
else
printf "${fail_mark} "
fi
echo "${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))"
echo "${the_shell}${onhost} (${file_elapsed} $(plural second $file_elapsed))"
fi
;;
skip)
if "${print_ok}"; then
header
if test -z "${the_shell}"; then
echo ' (File is not executable.)'
echo " (File is not executable${onhost}.)"
else
echo " ${the_shell} ("${file_elapsed}" $(plural second $file_elapsed))"
echo " ${the_shell}${onhost} (${file_elapsed} $(plural second $file_elapsed))"
fi
fi
;;
esac
if { test "${result}" = not_ok && "${print_not_ok_stdout}"; } ||
{ test "${result}" = ok && "${print_ok_stdout}"; }; then
sed 's/^/ | /' "$(stdout_file "${abspath}" "${the_shell}")"
sed 's/^/ | /' "$(stdout_file "${abspath}" "${the_shell}" "${host}")"
fi
fi
@ -588,10 +604,13 @@ validate_strings() {
}
main() {
argv="$@"
cycle_shell=true
shell_list="${urchin_tmp}"/shell_list
test_arg_list="${urchin_tmp}"/test_list
> "${test_arg_list}"
remotes_list="${urchin_tmp}"/remotes
run_in_series=false
force=false
exit_on_not_ok=false
@ -697,15 +716,6 @@ main() {
fi
fi
if $print_margins; then
if $tap_format; then
printf '# '
fi
printf 'Cycling with the following shells: '
cat "${shell_list}" | tr '\n' \
echo
fi
if test -n "${urchin_timeout}"; then
# Choose the timeout command
if timeout -t 0 true 2> /dev/null; then
@ -741,9 +751,35 @@ main() {
urchin_exit 1
fi
report_outcome "${root}" "${tap_format}" "${urchin_tmp}"/log "${start}" \
"${finish}"
urchin_exit "${?}"
if test -n "${RUNNING_ON_REMOTE}"; then
echo "${urchin_tmp}"
elif test -f "${remotes_list}"; then
while read remote; do
remote_main $remote "${argv}"
done < "${remotes_list}"
else
report_outcome "${root}" "${tap_format}" "${urchin_tmp}"/log \
"${start}" "${finish}"
urchin_exit "${?}"
fi
}
remote_main() {
hostname="${1}"; shift
flags="${1}"; shift
urchin_dir=.urchin-cross-shell-test
rsync --archive -e "ssh ${flags}"
../urchin ../tests "${hostname}":"${urchin_dir}" ||
scp -r ${flags} ../urchin ../tests "${hostname}":"${urchin_dir}"
remote_tmp="$(ssh "${hostname}" ${flags} "cd ${urchin_dir} && ./urchin $@")"
remotedir="${hostname}":"${remote_tmp}"
localdir="${urchin_tmp}/remote/${host}"
rsync --archive -e "ssh ${flags}" "${remotedir}" "${localdir}" ||
scp -r ${flags} "${remotedir}"
}
test -n "${TESTING_URCHIN_INTERNALS}" || main "$@"