summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2009-12-11 23:27:47 +0100
committerLudovic Courtès <ludo@gnu.org>2009-12-11 23:27:47 +0100
commit9035e9d6db84d3e37dc2ba93dbeea7e0fc6b4bb7 (patch)
tree7c4783ab1d3ad8b525dd623b8796d985dfdb0acd
parent2cf7ff2e799cbbe80012545411a34653a6da2cf7 (diff)
downloadguile-9035e9d6db84d3e37dc2ba93dbeea7e0fc6b4bb7.tar.gz
Tweak the "unused modules are removed" test.
* test-suite/tests/gc.test ("gc")["unused modules are removed"]: Add loop to clean up stale references from the stack.
-rw-r--r--test-suite/tests/gc.test30
1 files changed, 17 insertions, 13 deletions
diff --git a/test-suite/tests/gc.test b/test-suite/tests/gc.test
index f5848fba1..9aa12be34 100644
--- a/test-suite/tests/gc.test
+++ b/test-suite/tests/gc.test
@@ -59,19 +59,23 @@
(with-test-prefix "gc"
(pass-if "Unused modules are removed"
- (let* ((guard (make-guardian))
- (total 1000))
+ (let* ((guard (make-guardian))
+ (total 1000))
- (for-each (lambda (x) (guard (make-module))) (iota total))
+ (for-each (lambda (x) (guard (make-module))) (iota total))
- (gc)
- (gc) ;; twice: have to kill the weak vectors.
- (gc) ;; thrice: because the test doesn't succeed with only
- ;; one gc round. not sure why.
-
- (= (let lp ((i 0))
- (if (guard)
- (lp (1+ i))
- i))
- total))))
+ ;; Avoid false references to the modules on the stack.
+ (let cleanup ((i 20))
+ (and (> i 0)
+ (begin (cleanup (1- i)) i)))
+ (gc)
+ (gc) ;; twice: have to kill the weak vectors.
+ (gc) ;; thrice: because the test doesn't succeed with only
+ ;; one gc round. not sure why.
+
+ (= (let lp ((i 0))
+ (if (guard)
+ (lp (1+ i))
+ i))
+ total))))