summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-04 09:53:29 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-04 09:53:29 -0700
commit9d8a89af69dfa46c7b74c2ffe049a5deddd67274 (patch)
tree3c194a7dffbf0b83ee6322cfa6b7797261dd5392 /tests
parentdcc42a5204f97efaf3f99e14a117fbb7720ad515 (diff)
downloadtxr-9d8a89af69dfa46c7b74c2ffe049a5deddd67274.tar.gz
txr-9d8a89af69dfa46c7b74c2ffe049a5deddd67274.tar.bz2
txr-9d8a89af69dfa46c7b74c2ffe049a5deddd67274.zip
stack-limit: bug: not handling RLIM_INFINITY.
* gc.c (gc_init): We must check rlim_cur for the RLIM_INFINITY value indicating unlimited stack, and not misuse this value as a limit number, otherwise hilarity ensues. This reproduced on an older platform with make 3.81, which calls setrlimit to bring about an unlimited stack, passed on to child processes. Because of this txr segfaulted, as a consequence of a false positive. * tests/012/stack.tl (stack-limited): New variable which indicates whether there is a stack limit. If there isn't, we avoid running the fork-based test case. Also, we set the stack limit to 32768 so we have a limit against which to run some of the tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/012/stack.tl15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/012/stack.tl b/tests/012/stack.tl
index 879d3d27..9a7534bb 100644
--- a/tests/012/stack.tl
+++ b/tests/012/stack.tl
@@ -1,5 +1,7 @@
(load "../common")
+(defvar stack-limited (set-stack-limit 32768))
+
(defun recur () (recur))
(defmacro so (expr)
@@ -8,12 +10,13 @@
(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)
+(if stack-limited
+ (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)))