• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3# If the test times out, meson sends SIGTERM to this process.
4# Simply exec'ing "time" would result in no output from that in this case.
5# Instead, we need to run "time" in the background, catch the signals and
6# propagate them to the actual test process.
7
8/usr/bin/time -v "$@" &
9TIMEPID=$!
10TESTPID=$(ps --ppid $TIMEPID -o pid=)
11
12if test "x$TESTPID" != x; then
13    trap 'kill -TERM $TESTPID; wait $TIMEPID; exit $?' TERM
14fi
15
16wait $TIMEPID
17exit $?
18