X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fgc.impure.lisp;h=d21d14a47772b0662195395750eff2d16f70bebe;hb=aa01df7a18a5d8747423173bda7c20eb46092514;hp=07e3d983da3c2ce1477d20a763f24195201c2626;hpb=175c318c892b0627b36fa3c4db66f59680242204;p=sbcl.git diff --git a/tests/gc.impure.lisp b/tests/gc.impure.lisp index 07e3d98..d21d14a 100644 --- a/tests/gc.impure.lisp +++ b/tests/gc.impure.lisp @@ -31,15 +31,7 @@ (let ((gc-happend nil)) (push (lambda () (setq gc-happend t)) sb-ext:*after-gc-hooks*) - ;; check GC-{ON,OFF} works and gc is deferred - (gc-off) - (gc) - (assert (not gc-happend)) - (gc-on) - (assert gc-happend) - ;; check that WITHOUT-GCING defers explicit gc - (setq gc-happend nil) (sb-sys:without-gcing (gc) (assert (not gc-happend))) @@ -58,15 +50,44 @@ (assert (not gc-happend))) ;; give the hook time to run (sleep 1) - (assert gc-happend)) + (assert gc-happend))) - ;; check GC-ON works even in a WITHOUT-GCING - (setq gc-happend nil) - (sb-sys:without-gcing - (gc) - (assert (not gc-happend)) - (gc-on) - (assert gc-happend) - (setq gc-happend nil)) - (assert (not gc-happend))) +;;; SB-EXT:GENERATION-* accessors returned bogus values for generation > 0 +(with-test (:name :bug-529014 :skipped-on '(not :gencgc)) + (loop for i from 0 to sb-vm:+pseudo-static-generation+ + do (assert (= (sb-ext:generation-bytes-consed-between-gcs i) + (sb-ext:bytes-consed-between-gcs))) + ;; FIXME: These parameters are a) tunable in the source and b) + ;; duplicated multiple times there and now here. It would be good to + ;; OAOO-ify them (probably to src/compiler/generic/params.lisp). + (assert (= (sb-ext:generation-minimum-age-before-gc i) 0.75)) + (assert (= (sb-ext:generation-number-of-gcs-before-promotion i) 1)))) + +(defun stress-gc () + (let* ((x (make-array (truncate (* 0.2 (dynamic-space-size)) + sb-vm:n-word-bytes)))) + (elt x 0))) + +(with-test (:name :bug-936304) + (gc :full t) + (time + (assert (eq :ok (handler-case + (progn + (loop repeat 50 do (stress-gc)) + :ok) + (storage-condition () + :oom)))))) +(with-test (:name :bug-981106) + (gc :full t) + (time + (assert (eq :ok + (handler-case + (dotimes (runs 100 :ok) + (let ((len (length + (with-output-to-string (string) + (dotimes (i 1000000) + (write-sequence "hi there!" string)))))) + (assert (eql len (* 1000000 (length "hi there!")))))) + (storage-condition () + :oom))))))