mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
* test-suite/standalone/test-out-of-memory: * test-suite/standalone/test-stack-overflow: Compile these files before running them. That way, recursion can check the stack-overflow mechanism instead of the memory allocation mechanism. We compile beforehand as a prepass so as not to impose an rlimit on a Guile that previously ran auto-compilation.
39 lines
862 B
Scheme
Executable file
39 lines
862 B
Scheme
Executable file
#!/bin/sh
|
|
guild compile "$0"
|
|
exec guile -q -s "$0" "$@"
|
|
!#
|
|
|
|
(unless (defined? 'setrlimit)
|
|
;; Without an rlimit, this test can take down your system, as it
|
|
;; consumes all of your memory in stack space. That doesn't seem like
|
|
;; something we should run as part of an automated test suite.
|
|
(exit 0))
|
|
|
|
;; 100 MB.
|
|
(define *limit* (* 100 1024 1024))
|
|
|
|
(call-with-values (lambda () (getrlimit 'as))
|
|
(lambda (soft hard)
|
|
(unless (and soft (< soft *limit*))
|
|
(setrlimit 'as (if hard (min *limit* hard) *limit*) hard))))
|
|
|
|
(define (test)
|
|
(catch 'stack-overflow
|
|
(lambda ()
|
|
(let lp ()
|
|
(lp)
|
|
(error "should not be reached")))
|
|
(lambda _
|
|
#t)))
|
|
|
|
;; Run the test a few times. The stack will only be enlarged and
|
|
;; relocated on the first one.
|
|
(test)
|
|
(test)
|
|
(test)
|
|
(test)
|
|
(test)
|
|
|
|
;; Local Variables:
|
|
;; mode: scheme
|
|
;; End:
|