summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-01-10 21:44:32 +0100
committerLudovic Courtès <ludo@gnu.org>2012-01-12 00:38:56 +0100
commitea3cef045a413aa1001cf13e1ea2bc150626c3ce (patch)
treeac5953cfbb1c152def7da3b5fdc35ddd3ed78f3e
parentf41ef416803b57473761b1963b0709312f36ddad (diff)
downloadguile-ea3cef045a413aa1001cf13e1ea2bc150626c3ce.tar.gz
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.
-rw-r--r--test-suite/tests/statprof.test18
1 files changed, 16 insertions, 2 deletions
diff --git a/test-suite/tests/statprof.test b/test-suite/tests/statprof.test
index b2ee41e1b..c711d5f36 100644
--- a/test-suite/tests/statprof.test
+++ b/test-suite/tests/statprof.test
@@ -31,8 +31,22 @@
#:use-module (srfi srfi-1)
#: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"
- (let ()
+ (when-implemented
;; 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
;; I tried to do something more statistically valid, but failed (for
@@ -80,7 +94,7 @@
(throw 'unresolved (pk average drift-fraction))))))))
(pass-if "accurate call counting"
- (let ()
+ (when-implemented
;; Test to see that if we call a function N times while the profiler
;; is active, it shows up N times.
(let ((num-calls 200))