Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Feb 2025 16:35:18 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 0f63c4af5e47 - main - limits tests: Try to fix spurious cputime test failures
Message-ID:  <202502141635.51EGZIOZ021045@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=0f63c4af5e4761680550b0aa08cc96f52076c08c

commit 0f63c4af5e4761680550b0aa08cc96f52076c08c
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-02-14 16:26:19 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-02-14 16:26:19 +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.
---
 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()



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502141635.51EGZIOZ021045>