ci: Run 'time' in the background and propagate signals to test process
Simply exec'ing time didn't produce any output from it when a test
timed out.
Fixes: 35f59e14f8
"ci: Use GNU time as meson test wrapper"
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8830>
This commit is contained in:
parent
09e421846d
commit
14bafbba9b
|
@ -277,7 +277,7 @@ x86_build:
|
|||
extends:
|
||||
- .use-x86_build-base
|
||||
variables:
|
||||
MESA_IMAGE_TAG: &x86_build "2021-01-29-time"
|
||||
MESA_IMAGE_TAG: &x86_build "2021-02-02-procps"
|
||||
|
||||
.use-x86_build:
|
||||
variables:
|
||||
|
|
|
@ -32,6 +32,7 @@ apt-get install -y --no-remove \
|
|||
liblua5.3-dev \
|
||||
libxml2-dev \
|
||||
ocl-icd-opencl-dev \
|
||||
procps \
|
||||
time \
|
||||
wine-development \
|
||||
wine32-development
|
||||
|
|
|
@ -1,8 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Only use GNU time if available, not any shell built-in command
|
||||
if test -f /usr/bin/time; then
|
||||
exec /usr/bin/time -v "$@"
|
||||
if ! test -f /usr/bin/time; then
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
|
||||
# If the test times out, meson sends SIGINT & SIGTERM signals to this process.
|
||||
# Simply exec'ing "time" would result in no output from that in this case.
|
||||
# Instead, we need to run "time" in the background, catch the signals and
|
||||
# propagate them to the actual test process.
|
||||
|
||||
/usr/bin/time -v "$@" &
|
||||
TIMEPID=$!
|
||||
TESTPID=$(ps --ppid $TIMEPID -o pid=)
|
||||
|
||||
if test "x$TESTPID" != x; then
|
||||
trap 'kill -INT $TESTPID; wait $TIMEPID; exit $?' INT
|
||||
trap 'kill -TERM $TESTPID; wait $TIMEPID; exit $?' TERM
|
||||
fi
|
||||
|
||||
wait $TIMEPID
|
||||
exit $?
|
||||
|
|
Loading…
Reference in New Issue