diff --git a/collects/compiler/commands/info.rkt b/collects/compiler/commands/info.rkt index e20ae53b7d..7d97e9d09c 100644 --- a/collects/compiler/commands/info.rkt +++ b/collects/compiler/commands/info.rkt @@ -6,6 +6,7 @@ ("pack" compiler/commands/pack "pack files/collections into a .plt archive" 10) ("unpack" compiler/commands/unpack "unpack files/collections from a .plt archive" 10) ("decompile" compiler/commands/decompile "decompile bytecode" #f) + ("test" compiler/commands/test "run all tests associated with a set of paths" #f) ("expand" compiler/commands/expand "macro-expand source" #f) ("distribute" compiler/commands/exe-dir "prepare executable(s) in a directory for distribution" #f) ("ctool" compiler/commands/ctool "compile and link C-based extensions" #f) diff --git a/collects/compiler/commands/test.rkt b/collects/compiler/commands/test.rkt new file mode 100644 index 0000000000..52a92bec9e --- /dev/null +++ b/collects/compiler/commands/test.rkt @@ -0,0 +1,28 @@ +#lang racket/base +(require racket/cmdline + racket/match + racket/path + raco/command-name) + +(define do-test + (match-lambda + [(? string? s) + (do-test (string->path s))] + [(? path? p) + (cond + [(directory-exists? p) + (for-each + (λ (dp) + (do-test (build-path p dp))) + (directory-list p))] + [(file-exists? p) + (define mod `(submod (file ,(path->string p)) test)) + (when (module-declared? mod #t) + (dynamic-require mod #f))] + [else + (error 'test "Given path ~e does not exist" p)])])) + +(command-line + #:program (short-program+command-name) + #:args files+directories + (for-each do-test files+directories)) diff --git a/collects/tests/compiler/test/a.rkt b/collects/tests/compiler/test/a.rkt new file mode 100644 index 0000000000..a8b4a5e6f7 --- /dev/null +++ b/collects/tests/compiler/test/a.rkt @@ -0,0 +1,4 @@ +#lang racket/base +(error 'dont-run) +(module test racket/base + (printf "a\n")) diff --git a/collects/tests/compiler/test/b.rkt b/collects/tests/compiler/test/b.rkt new file mode 100644 index 0000000000..dc1a6edb80 --- /dev/null +++ b/collects/tests/compiler/test/b.rkt @@ -0,0 +1,4 @@ +#lang racket/base +(error 'dont-run) +(module test racket/base + (printf "b\n")) diff --git a/collects/tests/compiler/test/d/c.rkt b/collects/tests/compiler/test/d/c.rkt new file mode 100644 index 0000000000..892e318617 --- /dev/null +++ b/collects/tests/compiler/test/d/c.rkt @@ -0,0 +1,4 @@ +#lang racket/base +(error 'dont-run) +(module test racket/base + (printf "c\n")) diff --git a/collects/tests/compiler/test/d/d.rkt b/collects/tests/compiler/test/d/d.rkt new file mode 100644 index 0000000000..7bc35af1c4 --- /dev/null +++ b/collects/tests/compiler/test/d/d.rkt @@ -0,0 +1 @@ +#lang racket/base