5 TIME
="${TIME-/usr/bin/time}"
12 echo TEST
: check real
time
14 TIME_SLEEP
=`$TIME 2>&1 sleep 1 | sed -n -E 's/[ ]+([0-9]+).*/\1/p'`
17 if [ "$TIME_STATUS" -ne "0" ]; then
18 echo FAIL
: time failed with
"$TIME_STATUS"
22 if [ "$TIME_SLEEP" -lt "0" ]; then
23 echo FAIL
: time mis
-timed sleep
27 MONOTONIC
=`sysctl -n kern.monotonic.task_thread_counting`
28 if [ "$MONOTONIC" -ne "0" ]; then
29 echo TEST
: check instructions retired
31 TIME_INSTRS
=`$TIME -l 2>&1 sleep 1 | sed -E -n '/instructions/p'`
32 if [ -z "$TIME_INSTRS" ]; then
33 echo FAIL
: time is not showing instructions retired
37 echo SKIP
: check instructions retired
40 # NB: SIGINT and SIGQUIT work locally, but the automated test harnesses tries to
41 # handle those signals itself before the fork.
43 echo TEST
: check child SIGUSR1
45 TIME_USR1
=`$TIME 2>&1 sh -c 'kill -USR1 $$ && sleep 5 && true'`
47 if [ "$TIME_STATUS" -eq "0" ]; then
48 echo FAIL
: time should allow child to receive SIGUSR1
52 echo TEST
: check non
-existent binary
53 TIME_NONEXIST
=`$TIME 2>&1 ./this-wont-exist`
55 if [ "$TIME_STATUS" -ne "127" ]; then
56 echo FAIL
: time should error when measuring a non
-existent command