diff --git a/collects/drracket/private/expanding-place.rkt b/collects/drracket/private/expanding-place.rkt index 916299b60c..388978afe2 100644 --- a/collects/drracket/private/expanding-place.rkt +++ b/collects/drracket/private/expanding-place.rkt @@ -97,6 +97,24 @@ (define sema (make-semaphore 0)) (ep-log-info "expanding-place.rkt: 02 setting basic parameters") (set-basic-parameters/no-gui) + + (define loaded-paths '()) + (define original-path (make-parameter #f)) + (current-load/use-compiled + (let ([ol (current-load/use-compiled)]) + (λ (path mod-name) + (parameterize ([original-path path]) + (ol path mod-name))))) + (current-load + (let ([cl (current-load)]) + (λ (path mod-name) + (set! loaded-paths + (cons (or (current-module-declare-source) + (original-path) + path) + loaded-paths)) + (cl path mod-name)))) + (ep-log-info "expanding-place.rkt: 03 setting module language parameters") (set-module-language-parameters settings module-language-parallel-lock-client @@ -110,7 +128,6 @@ (ep-log-info "expanding-place.rkt: 05 installing security guard") (install-security-guard) ;; must come after the call to set-module-language-parameters (ep-log-info "expanding-place.rkt: 06 setting uncaught-exception-handler") - (define loaded-paths '()) (uncaught-exception-handler (λ (exn) (parameterize ([current-custodian orig-cust]) @@ -143,24 +160,9 @@ (define io-sema (make-semaphore 0)) (when log-io? (thread (λ () (catch-and-log in io-sema)))) - (define original-path (make-parameter #f)) (define expanded (parameterize ([current-output-port out] - [current-error-port out] - [current-load/use-compiled - (let ([ol (current-load/use-compiled)]) - (λ (path mod-name) - (parameterize ([original-path path]) - (ol path mod-name))))] - [current-load - (let ([cl (current-load)]) - (λ (path mod-name) - (set! loaded-paths - (cons (or (current-module-declare-source) - (original-path) - path) - loaded-paths)) - (cl path mod-name)))]) + [current-error-port out]) (expand transformed-stx))) (when log-io? (close-output-port out) diff --git a/collects/drracket/private/local-member-names.rkt b/collects/drracket/private/local-member-names.rkt index e9c883ad9e..1e08c403a2 100644 --- a/collects/drracket/private/local-member-names.rkt +++ b/collects/drracket/private/local-member-names.rkt @@ -29,3 +29,23 @@ ;; online check syntax has finished (define-local-member-name get-online-expansion-colors) + + + +;; used by the module language +(define-local-member-name + frame-show-bkg-running + set-expand-error/status + update-frame-expand-error + expand-error-next + expand-error-prev + hide-module-language-error-panel + fetch-data-to-send + clear-old-error + set-bottom-bar-status + + get-oc-status + set-oc-status + + set-dep-paths + set-dirty-if-dep) \ No newline at end of file diff --git a/collects/drracket/private/module-language.rkt b/collects/drracket/private/module-language.rkt index ca762d826a..d9cab2e77c 100644 --- a/collects/drracket/private/module-language.rkt +++ b/collects/drracket/private/module-language.rkt @@ -27,6 +27,23 @@ "rectangle-intersect.rkt" framework/private/logging-timer) +;; submodule to make these accessible to the test suite +(module oc-status-structs racket/base + ;; the online compilation state for individual tabs + ;; oc-state is either: + ;; (clean symbol? string? (listof (vector number? number?))) + ;; (dirty boolean?) + ;; (running symbol? string?) + (struct clean (error-type error-message error-locs) #:transparent) + (struct dirty (timer-pending?) #:transparent) + (struct running (sym str) #:transparent) + + (provide (struct-out clean) + (struct-out dirty) + (struct-out running))) + +(require (submod "." oc-status-structs)) + #| ;; this code tracks which lines have been executed ;; for use while (manually) testing the oc state machine @@ -883,23 +900,6 @@ filename))))))] [else #f]))) - (define-local-member-name - frame-show-bkg-running - set-expand-error/status - update-frame-expand-error - expand-error-next - expand-error-prev - hide-module-language-error-panel - fetch-data-to-send - clear-old-error - set-bottom-bar-status - - get-oc-status - set-oc-status - - set-dep-paths - set-dirty-if-dep) - (define online-expansion-logger (make-logger 'online-expansion-state-machine (current-logger))) (define-syntax-rule (define/oc-log (id . args) . body) @@ -1702,15 +1702,6 @@ (super-new [stretchable-width #f] [stretchable-height #f]))) - ;; the online compilation state for individual tabs - ;; oc-state is either: - ;; (clean symbol? string? (listof (vector number? number?))) - ;; (dirty boolean?) - ;; (running symbol? string?) - (struct clean (error-type error-message error-locs) #:transparent) - (struct dirty (timer-pending?) #:transparent) - (struct running (sym str) #:transparent) - ;; get-current-oc-state : -> (or/c tab #f) (or/c tab #f) (listof tab) (listof tab) ;; the tabs in the results are only those that are in the module language (define (get-current-oc-state) diff --git a/collects/tests/drracket/online-compilation-zo-creation.rkt b/collects/tests/drracket/online-compilation-zo-creation.rkt new file mode 100644 index 0000000000..61d468af4e --- /dev/null +++ b/collects/tests/drracket/online-compilation-zo-creation.rkt @@ -0,0 +1,44 @@ +#lang racket/base +(require "private/drracket-test-util.rkt" + racket/file + drracket/private/local-member-names + racket/class + racket/path + (submod drracket/private/module-language oc-status-structs)) +(fire-up-drracket-and-run-tests + (λ () + (define tmp-dir (make-temporary-file "online-compilation-zo-creation~a" 'directory)) + (define x.rkt (build-path tmp-dir "x.rkt")) + (define y.rkt (build-path tmp-dir "y.rkt")) + (call-with-output-file x.rkt + (λ (port) + (fprintf port "#lang racket/base\n") + (fprintf port "~s\n" `(require "y.rkt"))) + #:exists 'truncate) + (call-with-output-file y.rkt + (λ (port) + (fprintf port "#lang racket/base\n")) + #:exists 'truncate) + (define drs-frame (wait-for-drracket-frame)) + (queue-callback/res + (λ () + (send (send drs-frame get-definitions-text) load-file x.rkt))) + (poll-until + (λ () + (queue-callback/res + (λ () + (clean? (send (send drs-frame get-current-tab) get-oc-status)))))) + + (define compiled-dir-files + (cond + [(directory-exists? (build-path tmp-dir "compiled")) + (for/list ([file (in-directory (build-path tmp-dir "compiled"))]) + (path->string (find-relative-path tmp-dir file)))] + [else + '()])) + (define expected-file "compiled/drracket/errortrace/y_rkt.zo") + (unless (member expected-file compiled-dir-files) + (eprintf "expected to find ~s in compiled dir but it contained ~s\n" + expected-file compiled-dir-files)) + + (delete-directory/files tmp-dir)))