mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-03 07:04:02 +08:00
16fc6b87bb
Keep the strace logs in job artifacts for tests which timed out. This can be useful for figuring out why a timeout occurred. strace cannot be used in jobs where ASAN is enabled, because ASAN's leak checker also uses ptrace(), which isn't possible within strace. Suggested-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9472>
18 lines
459 B
Bash
Executable File
18 lines
459 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# If the test times out, meson sends SIGTERM 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 -TERM $TESTPID; wait $TIMEPID; exit $?' TERM
|
|
fi
|
|
|
|
wait $TIMEPID
|
|
exit $?
|