Allowing any module path in mutators for the collector
svn: r18336
This commit is contained in:
parent
f39e8ebe0c
commit
24d76d0e82
|
@ -307,11 +307,11 @@
|
||||||
(printf "Large heap; the heap visualizer will not be displayed.~n")))
|
(printf "Large heap; the heap visualizer will not be displayed.~n")))
|
||||||
(init-allocator))))]
|
(init-allocator))))]
|
||||||
[_ (raise-syntax-error 'mutator
|
[_ (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)]))
|
stx)]))
|
||||||
|
|
||||||
(define-for-syntax allocator-setup-error-msg
|
(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)
|
(define-syntax (mutator-module-begin stx)
|
||||||
(syntax-case stx (allocator-setup)
|
(syntax-case stx (allocator-setup)
|
||||||
|
@ -320,8 +320,8 @@
|
||||||
(syntax-case #'setup ()
|
(syntax-case #'setup ()
|
||||||
[(collector heap-size)
|
[(collector heap-size)
|
||||||
(begin
|
(begin
|
||||||
(unless (string? (syntax->datum #'collector))
|
(unless (module-path? (syntax->datum #'collector))
|
||||||
(raise-syntax-error 'allocator-setup "expected a literal string" #'collector))
|
(raise-syntax-error 'allocator-setup "expected a module path" #'collector))
|
||||||
(unless (number? (syntax->datum #'heap-size))
|
(unless (number? (syntax->datum #'heap-size))
|
||||||
(raise-syntax-error 'allocator-setup "expected a literal number" #'heap-size)))]
|
(raise-syntax-error 'allocator-setup "expected a literal number" #'heap-size)))]
|
||||||
[_
|
[_
|
||||||
|
|
4
collects/tests/plai/gc/good-mutators/modpath.ss
Normal file
4
collects/tests/plai/gc/good-mutators/modpath.ss
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#lang plai/mutator
|
||||||
|
(allocator-setup tests/plai/gc/good-collectors/good-collector 10)
|
||||||
|
1
|
||||||
|
2
|
|
@ -11,10 +11,6 @@
|
||||||
;; random mutator generation tests
|
;; random mutator generation tests
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(define-runtime-path collector-path "gc/good-collectors/good-collector.ss")
|
|
||||||
|
|
||||||
(define-runtime-path here ".")
|
|
||||||
|
|
||||||
;; test-code : exp -> boolean
|
;; test-code : exp -> boolean
|
||||||
;; returns true if evaluating the example code (as a mutator)
|
;; returns true if evaluating the example code (as a mutator)
|
||||||
;; returns one result at the top-level, namely the symbol 'passed.
|
;; returns one result at the top-level, namely the symbol 'passed.
|
||||||
|
@ -23,13 +19,7 @@
|
||||||
(call-with-output-file tmpfile
|
(call-with-output-file tmpfile
|
||||||
(λ (port)
|
(λ (port)
|
||||||
(fprintf port "#lang plai/mutator\n")
|
(fprintf port "#lang plai/mutator\n")
|
||||||
(fprintf port "~s\n" `(allocator-setup ,(path->string
|
(fprintf port "~s\n" `(allocator-setup tests/plai/gc/good-collectors/good-collector 100))
|
||||||
(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))
|
|
||||||
(for-each (λ (exp) (pretty-print exp port)) exps))
|
(for-each (λ (exp) (pretty-print exp port)) exps))
|
||||||
#:exists 'truncate)
|
#:exists 'truncate)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user