read -r and stuff
This commit is contained in:
parent
25f74b68cf
commit
9932d0bf6f
64
urchin
64
urchin
@ -351,7 +351,7 @@ format_tap() {
|
|||||||
echo '# ------------ End output ------------'
|
echo '# ------------ End output ------------'
|
||||||
}
|
}
|
||||||
|
|
||||||
while IFS="${HT}" read remote the_shell path result file_elapsed; do
|
while IFS="${HT}" read -r remote the_shell path result file_elapsed; do
|
||||||
# Number of files that have run, including this one
|
# Number of files that have run, including this one
|
||||||
n=$(( ${n:-0} + 1))
|
n=$(( ${n:-0} + 1))
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ format_urchin() {
|
|||||||
sed 's/^/ | /' "$(stdout_file "${tmp_dir}" "${path}" "${the_shell}")"
|
sed 's/^/ | /' "$(stdout_file "${tmp_dir}" "${path}" "${the_shell}")"
|
||||||
}
|
}
|
||||||
|
|
||||||
while IFS="${HT}" read remote the_shell path result file_elapsed; do
|
while IFS="${HT}" read -r remote the_shell path result file_elapsed; do
|
||||||
abspath=${tmp_dir}/${path}
|
abspath=${tmp_dir}/${path}
|
||||||
|
|
||||||
currentdir="$(dirname -- "${path}")"
|
currentdir="$(dirname -- "${path}")"
|
||||||
@ -458,38 +458,28 @@ format_urchin() {
|
|||||||
# 1) At least one test failed.
|
# 1) At least one test failed.
|
||||||
# *) Something else went wrong; Urchin should exit with the same code.
|
# *) Something else went wrong; Urchin should exit with the same code.
|
||||||
recurse() {
|
recurse() {
|
||||||
test_suite_root="${1}"
|
abs_root="${1}"
|
||||||
requested_path="${2}"
|
abs_requested="${2}"
|
||||||
|
abs_current="${3}"
|
||||||
|
|
||||||
abs="$(fullpath "${3}")"
|
rel_requested="$(localpath ${abs_root} ${abs_requested})"
|
||||||
rel="${abs##"${test_suite_root}/"}"
|
rel_current="$(localpath ${abs_root} ${abs_current})"
|
||||||
|
|
||||||
for ignore in setup_dir teardown_dir setup teardown; do
|
for ignore in setup_dir teardown_dir setup teardown; do
|
||||||
if test "$(basename "${potential_test}")" = "${ignore}"; then
|
if test "$(basename "${abs_current}")" = "${ignore}"; then
|
||||||
return
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Return if we should not run this file
|
if contains "${rel_current}" "${HT}"; then
|
||||||
if contains "${potential_test}" "^${requested_path}" ||
|
echo "${shell_list}" | while read -r sh; do
|
||||||
contains "${requested_path}" "^${potential_test}" ; then
|
no_tab="$(echo "${rel_current}" | tr '\t' ' ')"
|
||||||
if test "$(dirname "${potential_test}")" = \
|
log "${remote}" "${sh}" "${no_tab}" tab '' >> "${urchin_tmp}"/log
|
||||||
"$(dirname "${requested_path}")" &&
|
|
||||||
test "${potential_test}" != "${requested_path}"; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if contains "${potential_test}" "${HT}"; then
|
|
||||||
echo "${shell_list}" | while read sh; do
|
|
||||||
log "${remote}" "${sh}" "${rel}" tab '' >> "${urchin_tmp}"/log
|
|
||||||
done
|
done
|
||||||
elif [ -x "${potential_test}" ]; then
|
elif [ -x "${rel_current}" ]; then
|
||||||
if [ -d "${potential_test}" ]; then
|
if [ -d "${rel_current}" ]; then
|
||||||
(
|
(
|
||||||
cd -- "${potential_test}"
|
cd -- "${rel_current}"
|
||||||
if test -f .urchin_dir && grep series .urchin_dir > /dev/null; then
|
if test -f .urchin_dir && grep series .urchin_dir > /dev/null; then
|
||||||
run_in_series_dir=true
|
run_in_series_dir=true
|
||||||
else
|
else
|
||||||
@ -525,21 +515,21 @@ recurse() {
|
|||||||
. ./teardown_dir
|
. ./teardown_dir
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
elif [ -f "${potential_test}" ]; then
|
elif [ -f "${rel_current}" ]; then
|
||||||
cd -- "$(dirname -- "${potential_test}")"
|
cd -- "$(dirname -- "${rel_current}")"
|
||||||
echo "${shell_list}" | while read the_test_shell; do
|
echo "${shell_list}" | while read -r the_test_shell; do
|
||||||
(
|
(
|
||||||
if test -f setup; then
|
if test -f setup; then
|
||||||
. ./setup
|
. ./setup
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run with a shell?
|
# Run with a shell?
|
||||||
if has_shebang_line "${potential_test}"; then
|
if has_shebang_line "${rel_current}"; then
|
||||||
set -- "${potential_test}"
|
set -- "${rel_current}"
|
||||||
else
|
else
|
||||||
set -- "${the_test_shell}" "${potential_test}"
|
set -- "${the_test_shell}" "${rel_current}"
|
||||||
fi
|
fi
|
||||||
out_file="$(stdout_file "${tmp_dir}" "${potential_test}" "${the_test_shell}")"
|
out_file="$(stdout_file "${tmp_dir}" "${rel_current}" "${the_test_shell}")"
|
||||||
|
|
||||||
# Run the test
|
# Run the test
|
||||||
start=$("${epoch}")
|
start=$("${epoch}")
|
||||||
@ -560,7 +550,7 @@ recurse() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
elapsed=$(($finish - $start))
|
elapsed=$(($finish - $start))
|
||||||
rel="${potential_test##"${root}/"}"
|
rel="${rel_current##"${root}/"}"
|
||||||
printf "\t${the_test_shell}\t${rel}\t${result}\t${elapsed}\n" \
|
printf "\t${the_test_shell}\t${rel}\t${result}\t${elapsed}\n" \
|
||||||
>> "${urchin_tmp}"/log
|
>> "${urchin_tmp}"/log
|
||||||
exit "${exit_code}"
|
exit "${exit_code}"
|
||||||
@ -580,8 +570,8 @@ recurse() {
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Skip because the file is not executable.
|
# Skip because the file is not executable.
|
||||||
echo "${shell_list}" | while read sh; do
|
echo "${shell_list}" | while read -r sh; do
|
||||||
printf "\t${sh}\t${potential_test}\tskip\t0\n" >> "${urchin_tmp}"/log
|
printf "\t${sh}\t${rel_current}\tskip\t0\n" >> "${urchin_tmp}"/log
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -731,7 +721,7 @@ wantto run urchin on that directory.' >&2
|
|||||||
echo >> "${urchin_tmp}"/head
|
echo >> "${urchin_tmp}"/head
|
||||||
|
|
||||||
start=$("${epoch}")
|
start=$("${epoch}")
|
||||||
echo "${test_seeds}" | while read seed; do
|
echo "${test_seeds}" | while read -r seed; do
|
||||||
set +e
|
set +e
|
||||||
recurse "${root}" "$(fullpath "${seed}")" "${TEST_SHELL}"
|
recurse "${root}" "$(fullpath "${seed}")" "${TEST_SHELL}"
|
||||||
return_code=$?
|
return_code=$?
|
||||||
|
Loading…
Reference in New Issue
Block a user