]> granicus.if.org Git - strace/commitdiff
tests: robustify threads-execve test against the odds
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 18 Feb 2019 00:29:43 +0000 (00:29 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 18 Feb 2019 00:29:43 +0000 (00:29 +0000)
Give threads-execve.test more chances to succeed.

* tests/threads-execve.test: Retry the test until run out of time.

tests/threads-execve.test

index 30612a3c212f475f1441705926f401ebb8fca1b6..2c8c3632a3fd79948471dda68b0ba323352f481c 100755 (executable)
 require_min_kernel_version_or_skip 3.1
 
 check_prog diff
+run_prog_skip_if_failed date +%s > /dev/null
+s0="$(date +%s)"
+
 run_prog > /dev/null
 
 set -- -a21 -f -esignal=none -e trace=execve,exit,nanosleep,rt_sigsuspend $args
 
 # Due to probabilistic nature of the test, try it several times.
-i=0
-while [ $i -le 19 ]; do
-       i="$(($i+1))"
+while :; do
        run_strace "$@" > "$EXP"
        sed 1d < "$LOG" > "$OUT"
-       diff -- "$EXP" "$OUT" || continue
-       exit 0
+       diff -- "$EXP" "$OUT" && exit 0
+       s1="$(date +%s)"
+       if [ "$(($s1-$s0))" -gt "$(($TIMEOUT_DURATION/2))" ]; then
+               fail_ "$STRACE $* output mismatch"
+       fi
 done
-
-fail_ "$STRACE $* output mismatch"