From 9c1a9c466185df64c8e8e38d76d19dbfa0933567 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Tue, 13 Jul 2010 17:23:53 -0400 Subject: [PATCH] The optimizer's test harness now makes sure that optimized and non-optimized versions of the same code evaluate to the same thing. Unfortunately, this leads to a lot of code duplication. We can't abstract over optimization like we do for the benchmarks since the wrapper module would interfere with testing expanded code for equality. original commit: 7fb1b41a28c1a082e5f726bbc2acab4e2cc0e5fb --- collects/tests/typed-scheme/optimizer/run.rkt | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/collects/tests/typed-scheme/optimizer/run.rkt b/collects/tests/typed-scheme/optimizer/run.rkt index 6edd366d..4e8a6a2e 100644 --- a/collects/tests/typed-scheme/optimizer/run.rkt +++ b/collects/tests/typed-scheme/optimizer/run.rkt @@ -26,12 +26,23 @@ (define (test gen) (let-values (((base name _) (split-path gen))) (or (regexp-match ".*~" name) ; we ignore backup files - (equal? (parameterize ([current-load-relative-directory - (build-path here "generic")]) - (read-and-expand gen)) - (let ((hand-opt-dir (build-path here "hand-optimized"))) - (parameterize ([current-load-relative-directory hand-opt-dir]) - (read-and-expand (build-path hand-opt-dir name))))) + ;; machine optimized and hand optimized versions must expand to the + ;; same code + (and (equal? (parameterize ([current-load-relative-directory + (build-path here "generic")]) + (read-and-expand gen)) + (let ((hand-opt-dir (build-path here "hand-optimized"))) + (parameterize ([current-load-relative-directory hand-opt-dir]) + (read-and-expand (build-path hand-opt-dir name))))) + ;; optimized and non-optimized versions must evaluate to the + ;; same thing + (equal? (with-output-to-string + (lambda () + (dynamic-require gen #f))) + (with-output-to-string + (lambda () + (let ((non-opt-dir (build-path here "non-optimized"))) + (dynamic-require (build-path non-opt-dir name) #f)))))) (begin (printf "~a failed\n\n" name) #f))))