17ec681f3Smrg#!/bin/sh 27ec681f3Smrg 37ec681f3Smrg# If the test times out, meson sends SIGTERM to this process. 47ec681f3Smrg# Simply exec'ing "time" would result in no output from that in this case. 57ec681f3Smrg# Instead, we need to run "time" in the background, catch the signals and 67ec681f3Smrg# propagate them to the actual test process. 77ec681f3Smrg 87ec681f3Smrg/usr/bin/time -v "$@" & 97ec681f3SmrgTIMEPID=$! 107ec681f3SmrgTESTPID=$(ps --ppid $TIMEPID -o pid=) 117ec681f3Smrg 127ec681f3Smrgif test "x$TESTPID" != x; then 137ec681f3Smrg trap 'kill -TERM $TESTPID; wait $TIMEPID; exit $?' TERM 147ec681f3Smrgfi 157ec681f3Smrg 167ec681f3Smrgwait $TIMEPID 177ec681f3Smrgexit $? 18