FYI, this test would mistakenly pass when doing a massively parallel "make check" and when running on an otherwise heavily loaded system. Iterating 50 times instead of 12 makes the buggy sort more likely to hit the CPU limit, yet does not affect the test duration.
>From 231d8719f1b6d8324882cde0eb136c045b7c8338 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 4 Dec 2010 11:52:21 +0100 Subject: [PATCH] tests: make it harder to lose a race in spinlock-abuse * tests/misc/sort-spinlock-abuse: On a busy system, with only 12 pauses of length 0.1 seconds, the buggy (busy-spinlock blocked) sort would fail to accumulate 1 second of CPU time, and hence would mistakenly pass. Increase from 12 to 50. --- tests/misc/sort-spinlock-abuse | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/misc/sort-spinlock-abuse b/tests/misc/sort-spinlock-abuse index 974e3d5..bbf5753 100755 --- a/tests/misc/sort-spinlock-abuse +++ b/tests/misc/sort-spinlock-abuse @@ -25,9 +25,9 @@ test "$(nproc)" = 1 && skip_ "requires a multi-core system" seq 100000 > in || framework_failure_ mkfifo fifo || framework_failure_ -# Arrange for sort to require 1.2+ seconds of wall-clock time, +# Arrange for sort to require 5.0+ seconds of wall-clock time, # while actually using far less than 1 second of CPU time. -(for i in $(seq 12); do read line; echo $i; sleep .1; done +(for i in $(seq 50); do read line; echo $i; sleep .1; done cat > /dev/null) < fifo & # Limit CPU time to 1 second -- 1.7.3.2.92.g7e4eb