summaryrefslogtreecommitdiffstats
path: root/tests/012/stack.tl
blob: a8d06487b1cc740f2ad52bd00579166fb250a33e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(load "../common")

(defun recur () (recur))

(defmacro so (expr)
  ^(catch ,expr
     (stack-overflow (exc) :so)))

(test (so (recur)) :so)

(test (let ((pid (fork)))
        (cond
          ((zerop pid) (set-stack-limit 0) (recur))
          (t (let ((status (wait pid)))
               (w-ifsignaled status)))))
      t)

(defmacro infexp ()
  ^(foo (infexp)))

(test (so (expand '(infexp))) :so)

(defvarl orig (get-stack-limit))

(mvtest
  (set-stack-limit nil) orig
  (set-stack-limit orig) nil
  (set-stack-limit 0) orig
  (set-stack-limit orig) nil
  (set-stack-limit 65536) orig
  (set-stack-limit orig) 65536)