mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-30 06:50:31 +02:00
Sloppier matching in setitimer tests
* test-suite/tests/signals.test: Update setitimer tests to sloppily match both times -- it seems that the interval can also be sloppy on some platforms, sadly.
This commit is contained in:
parent
56f79491c4
commit
ecc7987427
1 changed files with 14 additions and 5 deletions
|
@ -29,6 +29,11 @@
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(define (time-pair->secs secs-usecs-pair)
|
||||||
|
(match secs-usecs-pair
|
||||||
|
((secs . usecs)
|
||||||
|
(+ secs (/ usecs 1e6)))))
|
||||||
|
|
||||||
(when (defined? 'setitimer)
|
(when (defined? 'setitimer)
|
||||||
(with-test-prefix "setitimer"
|
(with-test-prefix "setitimer"
|
||||||
(with-test-prefix "current itimers are 0"
|
(with-test-prefix "current itimers are 0"
|
||||||
|
@ -48,12 +53,13 @@
|
||||||
'((0 . 0) (0 . 0))))
|
'((0 . 0) (0 . 0))))
|
||||||
(pass-if "reset to zero"
|
(pass-if "reset to zero"
|
||||||
(match (setitimer ITIMER_PROF 0 0 0 0)
|
(match (setitimer ITIMER_PROF 0 0 0 0)
|
||||||
(((1 . 0) (val-secs . val-usecs))
|
((interval value)
|
||||||
;; We don't presume that the timer is strictly lower than the
|
;; We don't presume that the timer is strictly lower than the
|
||||||
;; value at which we set it, given its limited internal
|
;; value at which we set it, given its limited internal
|
||||||
;; precision. Assert instead that the timer is between 2 and
|
;; precision. Assert instead that the timer is between 2 and
|
||||||
;; 3.5 seconds.
|
;; 3.5 seconds.
|
||||||
(<= #e2e6 (+ (* val-secs #e1e6) val-usecs) #e3.5e6)))))
|
(and (<= 0.9 (time-pair->secs interval) 1.1)
|
||||||
|
(<= 2.0 (time-pair->secs value) 3.5))))))
|
||||||
|
|
||||||
(with-test-prefix "usecs > 1e6"
|
(with-test-prefix "usecs > 1e6"
|
||||||
(pass-if "initial setting"
|
(pass-if "initial setting"
|
||||||
|
@ -61,10 +67,13 @@
|
||||||
'((0 . 0) (0 . 0))))
|
'((0 . 0) (0 . 0))))
|
||||||
(pass-if "reset to zero"
|
(pass-if "reset to zero"
|
||||||
(match (setitimer ITIMER_PROF 0 0 0 0)
|
(match (setitimer ITIMER_PROF 0 0 0 0)
|
||||||
(((1 . 0) (val-secs . val-usecs))
|
((interval value)
|
||||||
;; We don't presume that the timer is strictly lower than the
|
;; We don't presume that the timer is strictly lower than the
|
||||||
;; value at which we set it, given its limited internal
|
;; value at which we set it, given its limited internal
|
||||||
;; precision. Assert instead that the timer is between 2 and
|
;; precision. Assert instead that the timer is between 2 and
|
||||||
;; 3.5 seconds.
|
;; 3.5 seconds.
|
||||||
(and (<= #e2e6 (+ (* val-secs #e1e6) val-usecs) #e3.5e6)
|
(and (<= 0.9 (time-pair->secs interval) 1.1)
|
||||||
(<= 0 val-usecs 999999))))))))
|
(<= 2.0 (time-pair->secs value) 3.5)
|
||||||
|
(match value
|
||||||
|
((secs . usecs)
|
||||||
|
(<= 0 usecs 999999))))))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue