raco test: refine override-"info.rkt" behavior of specifying a file
In consultation with Jay, unify the ignore-file's-extension and ignore-"info.rkt"-disabling treatment of `raco test` arguments. The change is that the latter applies only when an argument is a file, and not when it's a directory.
This commit is contained in:
parent
268544d565
commit
1715a50c80
|
@ -533,11 +533,12 @@
|
||||||
[(and (file-exists? p)
|
[(and (file-exists? p)
|
||||||
(or (not check-suffix?)
|
(or (not check-suffix?)
|
||||||
(regexp-match rx:default-suffixes p)
|
(regexp-match rx:default-suffixes p)
|
||||||
(get-cmdline p #f))
|
(get-cmdline p #f #:check-info? #t))
|
||||||
(or explicit-arguments?
|
(or (not check-suffix?)
|
||||||
(begin (check-info p)
|
(not (omit-path? p #:check-info? #t))))
|
||||||
(not (omit-path? p)))))
|
(unless check-suffix?
|
||||||
;; The above `omit-path?` loads "info.rkt" files
|
;; make sure "info.rkt" information is loaded:
|
||||||
|
(check-info p))
|
||||||
(define norm-p (normalize-info-path p))
|
(define norm-p (normalize-info-path p))
|
||||||
(define args (get-cmdline norm-p))
|
(define args (get-cmdline norm-p))
|
||||||
(define timeout (get-timeout norm-p))
|
(define timeout (get-timeout norm-p))
|
||||||
|
@ -657,7 +658,6 @@
|
||||||
(require (submod "." paths))
|
(require (submod "." paths))
|
||||||
|
|
||||||
(define collections? #f)
|
(define collections? #f)
|
||||||
(define explicit-arguments? #f)
|
|
||||||
(define packages? #f)
|
(define packages? #f)
|
||||||
(define libraries? #f)
|
(define libraries? #f)
|
||||||
(define check-top-suffix? #f)
|
(define check-top-suffix? #f)
|
||||||
|
@ -806,21 +806,30 @@
|
||||||
(define (normalize-info-path p)
|
(define (normalize-info-path p)
|
||||||
(simplify-path (path->complete-path p) #f))
|
(simplify-path (path->complete-path p) #f))
|
||||||
|
|
||||||
(define (omit-path? p)
|
(define (omit-path? p #:check-info? [check-info? #f])
|
||||||
|
(when check-info? (check-info p))
|
||||||
(let ([p (normalize-info-path p)])
|
(let ([p (normalize-info-path p)])
|
||||||
(or (hash-ref omit-paths p #f)
|
(or (hash-ref omit-paths p #f)
|
||||||
(let-values ([(base name dir?) (split-path p)])
|
(let-values ([(base name dir?) (split-path p)])
|
||||||
(and (path? base)
|
(and (path? base)
|
||||||
(omit-path? base))))))
|
(omit-path? base))))))
|
||||||
|
|
||||||
(define (get-cmdline p [default null])
|
(define (get-cmdline p [default null] #:check-info? [check-info? #f])
|
||||||
(hash-ref command-line-arguments p default))
|
(when check-info? (check-info p))
|
||||||
|
(hash-ref command-line-arguments
|
||||||
|
(if check-info? (normalize-info-path p) p)
|
||||||
|
default))
|
||||||
|
|
||||||
(define (get-timeout p) (hash-ref timeouts p +inf.0))
|
(define (get-timeout p)
|
||||||
|
;; assumes `(check-info p)` has been called and `p` is normalized
|
||||||
|
(hash-ref timeouts p +inf.0))
|
||||||
|
|
||||||
(define (get-lock-name p) (hash-ref lock-names p #f))
|
(define (get-lock-name p)
|
||||||
|
;; assumes `(check-info p)` has been called and `p` is normalized
|
||||||
|
(hash-ref lock-names p #f))
|
||||||
|
|
||||||
(define (get-responsible p)
|
(define (get-responsible p)
|
||||||
|
;; assumes `(check-info p)` has been called and `p` is normalized
|
||||||
(or (let loop ([p p])
|
(or (let loop ([p p])
|
||||||
(or (hash-ref responsibles p #f)
|
(or (hash-ref responsibles p #f)
|
||||||
(let-values ([(base name dir?) (split-path p)])
|
(let-values ([(base name dir?) (split-path p)])
|
||||||
|
@ -840,7 +849,9 @@
|
||||||
(and (ok-responsible? v)
|
(and (ok-responsible? v)
|
||||||
v))))))))
|
v))))))))
|
||||||
|
|
||||||
(define (get-random p) (hash-ref randoms p #f))
|
(define (get-random p)
|
||||||
|
;; assumes `(check-info p)` has been called and `p` is normalized
|
||||||
|
(hash-ref randoms p #f))
|
||||||
|
|
||||||
(define (ok-responsible? v)
|
(define (ok-responsible? v)
|
||||||
(or (string? v)
|
(or (string? v)
|
||||||
|
@ -950,9 +961,7 @@
|
||||||
"Print a summary table"
|
"Print a summary table"
|
||||||
(set! table? #t)]
|
(set! table? #t)]
|
||||||
#:args file-or-directory
|
#:args file-or-directory
|
||||||
(begin (set! explicit-arguments?
|
(begin (unless (= 1 (length file-or-directory))
|
||||||
(not (or collections? libraries? packages? check-top-suffix?)))
|
|
||||||
(unless (= 1 (length file-or-directory))
|
|
||||||
(set! single-file? #f))
|
(set! single-file? #f))
|
||||||
(define sum
|
(define sum
|
||||||
;; The #:sema argument everywhre makes tests start
|
;; The #:sema argument everywhre makes tests start
|
||||||
|
|
|
@ -17,11 +17,14 @@ directly, in separate processes (the default), or in separate places.
|
||||||
The current directory is set to a test file's directory before running
|
The current directory is set to a test file's directory before running
|
||||||
the file.
|
the file.
|
||||||
|
|
||||||
When an argument path refers to a directory, the tool recursively
|
When an argument path refers to a directory, @exec{raco test}
|
||||||
discovers and runs all files within the directory that end in
|
recursively discovers and runs all files within the directory that end
|
||||||
@filepath{.rkt}, end in @filepath{.scrbl}, or have a
|
in @filepath{.rkt}, end in @filepath{.scrbl}, or have a (possibly
|
||||||
(possibly empty) list of arguments-line provided by
|
empty) list of command-line arguments provided by
|
||||||
@racket[test-command-line-arguments] in an @filepath{info.rkt} file.
|
@racket[test-command-line-arguments] in an @filepath{info.rkt} file.
|
||||||
|
At the same time, @exec{raco test} omits files and directories within
|
||||||
|
a directory as directed by @racket[test-omit-paths] in an
|
||||||
|
@filepath{info.rkt} file.
|
||||||
|
|
||||||
A test is counted as failing if it logs a failing test code via
|
A test is counted as failing if it logs a failing test code via
|
||||||
@racket[test-log!], causes Racket to exit with a non-zero exit code, or
|
@racket[test-log!], causes Racket to exit with a non-zero exit code, or
|
||||||
|
@ -33,24 +36,27 @@ The @exec{raco test} command accepts several flags:
|
||||||
@itemize[
|
@itemize[
|
||||||
|
|
||||||
@item{@Flag{c} or @DFlag{collection}
|
@item{@Flag{c} or @DFlag{collection}
|
||||||
--- Interprets the arguments as collections where whose files should be tested.}
|
--- Interprets the arguments as collections whose content
|
||||||
|
should be tested (in the same way as directory content).}
|
||||||
|
|
||||||
@item{@Flag{p} or @DFlag{package}
|
@item{@Flag{p} or @DFlag{package}
|
||||||
--- Interprets the arguments as packages whose files should
|
--- Interprets the arguments as packages whose contents should
|
||||||
be tested. (All package scopes are searched for the first, most
|
be tested (in the same way as directory content). All package
|
||||||
specific package.)}
|
scopes are searched for the first, most specific @tech[#:doc
|
||||||
|
'(lib "pkg/scribblings/pkg.scrbl")]{package scope}.}
|
||||||
|
|
||||||
@item{@Flag{l} or @DFlag{lib}
|
@item{@Flag{l} or @DFlag{lib}
|
||||||
--- Interprets the arguments as packages whose libraries to be tested.}
|
--- Interprets the arguments as libraries that should be tested.}
|
||||||
|
|
||||||
@item{@Flag{m} or @DFlag{modules}
|
@item{@Flag{m} or @DFlag{modules}
|
||||||
--- Not only interprets the arguments as paths (which is the
|
--- Not only interprets the arguments as paths (which is the
|
||||||
default mode), but treats them the same as a path found in a
|
default mode), but treats them the same as paths found in a
|
||||||
directory, which means ignoring a file argument that does not
|
directory, which means ignoring a file argument that does not
|
||||||
have the extension @filepath{.rkt}, have the extension
|
have the extension @filepath{.rkt}, does not have the extension
|
||||||
@filepath{.scrbl}, or is enabled explicitly via
|
@filepath{.scrbl}, or is not enabled explicitly via
|
||||||
@racket[test-command-line-arguments] in an @filepath{info.rkt}
|
@racket[test-command-line-arguments] in an @filepath{info.rkt}
|
||||||
file.}
|
file; meanwhile, paths that are otherwise enabled can be disabled
|
||||||
|
via @racket[test-omit-paths] in an @filepath{info.rkt} file.}
|
||||||
|
|
||||||
@item{@DFlag{drdr}
|
@item{@DFlag{drdr}
|
||||||
--- Configures defaults to imitate the DrDr continuous testing
|
--- Configures defaults to imitate the DrDr continuous testing
|
||||||
|
@ -60,7 +66,7 @@ The @exec{raco test} command accepts several flags:
|
||||||
create a fresh @envvar{PLTUSERHOME} and @envvar{TMPDIR} for each test,
|
create a fresh @envvar{PLTUSERHOME} and @envvar{TMPDIR} for each test,
|
||||||
count stderr output as a test failure,
|
count stderr output as a test failure,
|
||||||
quiet program output,
|
quiet program output,
|
||||||
provide program empty input,
|
provide empty program input,
|
||||||
and print a table of results.}
|
and print a table of results.}
|
||||||
|
|
||||||
@item{@Flag{s} @nonterm{name} or @DFlag{submodule} @nonterm{name}
|
@item{@Flag{s} @nonterm{name} or @DFlag{submodule} @nonterm{name}
|
||||||
|
@ -111,7 +117,7 @@ The @exec{raco test} command accepts several flags:
|
||||||
directory and sets @envvar{PLTUSERHOME} and @envvar{TMPDIR}. The
|
directory and sets @envvar{PLTUSERHOME} and @envvar{TMPDIR}. The
|
||||||
@envvar{PLTADDONDIR} environment variable is also set so that
|
@envvar{PLTADDONDIR} environment variable is also set so that
|
||||||
the add-on directory (which is where packages are installed, for
|
the add-on directory (which is where packages are installed, for
|
||||||
example), does @emph{not} change for each test process.}
|
example) does @emph{not} change for each test process.}
|
||||||
|
|
||||||
@item{@DFlag{empty-stdin}
|
@item{@DFlag{empty-stdin}
|
||||||
--- provide an empty stdin to each test program.}
|
--- provide an empty stdin to each test program.}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user