Limit maximum amount of attempts to set register a
This commit is contained in:
parent
6343ff0d8f
commit
be3fd917a9
|
@ -92,6 +92,22 @@ run() {
|
||||||
NL="$(printf '\nE')"
|
NL="$(printf '\nE')"
|
||||||
NL="${NL%E}"
|
NL="${NL%E}"
|
||||||
|
|
||||||
|
print_full_output() {
|
||||||
|
TEST_TYPE="$1"
|
||||||
|
TEST_CLIENT="$2"
|
||||||
|
SH="$3"
|
||||||
|
echo "Full output:"
|
||||||
|
echo '============================================================'
|
||||||
|
cat tests/shell/${SH}.${TEST_TYPE}.${TEST_CLIENT}.full.log
|
||||||
|
echo '____________________________________________________________'
|
||||||
|
if test "x$POWERLINE_TEST_NO_CAT_V" != "x1" ; then
|
||||||
|
echo "Full output (cat -v):"
|
||||||
|
echo '============================================================'
|
||||||
|
cat -v tests/shell/${SH}.${TEST_TYPE}.${TEST_CLIENT}.full.log
|
||||||
|
echo '____________________________________________________________'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
do_run_test() {
|
do_run_test() {
|
||||||
TEST_TYPE="$1"
|
TEST_TYPE="$1"
|
||||||
shift
|
shift
|
||||||
|
@ -106,8 +122,16 @@ do_run_test() {
|
||||||
screen -L -c tests/test_shells/screenrc -d -m -S "$SESNAME" \
|
screen -L -c tests/test_shells/screenrc -d -m -S "$SESNAME" \
|
||||||
env LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" \
|
env LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" \
|
||||||
"$@"
|
"$@"
|
||||||
|
local attempts=100
|
||||||
while ! screen -S "$SESNAME" -X readreg a tests/test_shells/input.$SH ; do
|
while ! screen -S "$SESNAME" -X readreg a tests/test_shells/input.$SH ; do
|
||||||
sleep 0.1s
|
sleep 0.1s
|
||||||
|
attempts=$(( attempts - 1 ))
|
||||||
|
if test $attempts -eq 0 ; then
|
||||||
|
echo "Waiting for too long: assuming test failed"
|
||||||
|
echo "Failed ${SH}: failed to put input.$SH contents to the screen register."
|
||||||
|
print_full_output ${TEST_TYPE} ${TEST_CLIENT} ${SH}
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
# Wait for screen to initialize
|
# Wait for screen to initialize
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -117,16 +141,8 @@ do_run_test() {
|
||||||
attempts=$(( attempts - 1 ))
|
attempts=$(( attempts - 1 ))
|
||||||
if test $attempts -eq 0 ; then
|
if test $attempts -eq 0 ; then
|
||||||
echo "Waiting for too long: assuming test failed"
|
echo "Waiting for too long: assuming test failed"
|
||||||
echo "Failed ${SH}. Full output:"
|
echo -n "Failed ${SH}. "
|
||||||
echo '============================================================'
|
print_full_output ${TEST_TYPE} ${TEST_CLIENT} ${SH}
|
||||||
cat tests/shell/${SH}.${TEST_TYPE}.${TEST_CLIENT}.full.log
|
|
||||||
echo '____________________________________________________________'
|
|
||||||
if test "x$POWERLINE_TEST_NO_CAT_V" != "x1" ; then
|
|
||||||
echo "Full output (cat -v):"
|
|
||||||
echo '============================================================'
|
|
||||||
cat -v tests/shell/${SH}.${TEST_TYPE}.${TEST_CLIENT}.full.log
|
|
||||||
echo '____________________________________________________________'
|
|
||||||
fi
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -179,16 +195,8 @@ do_run_test() {
|
||||||
check_screen_log ${TEST_TYPE} ${TEST_CLIENT} ${SH} | cat -v
|
check_screen_log ${TEST_TYPE} ${TEST_CLIENT} ${SH} | cat -v
|
||||||
echo '____________________________________________________________'
|
echo '____________________________________________________________'
|
||||||
fi
|
fi
|
||||||
echo "Failed ${SH}. Full output:"
|
echo -n "Failed ${SH}. "
|
||||||
echo '============================================================'
|
print_full_output ${TEST_TYPE} ${TEST_CLIENT} ${SH}
|
||||||
cat tests/shell/${SH}.${TEST_TYPE}.${TEST_CLIENT}.full.log
|
|
||||||
echo '____________________________________________________________'
|
|
||||||
if test "x$POWERLINE_TEST_NO_CAT_V" != "x1" ; then
|
|
||||||
echo "Full output (cat -v):"
|
|
||||||
echo '============================================================'
|
|
||||||
cat -v tests/shell/${SH}.${TEST_TYPE}.${TEST_CLIENT}.full.log
|
|
||||||
echo '____________________________________________________________'
|
|
||||||
fi
|
|
||||||
case ${SH} in
|
case ${SH} in
|
||||||
*ksh)
|
*ksh)
|
||||||
${SH} -c 'echo ${KSH_VERSION}'
|
${SH} -c 'echo ${KSH_VERSION}'
|
||||||
|
|
Loading…
Reference in New Issue