~ chicken-core (chicken-5) 3837dd8c998ff31c179c0e2cba95615ead3f761b


commit 3837dd8c998ff31c179c0e2cba95615ead3f761b
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Mon Jul 20 22:52:56 2015 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Jul 20 22:52:56 2015 +0200

    removed code in apply-test that used fixed limit (there is no fixed limit, the limit depends on multiple factors)

diff --git a/tests/apply-test.scm b/tests/apply-test.scm
index 81697a5c..4996dd0d 100644
--- a/tests/apply-test.scm
+++ b/tests/apply-test.scm
@@ -1,27 +1,14 @@
 (require-extension srfi-1)
 
-(define max-argcount ##sys#apply-argument-limit)
-
-(begin-for-syntax
- (define max-direct-argcount
-   (cond-expand
-     ;; This depends the temp stack's size (as does max-argcount w/ manyargs).
-     ;; We can't use the foreign value for C_TEMPORARY_STACK_SIZE here because
-     ;; we're evaluating this in the compiler, not compiling it (confused yet?)
-     (compiling 2048)
-     ;; But in interpreted mode, everything boils down to "apply", so if no apply
-     ;; hack is available, we're more limited in csi than in csc.
-     (else ##sys#apply-argument-limit))))
-
 (when (feature? 'manyargs) (print "many arguments supported."))
 
 (define (foo . args)
   (when (pair? args)
     (assert (= (length args) (last args)))))
 
-(printf "testing 'apply' with 0..~A (maximum apply argument count)...\n" max-argcount)
+(printf "testing 'apply' with 0..~A (maximum apply argument count)...\n" 2000)
 (do ((i 0 (add1 i)))
-    ((>= i max-argcount))
+    ((>= i 2000))
   (apply foo (iota i 1)))
 
 (let-syntax
@@ -33,26 +20,10 @@
             ;; Lowest edge cases
             ,@(list-tabulate 50 (lambda (i) `(foo ,@(iota i 1))))
             (printf "invoking directly with ~A..~A (maximum ~A direct argument count)...\n"
-              ,(- max-direct-argcount 50) ,max-direct-argcount
+              ,(- 2000 50) 2000
               (cond-expand (compiling "compiled") (else "interpreted")))
             ;; Highest edge cases
             ,@(list-tabulate
-               50 (lambda (i) `(foo ,@(iota (- max-direct-argcount i) 1)))))))))
+               50 (lambda (i) `(foo ,@(iota (- 2000 i) 1)))))))))
   (print "If this segfaults on x86-64, try updating GCC (4.5 has a code-generation bug):")
   (invoke-directly))
-
-(define-syntax assert-argcount-error
-  (syntax-rules ()
-    ((_ expr)
-     (assert (condition-case (begin expr #f)
-               ((exn runtime limit) 'a-okay))))))
-
-(print "testing 'apply' can detect calls of too many arguments...")
-(assert-argcount-error (apply foo (iota (add1 max-argcount) 1)))
-
-(print "testing direct invocation can detect calls of too many arguments...")
-(let-syntax ((invoke-directly-with-too-many-args
-              (ir-macro-transformer
-               (lambda (i r c)
-                 `(assert-argcount-error (foo ,@(iota (add1 max-direct-argcount) 1)))))))
-  (invoke-directly-with-too-many-args))
Trap