Do not time a program that only waits for the timeout

This commit is contained in:
Joseph Ferano 2026-09-13 23:02:04 +07:00
parent 54da06d111
commit 6c15eef5e5

View File

@ -78,6 +78,10 @@ text () { size -A "$1" 2>/dev/null | awk '$1==".text" {print $2}'; }
# Best of REPS, in whole microseconds. A program that fails on one run and
# not another would make this meaningless, so the exit status of the first
# run is remembered and a run that disagrees with it poisons the row as -1.
# A program that hits the timeout is not timed at all: several of the corpus
# programs are agents or daemons that sit waiting for something that is not
# there, and five repetitions of a twenty-second wait, twice, is most of an
# afternoon spent measuring `timeout`.
best () {
exe=$1; min=; rc0=
for i in $(seq "$REPS"); do
@ -88,6 +92,7 @@ best () {
[ -n "$rc0" ] || rc0=$rc
[ "$rc" = "$rc0" ] || { echo "-1"; return; }
d=$(( (t1 - t0) / 1000 ))
[ "$d" -lt 15000000 ] || { echo "-1"; return; }
if [ -z "$min" ] || [ "$d" -lt "$min" ]; then min=$d; fi
done
echo "$min"