Allowing any module path in mutators for the collector

svn: r18336
This commit is contained in:
Jay McCarthy 2010-02-25 16:24:36 +00:00
parent f39e8ebe0c
commit 24d76d0e82
3 changed files with 9 additions and 15 deletions

View File

@ -307,11 +307,11 @@
(printf "Large heap; the heap visualizer will not be displayed.~n")))
(init-allocator))))]
[_ (raise-syntax-error 'mutator
"Mutator must start with an 'allocator-setup' expression, such as: (allocator-setup <literal-string> <literal-number>)"
"Mutator must start with an 'allocator-setup' expression, such as: (allocator-setup <module-path> <literal-number>)"
stx)]))
(define-for-syntax allocator-setup-error-msg
"Mutator must start with an 'allocator-setup' expression, such as: (allocator-setup <literal-string> <literal-number>)")
"Mutator must start with an 'allocator-setup' expression, such as: (allocator-setup <module-path> <literal-number>)")
(define-syntax (mutator-module-begin stx)
(syntax-case stx (allocator-setup)
@ -320,8 +320,8 @@
(syntax-case #'setup ()
[(collector heap-size)
(begin
(unless (string? (syntax->datum #'collector))
(raise-syntax-error 'allocator-setup "expected a literal string" #'collector))
(unless (module-path? (syntax->datum #'collector))
(raise-syntax-error 'allocator-setup "expected a module path" #'collector))
(unless (number? (syntax->datum #'heap-size))
(raise-syntax-error 'allocator-setup "expected a literal number" #'heap-size)))]
[_

View File

@ -0,0 +1,4 @@
#lang plai/mutator
(allocator-setup tests/plai/gc/good-collectors/good-collector 10)
1
2

View File

@ -11,10 +11,6 @@
;; random mutator generation tests
;;
(define-runtime-path collector-path "gc/good-collectors/good-collector.ss")
(define-runtime-path here ".")
;; test-code : exp -> boolean
;; returns true if evaluating the example code (as a mutator)
;; returns one result at the top-level, namely the symbol 'passed.
@ -23,13 +19,7 @@
(call-with-output-file tmpfile
(λ (port)
(fprintf port "#lang plai/mutator\n")
(fprintf port "~s\n" `(allocator-setup ,(path->string
(find-relative-path
(let-values ([(base name dir?) (split-path tmpfile)])
(normalize-path (simple-form-path base)))
(normalize-path
(simple-form-path collector-path))))
100))
(fprintf port "~s\n" `(allocator-setup tests/plai/gc/good-collectors/good-collector 100))
(for-each (λ (exp) (pretty-print exp port)) exps))
#:exists 'truncate)