Add verbosity to integration test timeout loops
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>pull/237/head
parent
ba99e7180e
commit
2ffb5476e2
|
@ -73,7 +73,6 @@ timeout_init() {
|
||||||
|
|
||||||
timeout_check() {
|
timeout_check() {
|
||||||
if [[ $(( TIMEOUT_COUNTER++ )) -gt $TIMEOUT_MAXCOUNT ]]; then
|
if [[ $(( TIMEOUT_COUNTER++ )) -gt $TIMEOUT_MAXCOUNT ]]; then
|
||||||
echo "Timeout"
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
sleep "$TIMEOUT_DELAY"
|
sleep "$TIMEOUT_DELAY"
|
||||||
|
@ -81,16 +80,28 @@ timeout_check() {
|
||||||
|
|
||||||
wait_until() {
|
wait_until() {
|
||||||
timeout_init 10
|
timeout_init 10
|
||||||
until "$@" &>/dev/null; do
|
local last
|
||||||
timeout_check
|
until last=$("$@" 2>&1); do
|
||||||
|
if ! timeout_check; then
|
||||||
|
echo "Timeout waiting for $*" >&2
|
||||||
|
printf "%s\n" "$last" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
printf "%s\n" "$last"
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_while() {
|
wait_while() {
|
||||||
timeout_init 10
|
timeout_init 10
|
||||||
while "$@" &>/dev/null; do
|
local last
|
||||||
timeout_check
|
while last=$("$@" 2>&1); do
|
||||||
|
if ! timeout_check; then
|
||||||
|
echo "Timeout waiting for $*" >&2
|
||||||
|
printf "%s\n" "$last" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
printf "%s\n" "$last"
|
||||||
}
|
}
|
||||||
|
|
||||||
SWAY_ENV=$XDG_RUNTIME_DIR/sway.env
|
SWAY_ENV=$XDG_RUNTIME_DIR/sway.env
|
||||||
|
@ -102,7 +113,7 @@ start_sway() {
|
||||||
WLR_LIBINPUT_NO_DEVICES=1 \
|
WLR_LIBINPUT_NO_DEVICES=1 \
|
||||||
$SWAY &>"$SWAY_LOG" &
|
$SWAY &>"$SWAY_LOG" &
|
||||||
SWAY_PID=$!
|
SWAY_PID=$!
|
||||||
wait_until [ -f "$SWAY_ENV" ]
|
wait_until [ -f "$SWAY_ENV" ] >/dev/null
|
||||||
WAYLAND_DISPLAY=$(grep ^WAYLAND_DISPLAY= "$SWAY_ENV" | cut -d= -f2-)
|
WAYLAND_DISPLAY=$(grep ^WAYLAND_DISPLAY= "$SWAY_ENV" | cut -d= -f2-)
|
||||||
SWAYSOCK=$(grep ^SWAYSOCK= "$SWAY_ENV" | cut -d= -f2-)
|
SWAYSOCK=$(grep ^SWAYSOCK= "$SWAY_ENV" | cut -d= -f2-)
|
||||||
export WAYLAND_DISPLAY SWAYSOCK
|
export WAYLAND_DISPLAY SWAYSOCK
|
||||||
|
@ -127,10 +138,10 @@ start_wayvnc() {
|
||||||
# Wait for the VNC listening port
|
# Wait for the VNC listening port
|
||||||
echo " Started $WAYVNC_PID"
|
echo " Started $WAYVNC_PID"
|
||||||
wait_until lsof -a -p$WAYVNC_PID -iTCP@$WAYVNC_ADDRESS:$WAYVNC_PORT \
|
wait_until lsof -a -p$WAYVNC_PID -iTCP@$WAYVNC_ADDRESS:$WAYVNC_PORT \
|
||||||
-sTCP:LISTEN
|
-sTCP:LISTEN >/dev/null
|
||||||
echo " Listening on $WAYVNC_ADDRESS:$WAYVNC_PORT"
|
echo " Listening on $WAYVNC_ADDRESS:$WAYVNC_PORT"
|
||||||
# Wait for the control socket
|
# Wait for the control socket
|
||||||
wait_until [ -S "$XDG_RUNTIME_DIR/wayvncctl" ]
|
wait_until [ -S "$XDG_RUNTIME_DIR/wayvncctl" ] >/dev/null
|
||||||
echo " Control socket ready"
|
echo " Control socket ready"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +202,7 @@ test_exit_ipc() {
|
||||||
# Ignore errors because killing the socket races vs receiving
|
# Ignore errors because killing the socket races vs receiving
|
||||||
# a return message: https://github.com/any1/wayvnc/issues/233
|
# a return message: https://github.com/any1/wayvnc/issues/233
|
||||||
$WAYVNCCTL wayvnc-exit &>/dev/null || true
|
$WAYVNCCTL wayvnc-exit &>/dev/null || true
|
||||||
wait_while kill -0 $WAYVNC_PID
|
wait_while kill -0 $WAYVNC_PID >/dev/null
|
||||||
echo " wayvnc is shutdown"
|
echo " wayvnc is shutdown"
|
||||||
unset WAYVNC_PID
|
unset WAYVNC_PID
|
||||||
echo "ok"
|
echo "ok"
|
||||||
|
|
Loading…
Reference in New Issue