mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
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.
This commit is contained in:
parent
36631977d8
commit
0f63c4af5e
1 changed files with 2 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue