Skip to content

Remove vulpix reflective nightmare #3445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions compiler/test/dotc/comptest.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dotc

import dotty.tools.vulpix.{ParallelTesting, TestFlags}
import dotty.tools.vulpix.{ParallelTesting, TestFlags, TestGroup}

import scala.concurrent.duration._

Expand All @@ -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"))
}
48 changes: 25 additions & 23 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to give an explicit type signature here because the implicit val is in a def.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want me to remove them? I added them to avoid warnings from the IDE.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your call.

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) +
Expand Down Expand Up @@ -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) +
Expand Down Expand Up @@ -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) +
Expand Down Expand Up @@ -189,13 +193,15 @@ 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()

// Generic java signatures tests ---------------------------------------------

@Test def genericJavaSignatures: Unit = {
implicit val testGroup: TestGroup = TestGroup("genericJavaSignatures")
compileFilesInDir("../tests/generic-java-signatures", defaultOptions)
}.checkRuns()

Expand All @@ -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) +
Expand Down Expand Up @@ -233,18 +240,23 @@ class CompilationTests extends ParallelTesting {
* version of Dotty
*/
@Test def tastyBootstrap: Unit = {
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:
defaultOutputDir + "lib/src/:" +
defaultOutputDir + libGroup + "/src/:" +
// as well as bootstrapped compiler:
defaultOutputDir + "dotty1/dotty/:" +
defaultOutputDir + dotty1Group + "/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))
Expand All @@ -263,19 +275,8 @@ class CompilationTests extends ParallelTesting {
val backendJvmSources =
sources(Files.list(backendJvmDir), excludedFiles = backendJvmExcluded)

def dotty1 = {
compileList(
"dotty",
compilerSources ++ backendSources ++ backendJvmSources,
opt)
}

def dotty2 = {
compileList(
"dotty",
compilerSources ++ backendSources ++ backendJvmSources,
opt)
}
val dotty1 = compileList("dotty", compilerSources ++ backendSources ++ backendJvmSources, opt)(dotty1Group)
val dotty2 = compileList("dotty", compilerSources ++ backendSources ++ backendJvmSources, opt)(dotty2Group)

val tests = {
lib.keepOutput :: dotty1.keepOutput :: {
Expand All @@ -296,19 +297,20 @@ 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/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())
}

@Category(Array(classOf[SlowTests]))
@Test def testOptimised: Unit = {
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) = {
Expand Down
16 changes: 7 additions & 9 deletions compiler/test/dotty/tools/dotc/IdempotencyTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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))
Expand All @@ -37,19 +37,17 @@ 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("idempotency/posIdempotency1")) +
compileFilesInDir("../tests/pos", opt)(TestGroup("idempotency/posIdempotency2"))
}

val orderIdempotency = {
(for {
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)
orderIdempotency1 + orderIdempotency2
compileList(testDir.getName, sources, opt)(TestGroup("idempotency/orderIdempotency1")) +
compileList(testDir.getName, sources.reverse, opt)(TestGroup("idempotency/orderIdempotency2"))
}).reduce(_ + _)
}

Expand All @@ -62,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)
compileList(name, files, defaultOptions)(TestGroup("idempotency/check"))
}
val allChecks = {
check("CheckOrderIdempotency") +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 --------------------------------------------------

Expand All @@ -26,12 +26,16 @@ class LinkOptimiseTests extends ParallelTesting {
def testFilter = Properties.testsFilter


@Test def linkOptimise: Unit = {
@Test def linkTest: Unit = {
// Setup and compile libraries
def strawmanLibrary =
compileDir("../collection-strawman/collections/src/main", defaultOptions)
def linkCustomLib =
compileDir("../tests/link/custom-lib", defaultOptions)
val strawmanLibGroup = TestGroup("linkTest/strawmanLibrary")
val strawmanLibTestGroup = TestGroup(strawmanLibGroup + "/tests")

val linkCustomLibGroup = TestGroup("linkTest/linkCustomLib")
val linkCustomLibTestGroup = TestGroup(linkCustomLibGroup + "/tests")

val strawmanLibrary = compileDir("../collection-strawman/collections/src/main", defaultOptions)(strawmanLibGroup)
val linkCustomLib = compileDir("../tests/link/custom-lib", defaultOptions)(linkCustomLibGroup)

val libraries = {
strawmanLibrary +
Expand All @@ -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 + "/main/")
val customLibClassFlags = mkLinkClassFlags(defaultOutputDir + linkCustomLibGroup + "/custom-lib")

// Link tests
val linkDir = "../tests/link"
val linkStramanDir = linkDir + "/strawman"
val linkCustomLibDir = linkDir + "/on-custom-lib"
def linkStrawmanTest = compileFilesInDir(linkStramanDir, strawmanClassPath)
def linkCustomLibTest = compileFilesInDir(linkCustomLibDir, customLibClassFlags)

val linkStrawmanTest = compileFilesInDir(linkStramanDir, strawmanClassPath)(strawmanLibTestGroup)
val linkCustomLibTest = compileFilesInDir(linkCustomLibDir, customLibClassFlags)(linkCustomLibTestGroup)

def classFileChecks(sourceDir: String, testName: String) = {
val checkExt = ".classcheck"
Expand All @@ -73,16 +78,16 @@ 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()
}
}

}

object LinkOptimiseTests {
object LinkTests {
implicit val summaryReport: SummaryReporting = new SummaryReport
@AfterClass def cleanup(): Unit = summaryReport.echoSummary()
}
Loading