racket/collects/tests/drracket/online-compilation-zo-creation.rkt
Robby Findler 79b5e4dc3a fix a bug that inhibited online compilation from writing out .zo files
when it compiles required files

Now that this is fixed, the compilation manager will be (once again)
active when doing online compilation, so if the "Populate compiled
directories" checkbox is check (which it is by default) in the details
section of the language dialog, then online compilation will, as it
compiles your file, write out .zo files that will also be used by the
Run button.

The actual fix to this bug is the change in expanding-place.rkt (and
all it really does is move the setting of the
current-load/use-compiled and current-load parameters earlier so that
CM sees only the modified parameter settings and so doesn't give up on
compilation.

The rest of the changes are a test case (and change to drracket to
support the test case)
2013-03-14 16:36:51 -05:00

45 lines
1.6 KiB
Racket

#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)))