Skip to content

Commit b22ce8f

Browse files
committed
Tests: Report xpost per-file runtime with sub-second precision
1 parent 4a97424 commit b22ce8f

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • tests/xpost_tests

tests/xpost_tests/run

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,18 @@ run_one() {
6767
quit
6868
EOF
6969

70-
local out
71-
SECONDS=0
70+
local out t0 secs
71+
t0=$EPOCHREALTIME
7272
if out=$(timeout "$TIMEOUT" "$XPOST" -q -d null "$driver" </dev/null 2>/dev/null) &&
7373
echo "$out" | grep -qF 'FILE-PASSED' &&
7474
! echo "$out" | grep -qE 'testError|stackImbalance|dict leak|global VM leak'; then
75-
printf 'PASS %s (%ds)\n' "$name" "$SECONDS"
75+
secs=$(awk -v a="$t0" -v b="$EPOCHREALTIME" 'BEGIN{printf "%.2f", b-a}')
76+
printf 'PASS %s (%ss)\n' "$name" "$secs"
7677
return 0
7778
fi
7879

79-
printf 'FAIL %s (%ds)\n%s\n' "$name" "$SECONDS" "$(echo "$out" | tail -40)"
80+
secs=$(awk -v a="$t0" -v b="$EPOCHREALTIME" 'BEGIN{printf "%.2f", b-a}')
81+
printf 'FAIL %s (%ss)\n%s\n' "$name" "$secs" "$(echo "$out" | tail -40)"
8082
return 1
8183
}
8284

0 commit comments

Comments
 (0)