Skip to content

Commit 36774e6

Browse files
Merge pull request #6184 from dotty-staging/fix-#5906
Fix #5906: Add testCompilation --help
2 parents f7452c5 + b026ffe commit 36774e6

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

docs/docs/contributing/testing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ $ sbt
8686
> testCompilation --update-checkfiles
8787
```
8888

89+
Use `--help` to see all the options
90+
```bash
91+
$ sbt
92+
> testCompilation --help
93+
```
94+
8995
### Bootstrapped-only tests
9096

9197
To run `testCompilation` on a bootstrapped Dotty compiler, use

project/Build.scala

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,32 @@ object Build {
477477

478478
testCompilation := Def.inputTaskDyn {
479479
val args = spaceDelimited("<arg>").parsed
480-
val updateCheckfile = args.contains("--update-checkfiles")
481-
val fromTasty = args.contains("--from-tasty")
482-
val args1 = if (updateCheckfile | fromTasty) args.filter(x => x != "--update-checkfiles" && x != "--from-tasty") else args
483-
val test = if (fromTasty) "dotty.tools.dotc.FromTastyTests" else "dotty.tools.dotc.*CompilationTests"
484-
val cmd = s" $test -- --exclude-categories=dotty.SlowTests" +
485-
(if (updateCheckfile) " -Ddotty.tests.updateCheckfiles=TRUE" else "") +
486-
(if (args1.nonEmpty) " -Ddotty.tests.filter=" + args1.mkString(" ") else "")
487-
(testOnly in Test).toTask(cmd)
480+
if (args.contains("--help")) {
481+
println(
482+
s"""
483+
|usage: testCompilation [--help] [--from-tasty] [--update-checkfiles] [<filter>]
484+
|
485+
|By default runs tests in dotty.tools.dotc.*CompilationTests excluding tests tagged with dotty.SlowTests.
486+
|
487+
| --help show this message
488+
| --from-tasty runs tests in dotty.tools.dotc.FromTastyTests
489+
| --update-checkfiles override the checkfiles that did not match with the current output
490+
| <filter> substring of the path of the tests file
491+
|
492+
""".stripMargin
493+
)
494+
(testOnly in Test).toTask(" not.a.test")
495+
}
496+
else {
497+
val updateCheckfile = args.contains("--update-checkfiles")
498+
val fromTasty = args.contains("--from-tasty")
499+
val args1 = if (updateCheckfile | fromTasty) args.filter(x => x != "--update-checkfiles" && x != "--from-tasty") else args
500+
val test = if (fromTasty) "dotty.tools.dotc.FromTastyTests" else "dotty.tools.dotc.*CompilationTests"
501+
val cmd = s" $test -- --exclude-categories=dotty.SlowTests" +
502+
(if (updateCheckfile) " -Ddotty.tests.updateCheckfiles=TRUE" else "") +
503+
(if (args1.nonEmpty) " -Ddotty.tests.filter=" + args1.mkString(" ") else "")
504+
(testOnly in Test).toTask(cmd)
505+
}
488506
}.evaluated,
489507

490508
dotr := {

0 commit comments

Comments
 (0)