From 107d1e42a7ce28f36a2bcb339aa8b40339bf2ad5 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 11 Aug 2018 18:25:55 -0600 Subject: [PATCH] raco demod: fix module name in generated bytecode Closes #2226 --- .../compiler/demodularizer/bundle.rkt | 5 +++-- .../compiler/demodularizer/main.rkt | 4 +++- .../compiler/demodularizer/demod-test.rkt | 18 +++++++++++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/pkgs/compiler-lib/compiler/demodularizer/bundle.rkt b/pkgs/compiler-lib/compiler/demodularizer/bundle.rkt index d085f4ea01..a3ec0dc6a1 100644 --- a/pkgs/compiler-lib/compiler/demodularizer/bundle.rkt +++ b/pkgs/compiler-lib/compiler/demodularizer/bundle.rkt @@ -7,7 +7,7 @@ (provide wrap-bundle) -(define (wrap-bundle body internals lifts excluded-module-mpis get-merge-info) +(define (wrap-bundle body internals lifts excluded-module-mpis get-merge-info name) (define-values (runs import-keys ordered-importss @@ -166,4 +166,5 @@ (linkl-bundle (hasheq 0 new-linkl 'data data-linkl - 'decl decl-linkl))) + 'decl decl-linkl + 'name name))) diff --git a/pkgs/compiler-lib/compiler/demodularizer/main.rkt b/pkgs/compiler-lib/compiler/demodularizer/main.rkt index e23df0ed51..fc8a43ee08 100644 --- a/pkgs/compiler-lib/compiler/demodularizer/main.rkt +++ b/pkgs/compiler-lib/compiler/demodularizer/main.rkt @@ -46,7 +46,9 @@ (log-info "Bundling linklet") (define bundle (wrap-bundle new-body new-internals new-lifts excluded-module-mpis - get-merge-info)) + get-merge-info + (let-values ([(base name dir?) (split-path input-file)]) + (string->symbol (path->string name))))) (log-info "Writing bytecode") (define output-file (or given-output-file diff --git a/pkgs/compiler-test/tests/compiler/demodularizer/demod-test.rkt b/pkgs/compiler-test/tests/compiler/demodularizer/demod-test.rkt index 35db7ac7ea..8e038c1287 100644 --- a/pkgs/compiler-test/tests/compiler/demodularizer/demod-test.rkt +++ b/pkgs/compiler-test/tests/compiler/demodularizer/demod-test.rkt @@ -39,7 +39,23 @@ #:failure-prefix (format "~a stdout" filename) whole-output => modular-output #:failure-prefix (format "~a stderr" filename) - whole-error => modular-error)) + whole-error => modular-error) + + (when (null? exceptions) + ;; try creating an executable + (define exe-filename (build-path + (find-system-path 'temp-dir) + (if (eq? (system-type) 'windows) + "demod-exe.exe" + "demod-exe"))) + (system* (find-exe) "-l-" "raco" "exe" "-o" exe-filename demod-filename) + (define-values (whole-exe-output whole-exe-error) + (capture-output exe-filename)) + (test + #:failure-prefix (format "~a exe stdout" filename) + whole-exe-output => modular-output + #:failure-prefix (format "~a exe stderr" filename) + whole-exe-error => modular-error))) (define-runtime-path tests "tests")