mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-31 01:10:24 +02:00
Disable statprof tests on platforms that lack `ITIMER_PROF' support.
* test-suite/tests/statprof.test (when-implemented): New macro. ("statistical sample counts within expected range", "accurate call counting"): Use it.
This commit is contained in:
parent
f41ef41680
commit
ea3cef045a
1 changed files with 16 additions and 2 deletions
|
@ -31,8 +31,22 @@
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (statprof))
|
#:use-module (statprof))
|
||||||
|
|
||||||
|
;; Throw `unresolved' upon ENOSYS. This is used to skip tests on
|
||||||
|
;; platforms such as GNU/Hurd where `ITIMER_PROF' is is currently
|
||||||
|
;; unimplemented.
|
||||||
|
(define-syntax-rule (when-implemented body ...)
|
||||||
|
(catch 'system-error
|
||||||
|
(lambda ()
|
||||||
|
body ...)
|
||||||
|
(lambda args
|
||||||
|
(let ((errno (system-error-errno args)))
|
||||||
|
(false-if-exception (statprof-stop))
|
||||||
|
(if (= errno ENOSYS)
|
||||||
|
(throw 'unresolved)
|
||||||
|
(apply throw args))))))
|
||||||
|
|
||||||
(pass-if "statistical sample counts within expected range"
|
(pass-if "statistical sample counts within expected range"
|
||||||
(let ()
|
(when-implemented
|
||||||
;; test to see that if we call 3 identical functions equally, they
|
;; test to see that if we call 3 identical functions equally, they
|
||||||
;; show up equally in the call count, +/- 30%. it's a big range, and
|
;; show up equally in the call count, +/- 30%. it's a big range, and
|
||||||
;; I tried to do something more statistically valid, but failed (for
|
;; I tried to do something more statistically valid, but failed (for
|
||||||
|
@ -80,7 +94,7 @@
|
||||||
(throw 'unresolved (pk average drift-fraction))))))))
|
(throw 'unresolved (pk average drift-fraction))))))))
|
||||||
|
|
||||||
(pass-if "accurate call counting"
|
(pass-if "accurate call counting"
|
||||||
(let ()
|
(when-implemented
|
||||||
;; Test to see that if we call a function N times while the profiler
|
;; Test to see that if we call a function N times while the profiler
|
||||||
;; is active, it shows up N times.
|
;; is active, it shows up N times.
|
||||||
(let ((num-calls 200))
|
(let ((num-calls 200))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue