test - Supporting packages in raco test
This commit is contained in:
parent
3e0fff7dff
commit
9015c15eec
|
@ -2,11 +2,11 @@
|
||||||
(require racket/cmdline
|
(require racket/cmdline
|
||||||
racket/match
|
racket/match
|
||||||
racket/path
|
racket/path
|
||||||
raco/command-name)
|
raco/command-name
|
||||||
|
planet2/lib)
|
||||||
|
|
||||||
(define submodule 'test)
|
(define submodule 'test)
|
||||||
(define run-anyways? #t)
|
(define run-anyways? #t)
|
||||||
(define collections? #f)
|
|
||||||
|
|
||||||
(define (do-test e [check-suffix? #f])
|
(define (do-test e [check-suffix? #f])
|
||||||
(match e
|
(match e
|
||||||
|
@ -48,10 +48,28 @@
|
||||||
#:when (directory-exists? (build-path r c)))
|
#:when (directory-exists? (build-path r c)))
|
||||||
(build-path r c)))
|
(build-path r c)))
|
||||||
|
|
||||||
|
(define collections? #f)
|
||||||
|
(define packages? #f)
|
||||||
|
|
||||||
(define (do-test-wrap e)
|
(define (do-test-wrap e)
|
||||||
(cond
|
(cond
|
||||||
[collections?
|
[collections?
|
||||||
(for-each do-test (collection-paths e))]
|
(match (collection-paths e)
|
||||||
|
[(list)
|
||||||
|
(error 'test "Collection ~e is not installed" e)]
|
||||||
|
[l
|
||||||
|
(for-each do-test l)])]
|
||||||
|
[packages?
|
||||||
|
(unless
|
||||||
|
(for*/or ([civs (in-list '(#t #f))]
|
||||||
|
[cisw (in-list '(#f #t))])
|
||||||
|
(define pd
|
||||||
|
(parameterize ([current-install-version-specific? civs]
|
||||||
|
[current-install-system-wide? cisw])
|
||||||
|
(with-handlers ([exn:fail? (λ (x) #f)])
|
||||||
|
(package-directory e))))
|
||||||
|
(and pd (do-test pd)))
|
||||||
|
(error 'test "Package ~e is not installed" e))]
|
||||||
[else
|
[else
|
||||||
(do-test e)]))
|
(do-test e)]))
|
||||||
|
|
||||||
|
@ -67,8 +85,12 @@
|
||||||
[("--no-run-if-absent" "-x")
|
[("--no-run-if-absent" "-x")
|
||||||
"Require nothing if submodule is absent"
|
"Require nothing if submodule is absent"
|
||||||
(set! run-anyways? #f)]
|
(set! run-anyways? #f)]
|
||||||
|
#:once-any
|
||||||
[("--collection" "-c")
|
[("--collection" "-c")
|
||||||
"Interpret arguments as collections"
|
"Interpret arguments as collections"
|
||||||
(set! collections? #t)]
|
(set! collections? #t)]
|
||||||
|
[("--package" "-p")
|
||||||
|
"Interpret arguments as packages"
|
||||||
|
(set! packages? #t)]
|
||||||
#:args file-or-directory
|
#:args file-or-directory
|
||||||
(for-each do-test-wrap file-or-directory))
|
(for-each do-test-wrap file-or-directory))
|
||||||
|
|
|
@ -305,8 +305,6 @@
|
||||||
(struct-copy install-info if
|
(struct-copy install-info if
|
||||||
[checksum op]))
|
[checksum op]))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(define (package-directory pkg-name)
|
(define (package-directory pkg-name)
|
||||||
(match-define (pkg-info orig-pkg checksum _)
|
(match-define (pkg-info orig-pkg checksum _)
|
||||||
(package-info pkg-name))
|
(package-info pkg-name))
|
||||||
|
@ -1165,6 +1163,8 @@
|
||||||
(parameter/c string?)]
|
(parameter/c string?)]
|
||||||
[current-pkg-error
|
[current-pkg-error
|
||||||
(parameter/c procedure?)]
|
(parameter/c procedure?)]
|
||||||
|
[package-directory
|
||||||
|
(-> string? path-string?)]
|
||||||
[pkg-desc
|
[pkg-desc
|
||||||
(-> string?
|
(-> string?
|
||||||
(or/c #f 'file 'dir 'link 'file-url 'dir-url 'github 'name)
|
(or/c #f 'file 'dir 'link 'file-url 'dir-url 'github 'name)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require scribble/manual "common.rkt")
|
@(require scribble/manual "common.rkt")
|
||||||
|
|
||||||
@title[#:tag "pkg"]{@exec{raco pkg}: Planet 2 Package Management}
|
@title[#:tag "pkg"]{@exec{raco pkg}: Package Management}
|
||||||
|
|
||||||
See @other-manual['(lib "planet2/scribblings/planet2.scrbl")] for
|
See @other-manual['(lib "planet2/scribblings/planet2.scrbl")] for
|
||||||
information on the @exec{raco pkg} command, which is used for
|
information on the @exec{raco pkg} command, which is used for
|
||||||
managing external code packages with Planet 2.
|
managing external code packages.
|
||||||
|
|
|
@ -28,4 +28,7 @@ The @exec{raco test} command accepts a few flags:
|
||||||
|
|
||||||
@item{@Flag{c} or @DFlag{collection}
|
@item{@Flag{c} or @DFlag{collection}
|
||||||
--- Intreprets the arguments as collections where all files should be tested.}
|
--- Intreprets the arguments as collections where all files should be tested.}
|
||||||
|
|
||||||
|
@item{@Flag{p} or @DFlag{package}
|
||||||
|
--- Intreprets the arguments as packages where all files should be tested. (All package scopes are searched for the first, most specific package.)}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user