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