From ea3cef045a413aa1001cf13e1ea2bc150626c3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 10 Jan 2012 21:44:32 +0100 Subject: [PATCH] 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. --- test-suite/tests/statprof.test | 18 ++++++++++++++++-- 1 file 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))