ports must now directly call the compiler
This commit is contained in:
parent
b514675182
commit
2fd2227db4
29
cover.rkt
29
cover.rkt
|
@ -43,14 +43,12 @@ in "coverage.rkt". This raw coverage information is converted to a usable form b
|
|||
(define abs
|
||||
(for/list ([p (in-list files)])
|
||||
(if (list? p)
|
||||
(cons (->absolute/port (car p)) (cdr p))
|
||||
(->absolute/port p))))
|
||||
(cons (->absolute (car p)) (cdr p))
|
||||
(->absolute p))))
|
||||
(define abs-names
|
||||
(for/list ([p abs])
|
||||
(for/list ([p (in-list abs)])
|
||||
(match p
|
||||
[(cons p _) p]
|
||||
[(? input-port? p)
|
||||
(object-name p)]
|
||||
[_ p])))
|
||||
(define tests-failed #f)
|
||||
(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 ---------------------------------
|
||||
|
||||
(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 submod `(submod ,sfile ,submod-name))
|
||||
(run-mod (if (module-declared? submod #t) submod sfile))]))
|
||||
(define sfile `(file ,(if (path? the-file) (path->string the-file) the-file)))
|
||||
(define submod `(submod ,sfile ,submod-name))
|
||||
(run-mod (if (module-declared? submod #t) submod sfile)))
|
||||
|
||||
(define (run-mod to-run)
|
||||
(vprintf "running ~s\n" to-run)
|
||||
(eval (make-dyn-req-expr 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)
|
||||
`(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-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)
|
||||
(get-val environment-ann-top))
|
||||
(define (load-annotate-top)
|
||||
|
|
4
main.rkt
4
main.rkt
|
@ -14,8 +14,8 @@
|
|||
[test-files! (->* () (#:submod symbol?
|
||||
#:env environment?)
|
||||
#:rest
|
||||
(listof (or/c (or/c path-string? input-port?)
|
||||
(list/c (or/c path-string? input-port?)
|
||||
(listof (or/c path-string?
|
||||
(list/c path-string?
|
||||
(not-impersonated/c
|
||||
(vectorof (not-impersonated/c string?) #:immutable #t)))))
|
||||
any)]
|
||||
|
|
|
@ -128,7 +128,8 @@
|
|||
;; Generates a string that represents a valid coveralls json_file object
|
||||
(define (generate-source-files coverage)
|
||||
(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 src (file->string file))
|
||||
(define c (line-coverage coverage file))
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
|
||||
(define (get-files coverage dir)
|
||||
(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)
|
||||
(define exploded (explode-path k))
|
||||
(define-values (_ dir-list)
|
||||
|
|
|
@ -15,7 +15,7 @@ functions of test coverage.
|
|||
@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
|
||||
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
|
||||
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
|
||||
|
@ -25,10 +25,11 @@ 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.}
|
||||
|
||||
@defproc[(test-files! (#:submod submod symbol? 'test)
|
||||
(files (or/c (or/c path-string? input-port?)
|
||||
(list/c (or/c path-string? input-port?)
|
||||
(not-impersonated/c
|
||||
(vectorof (not-impersonated/c string?) #:immutable #t))))) ...)
|
||||
(files
|
||||
(or/c path-string?
|
||||
(list/c path-string?
|
||||
(not-impersonated/c
|
||||
(vectorof (not-impersonated/c string?) #:immutable #t))))) ...)
|
||||
any]{
|
||||
|
||||
Runs all given @racket[files] and their submodule @racket[submod] (if it exists), storing the
|
||||
|
|
Loading…
Reference in New Issue
Block a user