git: 0599d2a1c599 - stable/14 - limits tests: Try to fix spurious cputime test failures
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 08 Mar 2025 08:13:54 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=0599d2a1c5996cef4d79a3fbe753d863cdd2359b
commit 0599d2a1c5996cef4d79a3fbe753d863cdd2359b
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-02-14 16:26:19 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-03-07 22:51:48 +0000
limits tests: Try to fix spurious cputime test failures
I very occasionally see test failures caused by the total CPU time being
several milliseconds under 3s. The test runs "limits -t 3 time <busy
loop>" and verifies that the reported time elapsed is at least 3s (and
not too much more). In particular, any time spent executing time(1)
itself is counted against the limit but not recorded in the output.
I think it makes more sense to reverse the order, so that the CPU time
limit is not applied to time(1) itself. This also resolves the test
failures I was seeing, which were reproducible only under load (i.e.,
running many tests in parallel).
MFC after: 2 weeks
Sponsored by: Klara, Inc.
(cherry picked from commit 0f63c4af5e4761680550b0aa08cc96f52076c08c)
---
usr.bin/limits/tests/limits_test.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr.bin/limits/tests/limits_test.sh b/usr.bin/limits/tests/limits_test.sh
index 701886066ff1..fd7b50b0945a 100755
--- a/usr.bin/limits/tests/limits_test.sh
+++ b/usr.bin/limits/tests/limits_test.sh
@@ -57,7 +57,7 @@ cputime_hard_flag_body()
atf_check -o match:'cputime[[:space:]]+3 secs' \
limits -H -t 3 limits -S
atf_check -e save:time_output -s signal:sigkill \
- limits -H -t 3 $TIME -p sh -c 'while : ; do : ; done'
+ $TIME -p limits -H -t 3 sh -c 'while : ; do : ; done'
validate_time_output time_output
}
cputime_hard_flag_cleanup()
@@ -76,7 +76,7 @@ cputime_soft_flag_body()
atf_check -o match:'cputime-cur[[:space:]]+3 secs' \
limits -S -t 3 limits -S
atf_check -e save:time_output -s signal:$SIGXCPU \
- limits -S -t 3 $TIME -p sh -c 'while : ; do : ; done'
+ $TIME -p limits -S -t 3 sh -c 'while : ; do : ; done'
validate_time_output time_output
}
cputime_soft_flag_cleanup()