test: Kill weston whenever shell exits
This script runs with -e, so if the timeout command returns a non-0 exit status (meaning the while loop timed out), the script exits immediately as well. This would leave weston running in the background, which resulted in meson waiting for weston to terminate until hitting meson's own timeout. Instead, explicitly kill weston whenever the shell exits. This results in meson recording the test as failed immediately. As a bonus, we can drop the special handling around run-piglit.sh. v2: * Use trap (José Expósito) v3: * Explicitly use bash, and document a bashism we rely on (Olivier Fourdan)
This commit is contained in:
parent
3e938ed042
commit
e58203c1e2
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
# this times out on Travis, because the tests take too long.
|
# this times out on Travis, because the tests take too long.
|
||||||
if test "x$TRAVIS_BUILD_DIR" != "x"; then
|
if test "x$TRAVIS_BUILD_DIR" != "x"; then
|
||||||
|
@ -17,6 +17,11 @@ weston --no-config --backend=headless-backend.so --socket=wayland-$$ &
|
||||||
WESTON_PID=$!
|
WESTON_PID=$!
|
||||||
export WAYLAND_DISPLAY=wayland-$$
|
export WAYLAND_DISPLAY=wayland-$$
|
||||||
|
|
||||||
|
# Need to kill weston before exiting, or meson will time out waiting for it to terminate
|
||||||
|
# We rely on bash's behaviour, which executes the EXIT trap handler even if the shell is
|
||||||
|
# terminated due to receiving a signal
|
||||||
|
trap 'kill $WESTON_PID' EXIT
|
||||||
|
|
||||||
# Wait for weston to initialize before starting Xwayland
|
# Wait for weston to initialize before starting Xwayland
|
||||||
timeout --preserve-status 5s bash -c "while ! $XSERVER_BUILDDIR/hw/xwayland/Xwayland -pogo -displayfd 1 &>/dev/null; do sleep 1; done"
|
timeout --preserve-status 5s bash -c "while ! $XSERVER_BUILDDIR/hw/xwayland/Xwayland -pogo -displayfd 1 &>/dev/null; do sleep 1; done"
|
||||||
|
|
||||||
|
@ -38,10 +43,4 @@ PIGLIT_ARGS="$PIGLIT_ARGS -x xsetfontpath@2"
|
||||||
|
|
||||||
export PIGLIT_ARGS
|
export PIGLIT_ARGS
|
||||||
|
|
||||||
# Do not let run-piglit.sh exit status terminate this script prematurely
|
|
||||||
set +e
|
|
||||||
$XSERVER_DIR/test/scripts/run-piglit.sh
|
$XSERVER_DIR/test/scripts/run-piglit.sh
|
||||||
PIGLIT_STATUS=$?
|
|
||||||
|
|
||||||
kill $WESTON_PID
|
|
||||||
exit $PIGLIT_STATUS
|
|
||||||
|
|
Loading…
Reference in New Issue