~mmach/netext73/mesa-haswell

« back to all changes in this revision

Viewing changes to .gitlab-ci/meson/time-strace.sh

  • Committer: mmach
  • Date: 2022-09-22 19:56:13 UTC
  • Revision ID: netbit73@gmail.com-20220922195613-wtik9mmy20tmor0i
2022-09-22 21:17:09

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
STRACEDIR=meson-logs/strace/$(for i in $@; do basename -z -- $i; echo -n _; done)
4
 
 
5
 
mkdir -p $STRACEDIR
6
 
 
7
 
# If the test times out, meson sends SIGTERM to this process.
8
 
# Simply exec'ing "time" would result in no output from that in this case.
9
 
# Instead, we need to run "time" in the background, catch the signals and
10
 
# propagate them to the actual test process.
11
 
 
12
 
/usr/bin/time -v strace -ff -tt -T -o $STRACEDIR/log "$@" &
13
 
TIMEPID=$!
14
 
STRACEPID=$(ps --ppid $TIMEPID -o pid=)
15
 
TESTPID=$(ps --ppid $STRACEPID -o pid=)
16
 
 
17
 
if test "x$TESTPID" != x; then
18
 
    trap 'kill -TERM $TESTPID; wait $TIMEPID; exit $?' TERM
19
 
fi
20
 
 
21
 
wait $TIMEPID
22
 
EXITCODE=$?
23
 
 
24
 
# Only keep strace logs if the test timed out
25
 
rm -rf $STRACEDIR &
26
 
 
27
 
exit $EXITCODE