From 35a228c1e46b25e18191ce4ee2de7dcfd142c6f9 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 8 Nov 2017 15:45:28 +0100 Subject: [PATCH 1/6] Remove vulpix test names dependence on reflection --- compiler/test/dotc/comptest.scala | 4 +- .../dotty/tools/dotc/CompilationTests.scala | 14 ++++- .../dotty/tools/dotc/IdempotencyTests.scala | 15 +++-- .../dotty/tools/dotc/LinkOptimiseTests.scala | 8 +-- .../dotty/tools/vulpix/ParallelTesting.scala | 62 +++++-------------- .../test/dotty/tools/vulpix/TestGroup.scala | 3 + .../test/dotty/tools/vulpix/VulpixTests.scala | 2 + 7 files changed, 46 insertions(+), 62 deletions(-) create mode 100644 compiler/test/dotty/tools/vulpix/TestGroup.scala diff --git a/compiler/test/dotc/comptest.scala b/compiler/test/dotc/comptest.scala index de9fb0b1e515..0bd9b6d53e3b 100644 --- a/compiler/test/dotc/comptest.scala +++ b/compiler/test/dotc/comptest.scala @@ -1,6 +1,6 @@ package dotc -import dotty.tools.vulpix.{ParallelTesting, TestFlags} +import dotty.tools.vulpix.{ParallelTesting, TestFlags, TestGroup} import scala.concurrent.duration._ @@ -26,5 +26,5 @@ object comptest extends ParallelTesting { ), TestFlags("", Array("-Ylog:frontend", "-Xprompt")), outDirectory = "." - ) + )(TestGroup("comptest")) } diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 53af559f0a86..13936427d704 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -33,10 +33,12 @@ class CompilationTests extends ParallelTesting { // @Test // enable to test compileStdLib separately with detailed stats def compileStdLib: Unit = { + implicit val testGroup: TestGroup = TestGroup("compileStdLib") compileList("compileStdLib", StdLibSources.whitelisted, scala2Mode.and("-migration", "-Yno-inline", "-Ydetailed-stats")) }.checkCompile() @Test def compilePos: Unit = { + implicit val testGroup: TestGroup = TestGroup("compilePos") compileList("compileStdLib", StdLibSources.whitelisted, scala2Mode.and("-migration", "-Yno-inline")) + compileDir("../compiler/src/dotty/tools/dotc/ast", defaultOptions) + compileDir("../compiler/src/dotty/tools/dotc/config", defaultOptions) + @@ -102,6 +104,7 @@ class CompilationTests extends ParallelTesting { }.checkCompile() @Test def posTwice: Unit = { + implicit val testGroup: TestGroup = TestGroup("posTwice") compileFile("../tests/pos/Labels.scala", defaultOptions) + compileFilesInDir("../tests/pos-java-interop", defaultOptions) + compileFile("../tests/pos/t2168.scala", defaultOptions) + @@ -160,6 +163,7 @@ class CompilationTests extends ParallelTesting { // Negative tests ------------------------------------------------------------ @Test def compileNeg: Unit = { + implicit val testGroup: TestGroup = TestGroup("compileNeg") compileShallowFilesInDir("../tests/neg", defaultOptions) + compileShallowFilesInDir("../tests/neg/no-optimise", defaultOptions) + compileFile("../tests/neg/customArgs/typers.scala", allowDoubleBindings) + @@ -189,6 +193,7 @@ class CompilationTests extends ParallelTesting { // Run tests ----------------------------------------------------------------- @Test def runAll: Unit = { + implicit val testGroup: TestGroup = TestGroup("runAll") compileFilesInDir("../tests/run", defaultOptions) + compileFilesInDir("../tests/run-no-optimise", defaultOptions) }.checkRuns() @@ -196,6 +201,7 @@ class CompilationTests extends ParallelTesting { // Generic java signatures tests --------------------------------------------- @Test def genericJavaSignatures: Unit = { + implicit val testGroup: TestGroup = TestGroup("genericJavaSignatures") compileFilesInDir("../tests/generic-java-signatures", defaultOptions) }.checkRuns() @@ -205,6 +211,7 @@ class CompilationTests extends ParallelTesting { // lower level of concurrency as to not kill their running VMs @Test def testPickling: Unit = { + implicit val testGroup: TestGroup = TestGroup("testPickling") compileDir("../compiler/src/dotty/tools", picklingOptions) + compileDir("../compiler/src/dotty/tools/dotc", picklingOptions) + compileFilesInDir("../tests/new", picklingOptions) + @@ -233,6 +240,8 @@ class CompilationTests extends ParallelTesting { * version of Dotty */ @Test def tastyBootstrap: Unit = { + implicit val testGroup: TestGroup = TestGroup("tastyBootstrap") + val opt = TestFlags( // compile with bootstrapped library on cp: defaultOutputDir + "lib/src/:" + @@ -267,14 +276,14 @@ class CompilationTests extends ParallelTesting { compileList( "dotty", compilerSources ++ backendSources ++ backendJvmSources, - opt) + opt)(TestGroup("dotty1")) } def dotty2 = { compileList( "dotty", compilerSources ++ backendSources ++ backendJvmSources, - opt) + opt)(TestGroup("dotty2")) } val tests = { @@ -305,6 +314,7 @@ class CompilationTests extends ParallelTesting { @Category(Array(classOf[SlowTests])) @Test def testOptimised: Unit = { + implicit val testGroup: TestGroup = TestGroup("testOptimised") val outputDir = defaultOutputDir + "optimised/" compileFilesInDir("../tests/pos", defaultOptimised, outputDir).checkCompile() compileFilesInDir("../tests/run", defaultOptimised, outputDir).checkRuns() diff --git a/compiler/test/dotty/tools/dotc/IdempotencyTests.scala b/compiler/test/dotty/tools/dotc/IdempotencyTests.scala index 5515e005b564..7789df75d620 100644 --- a/compiler/test/dotty/tools/dotc/IdempotencyTests.scala +++ b/compiler/test/dotty/tools/dotc/IdempotencyTests.scala @@ -10,7 +10,7 @@ import org.junit.{AfterClass, Test} import org.junit.experimental.categories.Category import scala.concurrent.duration._ -import vulpix.{ParallelTesting, SummaryReport, SummaryReporting, TestConfiguration} +import vulpix._ class IdempotencyTests extends ParallelTesting { @@ -27,7 +27,7 @@ class IdempotencyTests extends ParallelTesting { @Category(Array(classOf[SlowTests])) @Test def idempotency: Unit = { - + implicit val testGroup: TestGroup = TestGroup("idempotency") val opt = defaultOptions.and("-YemitTasty") def sourcesFrom(dir: Path) = CompilationTests.sources(Files.walk(dir)) @@ -37,9 +37,8 @@ class IdempotencyTests extends ParallelTesting { val strawmanSourcesRevSorted = strawmanSourcesSorted.reverse val posIdempotency = { - def posIdempotency1 = compileFilesInDir("../tests/pos", opt) - def posIdempotency2 = compileFilesInDir("../tests/pos", opt) - posIdempotency1 + posIdempotency2 + compileFilesInDir("../tests/pos", opt)(TestGroup("posIdempotency1")) + + compileFilesInDir("../tests/pos", opt)(TestGroup("posIdempotency2")) } val orderIdempotency = { @@ -47,8 +46,8 @@ class IdempotencyTests extends ParallelTesting { testDir <- new JFile("../tests/order-idempotency").listFiles() if testDir.isDirectory } yield { val sources = sourcesFrom(testDir.toPath) - def orderIdempotency1 = compileList(testDir.getName, sources, opt) - def orderIdempotency2 = compileList(testDir.getName, sources.reverse, opt) + def orderIdempotency1 = compileList(testDir.getName, sources, opt)(TestGroup("orderIdempotency1")) + def orderIdempotency2 = compileList(testDir.getName, sources.reverse, opt)(TestGroup("orderIdempotency2")) orderIdempotency1 + orderIdempotency2 }).reduce(_ + _) } @@ -62,7 +61,7 @@ class IdempotencyTests extends ParallelTesting { def check(name: String) = { val files = List(s"../tests/idempotency/$name.scala", "../tests/idempotency/IdempotencyCheck.scala") - compileList(name, files, defaultOptions) + compileList(name, files, defaultOptions)(TestGroup("check")) } val allChecks = { check("CheckOrderIdempotency") + diff --git a/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala b/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala index f01582eaf32b..e6ef73404a96 100644 --- a/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala +++ b/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala @@ -29,9 +29,9 @@ class LinkOptimiseTests extends ParallelTesting { @Test def linkOptimise: Unit = { // Setup and compile libraries def strawmanLibrary = - compileDir("../collection-strawman/collections/src/main", defaultOptions) + compileDir("../collection-strawman/collections/src/main", defaultOptions)(TestGroup("strawmanLibrary")) def linkCustomLib = - compileDir("../tests/link/custom-lib", defaultOptions) + compileDir("../tests/link/custom-lib", defaultOptions)(TestGroup("linkCustomLib")) val libraries = { strawmanLibrary + @@ -48,8 +48,8 @@ class LinkOptimiseTests extends ParallelTesting { val linkDir = "../tests/link" val linkStramanDir = linkDir + "/strawman" val linkCustomLibDir = linkDir + "/on-custom-lib" - def linkStrawmanTest = compileFilesInDir(linkStramanDir, strawmanClassPath) - def linkCustomLibTest = compileFilesInDir(linkCustomLibDir, customLibClassFlags) + def linkStrawmanTest = compileFilesInDir(linkStramanDir, strawmanClassPath)(TestGroup("linkStrawmanTest")) + def linkCustomLibTest = compileFilesInDir(linkCustomLibDir, customLibClassFlags)(TestGroup("linkCustomLibTest")) def classFileChecks(sourceDir: String, testName: String) = { val checkExt = ".classcheck" diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index 13de0f45d7c0..e7b7eda52ccb 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -1033,39 +1033,12 @@ trait ParallelTesting extends RunnerOrchestration { self => else (dirs, files) } - /** Gets the name of the calling method via reflection. - * - * It does this in a way that needs to work both with the bootstrapped dotty - * and the non-bootstrapped version. Since the two compilers generate - * different bridges, we first need to filter out methods with the same name - * (bridges) - and then find the `@Test` method in our extending class - */ - private def getCallingMethod(): String = { - val seen = mutable.Set.empty[String] - Thread.currentThread.getStackTrace - .filter { elem => - if (seen.contains(elem.getMethodName)) false - else { seen += elem.getMethodName; true } - } - .find { elem => - val callingClass = Class.forName(elem.getClassName) - classOf[ParallelTesting].isAssignableFrom(callingClass) && - elem.getFileName != "ParallelTesting.scala" - } - .map(_.getMethodName) - .getOrElse { - throw new IllegalStateException("Unable to reflectively find calling method") - } - .takeWhile(_ != '$') - } - /** Compiles a single file from the string path `f` using the supplied flags */ - def compileFile(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir): CompilationTest = { - val callingMethod = getCallingMethod() + def compileFile(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { val sourceFile = new JFile(f) val parent = sourceFile.getParentFile val outDir = - outDirectory + callingMethod + "/" + + outDirectory + testGroup.name + "/" + sourceFile.getName.substring(0, sourceFile.getName.lastIndexOf('.')) + "/" require( @@ -1075,7 +1048,7 @@ trait ParallelTesting extends RunnerOrchestration { self => ) val target = JointCompilationSource( - callingMethod, + testGroup.name, Array(sourceFile), flags, createOutputDirsForFile(sourceFile, parent, outDir) @@ -1090,9 +1063,8 @@ trait ParallelTesting extends RunnerOrchestration { self => * By default, files are compiled in alphabetical order. An optional seed * can be used for randomization. */ - def compileDir(f: String, flags: TestFlags, randomOrder: Option[Int] = None, outDirectory: String = defaultOutputDir): CompilationTest = { - val callingMethod = getCallingMethod() - val outDir = outDirectory + callingMethod + "/" + def compileDir(f: String, flags: TestFlags, randomOrder: Option[Int] = None, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { + val outDir = outDirectory + testGroup.name + "/" val sourceDir = new JFile(f) checkRequirements(f, sourceDir, outDir) @@ -1111,7 +1083,7 @@ trait ParallelTesting extends RunnerOrchestration { self => val targetDir = new JFile(outDir + "/" + sourceDir.getName + "/") targetDir.mkdirs() - val target = JointCompilationSource(s"compiling '$f' in test '$callingMethod'", randomized, flags, targetDir) + val target = JointCompilationSource(s"compiling '$f' in test '${testGroup.name}'", randomized, flags, targetDir) new CompilationTest(target) } @@ -1119,15 +1091,15 @@ trait ParallelTesting extends RunnerOrchestration { self => * `testName` since files can be in separate directories and or be otherwise * dissociated */ - def compileList(testName: String, files: List[String], flags: TestFlags, callingMethod: String = getCallingMethod(), outDirectory: String = defaultOutputDir): CompilationTest = { - val outDir = outDirectory + callingMethod + "/" + testName + "/" + def compileList(testName: String, files: List[String], flags: TestFlags, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { + val outDir = outDirectory + testGroup.name + "/" + testName + "/" // Directories in which to compile all containing files with `flags`: val targetDir = new JFile(outDir) targetDir.mkdirs() assert(targetDir.exists, s"couldn't create target directory: $targetDir") - val target = JointCompilationSource(s"$testName from $callingMethod", files.map(new JFile(_)).toArray, flags, targetDir) + val target = JointCompilationSource(s"$testName from ${testGroup.name}", files.map(new JFile(_)).toArray, flags, targetDir) // Create a CompilationTest and let the user decide whether to execute a pos or a neg test new CompilationTest(target) @@ -1150,17 +1122,16 @@ trait ParallelTesting extends RunnerOrchestration { self => * - Directories can have an associated check-file, where the check file has * the same name as the directory (with the file extension `.check`) */ - def compileFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir): CompilationTest = { - val callingMethod = getCallingMethod() - val outDir = outDirectory + callingMethod + "/" + def compileFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { + val outDir = outDirectory + testGroup.name + "/" val sourceDir = new JFile(f) checkRequirements(f, sourceDir, outDir) val (dirs, files) = compilationTargets(sourceDir) val targets = - files.map(f => JointCompilationSource(callingMethod, Array(f), flags, createOutputDirsForFile(f, sourceDir, outDir))) ++ - dirs.map(dir => SeparateCompilationSource(callingMethod, dir, flags, createOutputDirsForDir(dir, sourceDir, outDir))) + files.map(f => JointCompilationSource(testGroup.name, Array(f), flags, createOutputDirsForFile(f, sourceDir, outDir))) ++ + dirs.map(dir => SeparateCompilationSource(testGroup.name, dir, flags, createOutputDirsForDir(dir, sourceDir, outDir))) // Create a CompilationTest and let the user decide whether to execute a pos or a neg test new CompilationTest(targets) @@ -1170,16 +1141,15 @@ trait ParallelTesting extends RunnerOrchestration { self => * sub-directories and as such, does **not** perform separate compilation * tests. */ - def compileShallowFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir): CompilationTest = { - val callingMethod = getCallingMethod() - val outDir = outDirectory + callingMethod + "/" + def compileShallowFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { + val outDir = outDirectory + testGroup.name + "/" val sourceDir = new JFile(f) checkRequirements(f, sourceDir, outDir) val (_, files) = compilationTargets(sourceDir) val targets = files.map { file => - JointCompilationSource(callingMethod, Array(file), flags, createOutputDirsForFile(file, sourceDir, outDir)) + JointCompilationSource(testGroup.name, Array(file), flags, createOutputDirsForFile(file, sourceDir, outDir)) } // Create a CompilationTest and let the user decide whether to execute a pos or a neg test diff --git a/compiler/test/dotty/tools/vulpix/TestGroup.scala b/compiler/test/dotty/tools/vulpix/TestGroup.scala new file mode 100644 index 000000000000..cc92117a073a --- /dev/null +++ b/compiler/test/dotty/tools/vulpix/TestGroup.scala @@ -0,0 +1,3 @@ +package dotty.tools.vulpix + +case class TestGroup(name: String) extends AnyVal diff --git a/compiler/test/dotty/tools/vulpix/VulpixTests.scala b/compiler/test/dotty/tools/vulpix/VulpixTests.scala index 1c9c4f1f75e6..3adb7b6dcc9a 100644 --- a/compiler/test/dotty/tools/vulpix/VulpixTests.scala +++ b/compiler/test/dotty/tools/vulpix/VulpixTests.scala @@ -13,6 +13,8 @@ class VulpixTests extends ParallelTesting { implicit val _: SummaryReporting = new NoSummaryReport + implicit def testGroup: TestGroup = TestGroup("VulpixTests") + def maxDuration = 3.seconds def numberOfSlaves = 5 def safeMode = sys.env.get("SAFEMODE").isDefined From e465f26dbfcdd1ca00558491511feab79ccf5cc9 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 8 Nov 2017 16:08:28 +0100 Subject: [PATCH 2/6] Cleanup tests based on multiple test groups --- .../dotty/tools/dotc/CompilationTests.scala | 31 +++++++------------ .../dotty/tools/dotc/IdempotencyTests.scala | 5 ++- .../dotty/tools/dotc/LinkOptimiseTests.scala | 25 +++++++++------ .../test/dotty/tools/vulpix/TestGroup.scala | 4 ++- 4 files changed, 32 insertions(+), 33 deletions(-) diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 13936427d704..8849152b476a 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -241,19 +241,22 @@ class CompilationTests extends ParallelTesting { */ @Test def tastyBootstrap: Unit = { implicit val testGroup: TestGroup = TestGroup("tastyBootstrap") + val dotty1Group = TestGroup("dotty1") + val dotty2Group = TestGroup("dotty2") + val libGroup = TestGroup("lib") val opt = TestFlags( // compile with bootstrapped library on cp: - defaultOutputDir + "lib/src/:" + + defaultOutputDir + libGroup.name + "/src/:" + // as well as bootstrapped compiler: - defaultOutputDir + "dotty1/dotty/:" + + defaultOutputDir + dotty1Group.name + "/dotty/:" + Jars.dottyInterfaces, Array("-Ycheck-reentrant") ) - def lib = + val lib = compileDir("../library/src", - defaultOptions.and("-Ycheck-reentrant", "-strict", "-priorityclasspath", defaultOutputDir)) + defaultOptions.and("-Ycheck-reentrant", "-strict", "-priorityclasspath", defaultOutputDir))(libGroup) val compilerDir = Paths.get("../compiler/src") val compilerSources = sources(Files.walk(compilerDir)) @@ -272,19 +275,8 @@ class CompilationTests extends ParallelTesting { val backendJvmSources = sources(Files.list(backendJvmDir), excludedFiles = backendJvmExcluded) - def dotty1 = { - compileList( - "dotty", - compilerSources ++ backendSources ++ backendJvmSources, - opt)(TestGroup("dotty1")) - } - - def dotty2 = { - compileList( - "dotty", - compilerSources ++ backendSources ++ backendJvmSources, - opt)(TestGroup("dotty2")) - } + val dotty1 = compileList("dotty", compilerSources ++ backendSources ++ backendJvmSources, opt)(dotty1Group) + val dotty2 = compileList("dotty", compilerSources ++ backendSources ++ backendJvmSources, opt)(dotty2Group) val tests = { lib.keepOutput :: dotty1.keepOutput :: { @@ -305,8 +297,9 @@ class CompilationTests extends ParallelTesting { }.keepOutput :: Nil }.map(_.checkCompile()) - assert(new java.io.File("../out/dotty1/dotty/").exists) - assert(new java.io.File("../out/dotty2/dotty/").exists) + assert(new java.io.File(s"../out/${dotty1Group.name}/dotty/").exists) + assert(new java.io.File(s"../out/${dotty2Group.name}/dotty/").exists) + assert(new java.io.File(s"../out/${libGroup.name}/src/").exists) compileList("idempotency", List("../tests/idempotency/BootstrapChecker.scala", "../tests/idempotency/IdempotencyCheck.scala"), defaultOptions).checkRuns() tests.foreach(_.delete()) diff --git a/compiler/test/dotty/tools/dotc/IdempotencyTests.scala b/compiler/test/dotty/tools/dotc/IdempotencyTests.scala index 7789df75d620..6a88fa38cd63 100644 --- a/compiler/test/dotty/tools/dotc/IdempotencyTests.scala +++ b/compiler/test/dotty/tools/dotc/IdempotencyTests.scala @@ -46,9 +46,8 @@ class IdempotencyTests extends ParallelTesting { testDir <- new JFile("../tests/order-idempotency").listFiles() if testDir.isDirectory } yield { val sources = sourcesFrom(testDir.toPath) - def orderIdempotency1 = compileList(testDir.getName, sources, opt)(TestGroup("orderIdempotency1")) - def orderIdempotency2 = compileList(testDir.getName, sources.reverse, opt)(TestGroup("orderIdempotency2")) - orderIdempotency1 + orderIdempotency2 + compileList(testDir.getName, sources, opt)(TestGroup("orderIdempotency1")) + + compileList(testDir.getName, sources.reverse, opt)(TestGroup("orderIdempotency2")) }).reduce(_ + _) } diff --git a/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala b/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala index e6ef73404a96..103bba50fc16 100644 --- a/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala +++ b/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala @@ -28,10 +28,14 @@ class LinkOptimiseTests extends ParallelTesting { @Test def linkOptimise: Unit = { // Setup and compile libraries - def strawmanLibrary = - compileDir("../collection-strawman/collections/src/main", defaultOptions)(TestGroup("strawmanLibrary")) - def linkCustomLib = - compileDir("../tests/link/custom-lib", defaultOptions)(TestGroup("linkCustomLib")) + val strawmanLibGroup = TestGroup("strawmanLibrary") + val strawmanLibTestGroup = TestGroup(strawmanLibGroup.name + "/tests") + + val linkCustomLibGroup = TestGroup("linkCustomLib") + val linkCustomLibTestGroup = TestGroup(linkCustomLibGroup.name + "/tests") + + val strawmanLibrary = compileDir("../collection-strawman/collections/src/main", defaultOptions)(strawmanLibGroup) + val linkCustomLib = compileDir("../tests/link/custom-lib", defaultOptions)(linkCustomLibGroup) val libraries = { strawmanLibrary + @@ -41,15 +45,16 @@ class LinkOptimiseTests extends ParallelTesting { // Setup class paths def mkLinkClassFlags(libPath: String) = TestFlags(mkClassPath(libPath :: Jars.dottyTestDeps), mkClassPath(Jars.dottyTestDeps), basicDefaultOptions :+ "-Xlink-optimise") - val strawmanClassPath = mkLinkClassFlags(defaultOutputDir + "strawmanLibrary/main/") - val customLibClassFlags = mkLinkClassFlags(defaultOutputDir + "linkCustomLib/custom-lib") + val strawmanClassPath = mkLinkClassFlags(defaultOutputDir + strawmanLibGroup.name + "/main/") + val customLibClassFlags = mkLinkClassFlags(defaultOutputDir + linkCustomLibGroup.name + "/custom-lib") // Link tests val linkDir = "../tests/link" val linkStramanDir = linkDir + "/strawman" val linkCustomLibDir = linkDir + "/on-custom-lib" - def linkStrawmanTest = compileFilesInDir(linkStramanDir, strawmanClassPath)(TestGroup("linkStrawmanTest")) - def linkCustomLibTest = compileFilesInDir(linkCustomLibDir, customLibClassFlags)(TestGroup("linkCustomLibTest")) + + val linkStrawmanTest = compileFilesInDir(linkStramanDir, strawmanClassPath)(strawmanLibTestGroup) + val linkCustomLibTest = compileFilesInDir(linkCustomLibDir, customLibClassFlags)(linkCustomLibTestGroup) def classFileChecks(sourceDir: String, testName: String) = { val checkExt = ".classcheck" @@ -73,8 +78,8 @@ class LinkOptimiseTests extends ParallelTesting { }.keepOutput.checkRuns() try { - classFileChecks(linkStramanDir, "linkStrawmanTest") - classFileChecks(linkCustomLibDir, "linkCustomLibTest") + classFileChecks(linkStramanDir, strawmanLibTestGroup.name) + classFileChecks(linkCustomLibDir, linkCustomLibTestGroup.name) } finally { (libraries + tests).delete() } diff --git a/compiler/test/dotty/tools/vulpix/TestGroup.scala b/compiler/test/dotty/tools/vulpix/TestGroup.scala index cc92117a073a..f3697ad5b352 100644 --- a/compiler/test/dotty/tools/vulpix/TestGroup.scala +++ b/compiler/test/dotty/tools/vulpix/TestGroup.scala @@ -1,3 +1,5 @@ package dotty.tools.vulpix -case class TestGroup(name: String) extends AnyVal +case class TestGroup(name: String) extends AnyVal { + override def toString: String = name +} From 162867f5bafeb6effb174fd63523356094eedb3a Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 8 Nov 2017 16:55:30 +0100 Subject: [PATCH 3/6] Shorten code with TestGroups --- .../test/dotty/tools/dotc/CompilationTests.scala | 10 +++++----- .../test/dotty/tools/dotc/LinkOptimiseTests.scala | 8 ++++---- .../test/dotty/tools/vulpix/ParallelTesting.scala | 14 +++++++------- compiler/test/dotty/tools/vulpix/TestGroup.scala | 6 +++++- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 8849152b476a..1252732ce4b8 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -247,9 +247,9 @@ class CompilationTests extends ParallelTesting { val opt = TestFlags( // compile with bootstrapped library on cp: - defaultOutputDir + libGroup.name + "/src/:" + + defaultOutputDir + libGroup + "/src/:" + // as well as bootstrapped compiler: - defaultOutputDir + dotty1Group.name + "/dotty/:" + + defaultOutputDir + dotty1Group + "/dotty/:" + Jars.dottyInterfaces, Array("-Ycheck-reentrant") ) @@ -297,9 +297,9 @@ class CompilationTests extends ParallelTesting { }.keepOutput :: Nil }.map(_.checkCompile()) - assert(new java.io.File(s"../out/${dotty1Group.name}/dotty/").exists) - assert(new java.io.File(s"../out/${dotty2Group.name}/dotty/").exists) - assert(new java.io.File(s"../out/${libGroup.name}/src/").exists) + assert(new java.io.File(s"../out/$dotty1Group/dotty/").exists) + assert(new java.io.File(s"../out/$dotty2Group/dotty/").exists) + assert(new java.io.File(s"../out/$libGroup/src/").exists) compileList("idempotency", List("../tests/idempotency/BootstrapChecker.scala", "../tests/idempotency/IdempotencyCheck.scala"), defaultOptions).checkRuns() tests.foreach(_.delete()) diff --git a/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala b/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala index 103bba50fc16..d7ee97f33008 100644 --- a/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala +++ b/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala @@ -29,10 +29,10 @@ class LinkOptimiseTests extends ParallelTesting { @Test def linkOptimise: Unit = { // Setup and compile libraries val strawmanLibGroup = TestGroup("strawmanLibrary") - val strawmanLibTestGroup = TestGroup(strawmanLibGroup.name + "/tests") + val strawmanLibTestGroup = TestGroup(strawmanLibGroup + "/tests") val linkCustomLibGroup = TestGroup("linkCustomLib") - val linkCustomLibTestGroup = TestGroup(linkCustomLibGroup.name + "/tests") + val linkCustomLibTestGroup = TestGroup(linkCustomLibGroup + "/tests") val strawmanLibrary = compileDir("../collection-strawman/collections/src/main", defaultOptions)(strawmanLibGroup) val linkCustomLib = compileDir("../tests/link/custom-lib", defaultOptions)(linkCustomLibGroup) @@ -45,8 +45,8 @@ class LinkOptimiseTests extends ParallelTesting { // Setup class paths def mkLinkClassFlags(libPath: String) = TestFlags(mkClassPath(libPath :: Jars.dottyTestDeps), mkClassPath(Jars.dottyTestDeps), basicDefaultOptions :+ "-Xlink-optimise") - val strawmanClassPath = mkLinkClassFlags(defaultOutputDir + strawmanLibGroup.name + "/main/") - val customLibClassFlags = mkLinkClassFlags(defaultOutputDir + linkCustomLibGroup.name + "/custom-lib") + val strawmanClassPath = mkLinkClassFlags(defaultOutputDir + strawmanLibGroup + "/main/") + val customLibClassFlags = mkLinkClassFlags(defaultOutputDir + linkCustomLibGroup + "/custom-lib") // Link tests val linkDir = "../tests/link" diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index e7b7eda52ccb..4351b2ef7a0b 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -1038,7 +1038,7 @@ trait ParallelTesting extends RunnerOrchestration { self => val sourceFile = new JFile(f) val parent = sourceFile.getParentFile val outDir = - outDirectory + testGroup.name + "/" + + outDirectory + testGroup + "/" + sourceFile.getName.substring(0, sourceFile.getName.lastIndexOf('.')) + "/" require( @@ -1064,7 +1064,7 @@ trait ParallelTesting extends RunnerOrchestration { self => * can be used for randomization. */ def compileDir(f: String, flags: TestFlags, randomOrder: Option[Int] = None, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { - val outDir = outDirectory + testGroup.name + "/" + val outDir = outDirectory + testGroup + "/" val sourceDir = new JFile(f) checkRequirements(f, sourceDir, outDir) @@ -1083,7 +1083,7 @@ trait ParallelTesting extends RunnerOrchestration { self => val targetDir = new JFile(outDir + "/" + sourceDir.getName + "/") targetDir.mkdirs() - val target = JointCompilationSource(s"compiling '$f' in test '${testGroup.name}'", randomized, flags, targetDir) + val target = JointCompilationSource(s"compiling '$f' in test '$testGroup'", randomized, flags, targetDir) new CompilationTest(target) } @@ -1092,14 +1092,14 @@ trait ParallelTesting extends RunnerOrchestration { self => * dissociated */ def compileList(testName: String, files: List[String], flags: TestFlags, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { - val outDir = outDirectory + testGroup.name + "/" + testName + "/" + val outDir = outDirectory + testGroup + "/" + testName + "/" // Directories in which to compile all containing files with `flags`: val targetDir = new JFile(outDir) targetDir.mkdirs() assert(targetDir.exists, s"couldn't create target directory: $targetDir") - val target = JointCompilationSource(s"$testName from ${testGroup.name}", files.map(new JFile(_)).toArray, flags, targetDir) + val target = JointCompilationSource(s"$testName from $testGroup", files.map(new JFile(_)).toArray, flags, targetDir) // Create a CompilationTest and let the user decide whether to execute a pos or a neg test new CompilationTest(target) @@ -1123,7 +1123,7 @@ trait ParallelTesting extends RunnerOrchestration { self => * the same name as the directory (with the file extension `.check`) */ def compileFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { - val outDir = outDirectory + testGroup.name + "/" + val outDir = outDirectory + testGroup + "/" val sourceDir = new JFile(f) checkRequirements(f, sourceDir, outDir) @@ -1142,7 +1142,7 @@ trait ParallelTesting extends RunnerOrchestration { self => * tests. */ def compileShallowFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { - val outDir = outDirectory + testGroup.name + "/" + val outDir = outDirectory + testGroup + "/" val sourceDir = new JFile(f) checkRequirements(f, sourceDir, outDir) diff --git a/compiler/test/dotty/tools/vulpix/TestGroup.scala b/compiler/test/dotty/tools/vulpix/TestGroup.scala index f3697ad5b352..e513905d0402 100644 --- a/compiler/test/dotty/tools/vulpix/TestGroup.scala +++ b/compiler/test/dotty/tools/vulpix/TestGroup.scala @@ -1,5 +1,9 @@ package dotty.tools.vulpix -case class TestGroup(name: String) extends AnyVal { +class TestGroup(val name: String) extends AnyVal { override def toString: String = name } + +object TestGroup { + def apply(name: String): TestGroup = new TestGroup(name) +} From f75bbdf763b7f7107dc38250fd085d53cb69653c Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 8 Nov 2017 17:18:31 +0100 Subject: [PATCH 4/6] Put related tests in same top level output directory --- .../test/dotty/tools/dotc/CompilationTests.scala | 8 ++++---- .../test/dotty/tools/dotc/IdempotencyTests.scala | 10 +++++----- .../{LinkOptimiseTests.scala => LinkTests.scala} | 12 ++++++------ tests/idempotency/BootstrapChecker.scala | 2 +- tests/idempotency/CheckOrderIdempotency.scala | 2 +- tests/idempotency/CheckPosIdempotency.scala | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) rename compiler/test/dotty/tools/dotc/{LinkOptimiseTests.scala => LinkTests.scala} (92%) diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 1252732ce4b8..e63a4b1ddf6f 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -240,10 +240,10 @@ class CompilationTests extends ParallelTesting { * version of Dotty */ @Test def tastyBootstrap: Unit = { - implicit val testGroup: TestGroup = TestGroup("tastyBootstrap") - val dotty1Group = TestGroup("dotty1") - val dotty2Group = TestGroup("dotty2") - val libGroup = TestGroup("lib") + implicit val testGroup: TestGroup = TestGroup("tastyBootstrap/tests") + val dotty1Group = TestGroup("tastyBootstrap/dotty1") + val dotty2Group = TestGroup("tastyBootstrap/dotty2") + val libGroup = TestGroup("tastyBootstrap/lib") val opt = TestFlags( // compile with bootstrapped library on cp: diff --git a/compiler/test/dotty/tools/dotc/IdempotencyTests.scala b/compiler/test/dotty/tools/dotc/IdempotencyTests.scala index 6a88fa38cd63..cd80f4e744c6 100644 --- a/compiler/test/dotty/tools/dotc/IdempotencyTests.scala +++ b/compiler/test/dotty/tools/dotc/IdempotencyTests.scala @@ -37,8 +37,8 @@ class IdempotencyTests extends ParallelTesting { val strawmanSourcesRevSorted = strawmanSourcesSorted.reverse val posIdempotency = { - compileFilesInDir("../tests/pos", opt)(TestGroup("posIdempotency1")) + - compileFilesInDir("../tests/pos", opt)(TestGroup("posIdempotency2")) + compileFilesInDir("../tests/pos", opt)(TestGroup("idempotency/posIdempotency1")) + + compileFilesInDir("../tests/pos", opt)(TestGroup("idempotency/posIdempotency2")) } val orderIdempotency = { @@ -46,8 +46,8 @@ class IdempotencyTests extends ParallelTesting { testDir <- new JFile("../tests/order-idempotency").listFiles() if testDir.isDirectory } yield { val sources = sourcesFrom(testDir.toPath) - compileList(testDir.getName, sources, opt)(TestGroup("orderIdempotency1")) + - compileList(testDir.getName, sources.reverse, opt)(TestGroup("orderIdempotency2")) + compileList(testDir.getName, sources, opt)(TestGroup("idempotency/orderIdempotency1")) + + compileList(testDir.getName, sources.reverse, opt)(TestGroup("idempotency/orderIdempotency2")) }).reduce(_ + _) } @@ -60,7 +60,7 @@ class IdempotencyTests extends ParallelTesting { def check(name: String) = { val files = List(s"../tests/idempotency/$name.scala", "../tests/idempotency/IdempotencyCheck.scala") - compileList(name, files, defaultOptions)(TestGroup("check")) + compileList(name, files, defaultOptions)(TestGroup("idempotency/check")) } val allChecks = { check("CheckOrderIdempotency") + diff --git a/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala b/compiler/test/dotty/tools/dotc/LinkTests.scala similarity index 92% rename from compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala rename to compiler/test/dotty/tools/dotc/LinkTests.scala index d7ee97f33008..d2c613341b6a 100644 --- a/compiler/test/dotty/tools/dotc/LinkOptimiseTests.scala +++ b/compiler/test/dotty/tools/dotc/LinkTests.scala @@ -12,10 +12,10 @@ import vulpix._ import scala.concurrent.duration._ import scala.collection.JavaConverters._ -class LinkOptimiseTests extends ParallelTesting { +class LinkTests extends ParallelTesting { import ParallelTesting._ import TestConfiguration._ - import LinkOptimiseTests._ + import LinkTests._ // Test suite configuration -------------------------------------------------- @@ -26,12 +26,12 @@ class LinkOptimiseTests extends ParallelTesting { def testFilter = Properties.testsFilter - @Test def linkOptimise: Unit = { + @Test def linkTest: Unit = { // Setup and compile libraries - val strawmanLibGroup = TestGroup("strawmanLibrary") + val strawmanLibGroup = TestGroup("linkTest/strawmanLibrary") val strawmanLibTestGroup = TestGroup(strawmanLibGroup + "/tests") - val linkCustomLibGroup = TestGroup("linkCustomLib") + val linkCustomLibGroup = TestGroup("linkTest/linkCustomLib") val linkCustomLibTestGroup = TestGroup(linkCustomLibGroup + "/tests") val strawmanLibrary = compileDir("../collection-strawman/collections/src/main", defaultOptions)(strawmanLibGroup) @@ -87,7 +87,7 @@ class LinkOptimiseTests extends ParallelTesting { } -object LinkOptimiseTests { +object LinkTests { implicit val summaryReport: SummaryReporting = new SummaryReport @AfterClass def cleanup(): Unit = summaryReport.echoSummary() } diff --git a/tests/idempotency/BootstrapChecker.scala b/tests/idempotency/BootstrapChecker.scala index 681172fec6d2..1ce18d1b0c38 100644 --- a/tests/idempotency/BootstrapChecker.scala +++ b/tests/idempotency/BootstrapChecker.scala @@ -1,5 +1,5 @@ object Test { def main(args: Array[String]): Unit = - IdempotencyCheck.checkIdempotency("../out/dotty1", "../out/dotty2") + IdempotencyCheck.checkIdempotency("../out/tastyBootstrap/dotty1", "../out/tastyBootstrap/dotty2") } diff --git a/tests/idempotency/CheckOrderIdempotency.scala b/tests/idempotency/CheckOrderIdempotency.scala index 9445565ba9cb..e9e05f526ace 100644 --- a/tests/idempotency/CheckOrderIdempotency.scala +++ b/tests/idempotency/CheckOrderIdempotency.scala @@ -1,5 +1,5 @@ object Test { def main(args: Array[String]): Unit = - IdempotencyCheck.checkIdempotency("../out/orderIdempotency1", "../out/orderIdempotency2") + IdempotencyCheck.checkIdempotency("../out/idempotency/orderIdempotency1", "../out/idempotency/orderIdempotency2") } diff --git a/tests/idempotency/CheckPosIdempotency.scala b/tests/idempotency/CheckPosIdempotency.scala index a40c2c579fc9..e07781db76c9 100644 --- a/tests/idempotency/CheckPosIdempotency.scala +++ b/tests/idempotency/CheckPosIdempotency.scala @@ -1,5 +1,5 @@ object Test { def main(args: Array[String]): Unit = - IdempotencyCheck.checkIdempotency("../out/posIdempotency1", "../out/posIdempotency2") + IdempotencyCheck.checkIdempotency("../out/idempotency/posIdempotency1", "../out/idempotency/posIdempotency2") } From 8f9c1b1fcc4329d52a24a2f34309e331508324f4 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 8 Nov 2017 17:50:01 +0100 Subject: [PATCH 5/6] Remove custom output directory from vulpix Use testGroup instead --- compiler/test/dotc/comptest.scala | 3 +-- .../dotty/tools/dotc/CompilationTests.scala | 9 ++++----- .../dotty/tools/vulpix/ParallelTesting.scala | 20 +++++++++---------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/compiler/test/dotc/comptest.scala b/compiler/test/dotc/comptest.scala index 0bd9b6d53e3b..64caa6293f63 100644 --- a/compiler/test/dotc/comptest.scala +++ b/compiler/test/dotc/comptest.scala @@ -24,7 +24,6 @@ object comptest extends ParallelTesting { dotcDir + "tools/dotc/core/Types.scala", dotcDir + "tools/dotc/ast/Trees.scala" ), - TestFlags("", Array("-Ylog:frontend", "-Xprompt")), - outDirectory = "." + TestFlags("", Array("-Ylog:frontend", "-Xprompt")) )(TestGroup("comptest")) } diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index e63a4b1ddf6f..cc69e927e26f 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -307,11 +307,10 @@ class CompilationTests extends ParallelTesting { @Category(Array(classOf[SlowTests])) @Test def testOptimised: Unit = { - implicit val testGroup: TestGroup = TestGroup("testOptimised") - val outputDir = defaultOutputDir + "optimised/" - compileFilesInDir("../tests/pos", defaultOptimised, outputDir).checkCompile() - compileFilesInDir("../tests/run", defaultOptimised, outputDir).checkRuns() - compileShallowFilesInDir("../tests/neg", defaultOptimised, outputDir).checkExpectedErrors() + implicit val testGroup: TestGroup = TestGroup("optimised/testOptimised") + compileFilesInDir("../tests/pos", defaultOptimised).checkCompile() + compileFilesInDir("../tests/run", defaultOptimised).checkRuns() + compileShallowFilesInDir("../tests/neg", defaultOptimised).checkExpectedErrors() } private val (compilerSources, backendSources, backendJvmSources) = { diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index 4351b2ef7a0b..1fc22e843c52 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -1034,11 +1034,11 @@ trait ParallelTesting extends RunnerOrchestration { self => } /** Compiles a single file from the string path `f` using the supplied flags */ - def compileFile(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { + def compileFile(f: String, flags: TestFlags)(implicit testGroup: TestGroup): CompilationTest = { val sourceFile = new JFile(f) val parent = sourceFile.getParentFile val outDir = - outDirectory + testGroup + "/" + + defaultOutputDir + testGroup + "/" + sourceFile.getName.substring(0, sourceFile.getName.lastIndexOf('.')) + "/" require( @@ -1063,8 +1063,8 @@ trait ParallelTesting extends RunnerOrchestration { self => * By default, files are compiled in alphabetical order. An optional seed * can be used for randomization. */ - def compileDir(f: String, flags: TestFlags, randomOrder: Option[Int] = None, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { - val outDir = outDirectory + testGroup + "/" + def compileDir(f: String, flags: TestFlags, randomOrder: Option[Int] = None)(implicit testGroup: TestGroup): CompilationTest = { + val outDir = defaultOutputDir + testGroup + "/" val sourceDir = new JFile(f) checkRequirements(f, sourceDir, outDir) @@ -1091,8 +1091,8 @@ trait ParallelTesting extends RunnerOrchestration { self => * `testName` since files can be in separate directories and or be otherwise * dissociated */ - def compileList(testName: String, files: List[String], flags: TestFlags, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { - val outDir = outDirectory + testGroup + "/" + testName + "/" + def compileList(testName: String, files: List[String], flags: TestFlags)(implicit testGroup: TestGroup): CompilationTest = { + val outDir = defaultOutputDir + testGroup + "/" + testName + "/" // Directories in which to compile all containing files with `flags`: val targetDir = new JFile(outDir) @@ -1122,8 +1122,8 @@ trait ParallelTesting extends RunnerOrchestration { self => * - Directories can have an associated check-file, where the check file has * the same name as the directory (with the file extension `.check`) */ - def compileFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { - val outDir = outDirectory + testGroup + "/" + def compileFilesInDir(f: String, flags: TestFlags)(implicit testGroup: TestGroup): CompilationTest = { + val outDir = defaultOutputDir + testGroup + "/" val sourceDir = new JFile(f) checkRequirements(f, sourceDir, outDir) @@ -1141,8 +1141,8 @@ trait ParallelTesting extends RunnerOrchestration { self => * sub-directories and as such, does **not** perform separate compilation * tests. */ - def compileShallowFilesInDir(f: String, flags: TestFlags, outDirectory: String = defaultOutputDir)(implicit testGroup: TestGroup): CompilationTest = { - val outDir = outDirectory + testGroup + "/" + def compileShallowFilesInDir(f: String, flags: TestFlags)(implicit testGroup: TestGroup): CompilationTest = { + val outDir = defaultOutputDir + testGroup + "/" val sourceDir = new JFile(f) checkRequirements(f, sourceDir, outDir) From feebf3be75517fe752d8970eaf890aecd8b0a50a Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 10 Nov 2017 17:39:38 +0100 Subject: [PATCH 6/6] Add documentation --- compiler/test/dotty/tools/vulpix/TestGroup.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/test/dotty/tools/vulpix/TestGroup.scala b/compiler/test/dotty/tools/vulpix/TestGroup.scala index e513905d0402..2e95583a3fd7 100644 --- a/compiler/test/dotty/tools/vulpix/TestGroup.scala +++ b/compiler/test/dotty/tools/vulpix/TestGroup.scala @@ -1,5 +1,11 @@ package dotty.tools.vulpix +/** Test groups are used to ensure that the ouput of tests do not overlap. + * + * It can be used to disambiguate ouputs of tests that test the same file but with different options as shown in the following example. + * compileFilesInDir("../tests/pos", defaultOptions)(TestGroup("compileStdLib")) // will output in ./out/compileStdLib/... + * compileFilesInDir("../tests/pos", defaultOptimised)(TestGroup("optimised/testOptimised")) // will output in ./out/optimised/testOptimised/... + */ class TestGroup(val name: String) extends AnyVal { override def toString: String = name }