ports must now directly call the compiler

This commit is contained in:
Spencer Florence 2015-02-22 15:57:47 -05:00
parent b514675182
commit 2fd2227db4
5 changed files with 18 additions and 32 deletions

View File

@ -43,14 +43,12 @@ in "coverage.rkt". This raw coverage information is converted to a usable form b
(define abs (define abs
(for/list ([p (in-list files)]) (for/list ([p (in-list files)])
(if (list? p) (if (list? p)
(cons (->absolute/port (car p)) (cdr p)) (cons (->absolute (car p)) (cdr p))
(->absolute/port p)))) (->absolute p))))
(define abs-names (define abs-names
(for/list ([p abs]) (for/list ([p (in-list abs)])
(match p (match p
[(cons p _) p] [(cons p _) p]
[(? input-port? p)
(object-name p)]
[_ p]))) [_ p])))
(define tests-failed #f) (define tests-failed #f)
(for ([p (in-list abs)]) (for ([p (in-list abs)])
@ -86,23 +84,15 @@ in "coverage.rkt". This raw coverage information is converted to a usable form b
;;; ---------------------- Running Aux --------------------------------- ;;; ---------------------- Running Aux ---------------------------------
(define (run-file the-file submod-name) (define (run-file the-file submod-name)
(cond [(input-port? the-file)
(eval (read-syntax (object-name the-file) the-file))]
[else
(define sfile `(file ,(if (path? the-file) (path->string the-file) the-file))) (define sfile `(file ,(if (path? the-file) (path->string the-file) the-file)))
(define submod `(submod ,sfile ,submod-name)) (define submod `(submod ,sfile ,submod-name))
(run-mod (if (module-declared? submod #t) submod sfile))])) (run-mod (if (module-declared? submod #t) submod sfile)))
(define (run-mod to-run) (define (run-mod to-run)
(vprintf "running ~s\n" to-run) (vprintf "running ~s\n" to-run)
(eval (make-dyn-req-expr to-run)) (eval (make-dyn-req-expr to-run))
(vprintf "finished running ~s\n" to-run)) (vprintf "finished running ~s\n" to-run))
;; (U InputPort PathString) -> (U InputPort PathString)
;; like ->absolute but handles ports
(define (->absolute/port p)
(if (port? p) p (->absolute p)))
(define (make-dyn-req-expr to-run) (define (make-dyn-req-expr to-run)
`(dynamic-require ',to-run 0)) `(dynamic-require ',to-run 0))
@ -181,13 +171,6 @@ in "coverage.rkt". This raw coverage information is converted to a usable form b
(load-raw-coverage) (load-raw-coverage)
(load-current-check-handler)))) (load-current-check-handler))))
;; -> Void
;; loads any needed names from `ns` before it can get polluted.
(define (load-names)
(load-annotate-top)
(load-raw-coverage)
(load-current-check-handler))
(define (get-annotate-top) (define (get-annotate-top)
(get-val environment-ann-top)) (get-val environment-ann-top))
(define (load-annotate-top) (define (load-annotate-top)

View File

@ -14,8 +14,8 @@
[test-files! (->* () (#:submod symbol? [test-files! (->* () (#:submod symbol?
#:env environment?) #:env environment?)
#:rest #:rest
(listof (or/c (or/c path-string? input-port?) (listof (or/c path-string?
(list/c (or/c path-string? input-port?) (list/c path-string?
(not-impersonated/c (not-impersonated/c
(vectorof (not-impersonated/c string?) #:immutable #t))))) (vectorof (not-impersonated/c string?) #:immutable #t)))))
any)] any)]

View File

@ -128,7 +128,8 @@
;; Generates a string that represents a valid coveralls json_file object ;; Generates a string that represents a valid coveralls json_file object
(define (generate-source-files coverage) (define (generate-source-files coverage)
(define src-files (define src-files
(for/list ([file (in-list (hash-keys coverage))]) (for/list ([file (in-list (hash-keys coverage))]
#:when (absolute-path? file))
(define local-file (path->string (find-relative-path (current-directory) file))) (define local-file (path->string (find-relative-path (current-directory) file)))
(define src (file->string file)) (define src (file->string file))
(define c (line-coverage coverage file)) (define c (line-coverage coverage file))

View File

@ -46,7 +46,8 @@
(define (get-files coverage dir) (define (get-files coverage dir)
(define file-list (define file-list
(for/list ([(k v) (in-hash coverage)]) (for/list ([(k v) (in-hash coverage)]
#:when (absolute-path? k))
(vprintf "building html coverage for: ~a\n" k) (vprintf "building html coverage for: ~a\n" k)
(define exploded (explode-path k)) (define exploded (explode-path k))
(define-values (_ dir-list) (define-values (_ dir-list)

View File

@ -15,7 +15,7 @@ functions of test coverage.
@defthing[file-coverage/c contract? #:value (listof (list/c boolean? srcloc?))])]{ @defthing[file-coverage/c contract? #:value (listof (list/c boolean? srcloc?))])]{
Coverage information is a hash map mapping absolute file paths to a list detailing the coverage of Coverage information is a hash map mapping absolute file paths to a list detailing the coverage of
that file. The file is keyed on the @racket[syntax-source] of the syntax objects for that that file. The file is keyed on the @racket[syntax-source] of the syntax objects from that
file. Usually this will be the absolute path to the file. The file coverage information is a list of file. Usually this will be the absolute path to the file. The file coverage information is a list of
lists, mapping a boolean to a range of characters within the file. True means the @racket[srcloc] lists, mapping a boolean to a range of characters within the file. True means the @racket[srcloc]
structure represents an expression that was run, and False means the structure represents an structure represents an expression that was run, and False means the structure represents an
@ -25,8 +25,9 @@ expansion and are thus neither run or not run. Note that the @racket[srcloc]s a
meaning a @racket[1] represents the first character in the file.} meaning a @racket[1] represents the first character in the file.}
@defproc[(test-files! (#:submod submod symbol? 'test) @defproc[(test-files! (#:submod submod symbol? 'test)
(files (or/c (or/c path-string? input-port?) (files
(list/c (or/c path-string? input-port?) (or/c path-string?
(list/c path-string?
(not-impersonated/c (not-impersonated/c
(vectorof (not-impersonated/c string?) #:immutable #t))))) ...) (vectorof (not-impersonated/c string?) #:immutable #t))))) ...)
any]{ any]{