Skip to content

Commit 7076c74

Browse files
committed
Replace testFromTasty with testCompilation --from-tasty
1 parent c4545a6 commit 7076c74

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
13911391
|Test '$title' compiled with $errors error(s) and $warnings warning(s),
13921392
|the test can be reproduced by running:
13931393
|
1394-
| sbt "testFromTasty $file"
1394+
| sbt "testCompilation --from-tasty $file"
13951395
|
13961396
|This tests can be disabled by adding `${file.getName}` to `compiler${JFile.separator}test${JFile.separator}dotc${JFile.separator}$runOrPos-$listName.blacklist`
13971397
|

docs/docs/contributing/testing.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,15 @@ To run `testCompilation` on a bootstrapped Dotty compiler, use
9292
`dotty-compiler-bootstrapped/testCompilation` (with the same syntax as above).
9393
Some tests can only be run in bootstrapped compilers; that includes all tests
9494
with `with-compiler` in their name.
95+
96+
### From TASTy tests
97+
98+
`testCompilation` has a additional mode to run tests that compile code from a `.tasty` file, decompile a `.tasty` file and recompile the decompiled tasty.
99+
Modify blacklist and whitelists in `compiler/test/dotc` to enable or disable tests from `.tasty` files.
100+
101+
```bash
102+
$ sbt
103+
> testCompilation --from-tasty
104+
```
105+
106+
This mode can be combined with `--update-checkfiles` to update the `.decompiled` files or can be run under `dotty-compiler-bootstrapped/testCompilation` to test on a bootstrapped Dotty compiler.

project/Build.scala

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ object Build {
8585
// Run tests with filter through vulpix test suite
8686
val testCompilation = inputKey[Unit]("runs integration test with the supplied filter")
8787

88-
// Run TASTY tests with filter through vulpix test suite
89-
val testFromTasty = inputKey[Unit]("runs tasty integration test with the supplied filter")
90-
9188
// Spawns a repl with the correct classpath
9289
val repl = inputKey[Unit]("run the REPL with correct classpath")
9390

@@ -438,16 +435,6 @@ object Build {
438435
case Bootstrapped => `dotty-doc-bootstrapped`
439436
}
440437

441-
def testOnlyFiltered(test: String, options: String) = Def.inputTaskDyn {
442-
val args = spaceDelimited("<arg>").parsed
443-
val updateCheckfile = args.contains("--update-checkfiles")
444-
val args1 = if (updateCheckfile) args.filter(_ != "--update-checkfiles") else args
445-
val cmd = s" $test -- $options" +
446-
(if (updateCheckfile) " -Ddotty.tests.updateCheckfiles=true" else "") +
447-
(if (args1.nonEmpty) " -Ddotty.tests.filter=" + args1.mkString(" ") else "")
448-
(testOnly in Test).toTask(cmd)
449-
}
450-
451438
def findLib(attList: Seq[Attributed[File]], name: String) = attList
452439
.map(_.data.getAbsolutePath)
453440
.find(_.contains(name))
@@ -548,8 +535,17 @@ object Build {
548535
jarOpts ::: tuning ::: agentOptions ::: ci_build
549536
},
550537

551-
testCompilation := testOnlyFiltered("dotty.tools.dotc.*CompilationTests", "--exclude-categories=dotty.SlowTests").evaluated,
552-
testFromTasty := testOnlyFiltered("dotty.tools.dotc.FromTastyTests", "").evaluated,
538+
testCompilation := Def.inputTaskDyn {
539+
val args = spaceDelimited("<arg>").parsed
540+
val updateCheckfile = args.contains("--update-checkfiles")
541+
val fromTasty = args.contains("--from-tasty")
542+
val args1 = if (updateCheckfile | fromTasty) args.filter(x => x != "--update-checkfiles" && x != "--from-tasty") else args
543+
val test = if (fromTasty) "dotty.tools.dotc.FromTastyTests" else "dotty.tools.dotc.*CompilationTests"
544+
val cmd = s" $test -- --exclude-categories=dotty.SlowTests" +
545+
(if (updateCheckfile) " -Ddotty.tests.updateCheckfiles=true" else "") +
546+
(if (args1.nonEmpty) " -Ddotty.tests.filter=" + args1.mkString(" ") else "")
547+
(testOnly in Test).toTask(cmd)
548+
}.evaluated,
553549

554550
dotr := {
555551
val args: List[String] = spaceDelimited("<arg>").parsed.toList

0 commit comments

Comments
 (0)