From 24d76d0e82da91cd84e6ecbaed291e345c30b591 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Thu, 25 Feb 2010 16:24:36 +0000 Subject: [PATCH] Allowing any module path in mutators for the collector svn: r18336 --- collects/plai/mutator.ss | 8 ++++---- collects/tests/plai/gc/good-mutators/modpath.ss | 4 ++++ collects/tests/plai/test-random-mutator.ss | 12 +----------- 3 files changed, 9 insertions(+), 15 deletions(-) create mode 100644 collects/tests/plai/gc/good-mutators/modpath.ss diff --git a/collects/plai/mutator.ss b/collects/plai/mutator.ss index 350beac72b..0200d8265a 100644 --- a/collects/plai/mutator.ss +++ b/collects/plai/mutator.ss @@ -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 )" + "Mutator must start with an 'allocator-setup' expression, such as: (allocator-setup )" stx)])) (define-for-syntax allocator-setup-error-msg - "Mutator must start with an 'allocator-setup' expression, such as: (allocator-setup )") + "Mutator must start with an 'allocator-setup' expression, such as: (allocator-setup )") (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)))] [_ diff --git a/collects/tests/plai/gc/good-mutators/modpath.ss b/collects/tests/plai/gc/good-mutators/modpath.ss new file mode 100644 index 0000000000..413e6c3217 --- /dev/null +++ b/collects/tests/plai/gc/good-mutators/modpath.ss @@ -0,0 +1,4 @@ +#lang plai/mutator +(allocator-setup tests/plai/gc/good-collectors/good-collector 10) +1 +2 diff --git a/collects/tests/plai/test-random-mutator.ss b/collects/tests/plai/test-random-mutator.ss index 9593415049..cffbc7c2dc 100644 --- a/collects/tests/plai/test-random-mutator.ss +++ b/collects/tests/plai/test-random-mutator.ss @@ -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)