From 425ed7b2928ba95ca816ec372256db06ef4c47a5 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 17 Aug 2013 12:10:51 -0600 Subject: [PATCH] fix benchmark harness for compiled test directories The benchmark harness was written with the assumption that "compiled" would not exist, but compilation of tests is enabled by default. --- .../tests/racket/benchmarks/common/auto.rkt | 19 +++++++++++-------- .../tests/racket/benchmarks/shootout/auto.rkt | 14 +++++++------- .../tests/racket/benchmarks/shootout/run.rkt | 6 +++--- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/common/auto.rkt b/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/common/auto.rkt index 1571841ac6..c491b97c25 100755 --- a/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/common/auto.rkt +++ b/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/common/auto.rkt @@ -46,14 +46,17 @@ exec racket -qu "$0" ${1+"$@"} [read-accept-reader #t]) (let ([name (format "~a.rkt" bm)]) (compile-file name - (build-path "compiled" (path-add-suffix name #".zo")))))) + "compiled/current-bm_rkt.zo")))) + + (define (compiled-path bm) + "current-bm.rkt") (define (mk-mz-old bm) (system (format "mz-old -l- raco make ~a.rkt" bm))) (define (clean-up-zo bm) - (when (directory-exists? "compiled") - (delete-directory/files "compiled"))) + (when (file-exists? "compiled/current-bm_rkt.zo") + (delete-file "compiled/current-bm_rkt.zo"))) (define (mk-typed-racket-non-optimizing bm) (unless (directory-exists? "typed/compiled") @@ -364,7 +367,7 @@ exec racket -qu "$0" ${1+"$@"} void mk-racket (lambda (bm) - (system* (find-exe) "-u" (format "~a.rkt" bm))) + (system* (find-exe) "-u" (compiled-path bm))) extract-racket-times clean-up-zo racket-skip-progs) @@ -380,7 +383,7 @@ exec racket -qu "$0" ${1+"$@"} void mk-racket (lambda (bm) - (system (format "racketcgc -u ~a.rkt" bm))) + (system (format "racketcgc -u ~a" (compiled-path bm)))) extract-racket-times clean-up-zo racket-skip-progs) @@ -388,7 +391,7 @@ exec racket -qu "$0" ${1+"$@"} void mk-racket (lambda (bm) - (system (format "racket3m -u ~a.rkt" bm))) + (system (format "racket3m -u ~a" (compiled-path bm)))) extract-racket-times clean-up-zo racket-skip-progs) @@ -415,7 +418,7 @@ exec racket -qu "$0" ${1+"$@"} void mk-racket (lambda (bm) - (system (format "racket -jqu ~a.rkt" bm))) + (system (format "racket -jqu ~a" (compiled-path bm)))) extract-racket-times clean-up-zo racket-skip-progs) @@ -423,7 +426,7 @@ exec racket -qu "$0" ${1+"$@"} void mk-racket (lambda (bm) - (system (format "racketcgc -jqu ~a.rkt" bm))) + (system (format "racketcgc -jqu ~a" (compiled-path bm)))) extract-racket-times clean-up-zo racket-skip-progs) diff --git a/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/shootout/auto.rkt b/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/shootout/auto.rkt index d85c52fed8..64103d0301 100755 --- a/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/shootout/auto.rkt +++ b/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/shootout/auto.rkt @@ -40,11 +40,11 @@ exec racket -qu "$0" ${1+"$@"} [read-accept-reader #t]) (let ([name (format "~a.rkt" bm)]) (compile-file name - (build-path "compiled" (path-add-suffix name #".zo")))))) + "compiled/current-bm_rkt.zo")))) (define (clean-up-zo bm) - (when (directory-exists? "compiled") - (delete-directory/files "compiled"))) + (when (file-exists? "compiled/current-bm_rkt.zo") + (delete-file "compiled/current-bm_rkt.zo"))) (define (mk-typed-racket-non-optimizing bm) (unless (directory-exists? "typed/compiled") @@ -53,7 +53,7 @@ exec racket -qu "$0" ${1+"$@"} [read-accept-reader #t]) (let ([name (format "~a-non-optimizing.rkt" bm)]) (compile-file (format "typed/~a" name) - (build-path "typed/compiled" (path-add-suffix name #".zo")))))) + "typed/compiled/current-bm_rkt.zo")))) (define (mk-typed-racket bm) (unless (directory-exists? "typed/compiled") (make-directory "typed/compiled")) @@ -61,11 +61,11 @@ exec racket -qu "$0" ${1+"$@"} [read-accept-reader #t]) (let ([name (format "~a-optimizing.rkt" bm)]) (compile-file (format "typed/~a" name) - (build-path "typed/compiled" (path-add-suffix name #".zo")))))) + "typed/compiled/current-bm_rkt.zo")))) (define (clean-up-typed bm) - (when (directory-exists? "typed/compiled") - (delete-directory/files "typed/compiled"))) + (when (file-exists? "typed/compiled/current-bm_rkt.zo") + (delete-file "typed/compiled/current-bm_rkt.zo"))) (define (extract-racket-times bm str) (let ([m (regexp-match #rx#"cpu time: ([0-9]+) real time: ([0-9]+) gc time: ([0-9]+)" str)]) diff --git a/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/shootout/run.rkt b/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/shootout/run.rkt index d706151245..38135448d3 100644 --- a/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/shootout/run.rkt +++ b/pkgs/racket-pkgs/racket-test/tests/racket/benchmarks/shootout/run.rkt @@ -137,9 +137,9 @@ (vector-ref (current-command-line-arguments) 1))] [bench (vector-ref (current-command-line-arguments) 0)] [prog (cond - ((string=? version "racket") (format "~a.rkt" bench)) - ((string=? version "typed-racket-non-optimizing") (format "typed/~a-non-optimizing.rkt" bench)) - ((string=? version "typed-racket") (format "typed/~a-optimizing.rkt" bench)) + ((string=? version "racket") "current-bm.rkt") + ((string=? version "typed-racket-non-optimizing") "typed/current-bm.rkt") + ((string=? version "typed-racket") "typed/current-bm.rkt") (else (error 'run "unknown version ~a" version)))]) (let ([m (assoc bench input-map)]) (unless m