Skip to content

Operation Kill Partest (part 1) #2125

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 39 commits into from
Mar 29, 2017
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5ce54c6
Add initial compilation functionality to ParallelTesting trait
felixmulder Mar 9, 2017
531c722
Add interface for unit tests into `ParallelTesting`
felixmulder Mar 9, 2017
58e1c65
Add java compilation to `ParallelTesting`
felixmulder Mar 9, 2017
7b75bb2
Fix i851.java not being valid java
felixmulder Mar 10, 2017
0620c2b
Prefix out directory with name of test
felixmulder Mar 9, 2017
fc2bdc8
Parallelize compilation runs for ParallelTesting infra
felixmulder Mar 10, 2017
57f8d1b
Add neg testing capability to ParallelTesting
felixmulder Mar 11, 2017
3acba31
Add support for error annotations in neg tests
felixmulder Mar 13, 2017
c52457c
Add ability to compile single files
felixmulder Mar 13, 2017
cd345b4
Add run testing capabilities
felixmulder Mar 14, 2017
0c23687
Stylistic changes to `Compiler` and `DPConsoleRunner`
felixmulder Mar 15, 2017
5d7fb14
Rewrite testing logic as to not copy files
felixmulder Mar 16, 2017
620daf8
Add all tests from `tests.scala` as is to new infra
felixmulder Mar 16, 2017
101d124
Move REPL diff tests out of `tests.scala`
felixmulder Mar 16, 2017
c0a76af
Move whitelist test out of `tests.scala`
felixmulder Mar 16, 2017
404ce89
Remove `tests.scala`
felixmulder Mar 16, 2017
f6eb902
Kill partest
felixmulder Mar 17, 2017
5d36bf9
Make tests composable
felixmulder Mar 17, 2017
4062778
Fix reflective method lookup to work for both scalac & dotty
felixmulder Mar 20, 2017
d2e50d9
Make compileList take test name arg
felixmulder Mar 20, 2017
0df3f61
Support copyToDir for tests that mutate original source
felixmulder Mar 20, 2017
8c02da6
Fix tasty bootstrap
felixmulder Mar 20, 2017
52488da
Disable interactive mode in CI
felixmulder Mar 20, 2017
5bd99fc
Remove verbose prints in dottydoc tests
felixmulder Mar 21, 2017
a172e45
Throw on timeout
felixmulder Mar 21, 2017
4e8eb32
Consolidate test reporters in `TestReporter` always dumping log file
felixmulder Mar 22, 2017
f260894
Add summary report to pos tests and run tests
felixmulder Mar 22, 2017
41b3641
Add testing of new test framework
felixmulder Mar 23, 2017
1ab7c03
Move varargs tests to top-level pos and neg
felixmulder Mar 23, 2017
f7e3b70
Restore partest and enable it to run alongside new partest
felixmulder Mar 27, 2017
fd37852
Add test filtering via `filterTest <regex>`
felixmulder Mar 27, 2017
0b65aad
Add documentation to ParallelTesting
felixmulder Mar 28, 2017
7d8303d
Address reviewer feedback on #2125
felixmulder Mar 28, 2017
af4bb48
Make run tests run even if there isn't a check file
felixmulder Mar 28, 2017
c8321d6
Add test to check failure of non-tail recursive
felixmulder Mar 28, 2017
8dc162c
Preserve stack trace when invoking main in run tests
felixmulder Mar 28, 2017
b5b6f5e
Fix test reporting for exceptions in compiler
felixmulder Mar 28, 2017
02ebe0f
Make summary report come at the end of test suite
felixmulder Mar 29, 2017
08d75b5
Revert CI memory changes
felixmulder Mar 29, 2017
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
12 changes: 7 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pipeline:
- ln -s /var/cache/drone/scala-scala scala-scala
- ln -s /var/cache/drone/ivy2 "$HOME/.ivy2"
- ./scripts/update-scala-library
- sbt -J-Xmx4096m -J-XX:ReservedCodeCacheSize=512m -J-XX:MaxMetaspaceSize=1024m -Ddotty.drone.mem=4096m "${TEST}"
- sbt -J-Xmx24G -J-XX:ReservedCodeCacheSize=512m -J-XX:MaxMetaspaceSize=4G -Ddotty.drone.mem=4096m "${TEST}"
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need that much metaspace?

Copy link
Contributor

Choose a reason for hiding this comment

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

What's dotty.drone.mem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding metaspace - no idea, here I'm just playing with different settings to see if I can get the CI to run faster. Let's discuss this on Thursday at the meeting after I've experimented (=

dotty.drone.mem is something that partest (the old one) uses IIRC.

Copy link
Member

Choose a reason for hiding this comment

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

dotty.drone.mem is used in Build.scala, it's the amount of memory we give to each jvm started from sbt.

when:
branch:
exclude: gh-pages
Expand Down Expand Up @@ -34,7 +34,9 @@ pipeline:

matrix:
TEST:
- ;test;dotty-bin-tests/test
- ;publishLocal;dotty-bootstrapped/test
- partest-only-no-bootstrap --show-diff --verbose
- partest-only --show-diff --verbose
- ;set testOptions in LocalProject("dotty-compiler") += Tests.Argument(TestFrameworks.JUnit, "--exclude-categories=dotty.tools.dotc.ParallelTesting") ;test ;dotty-bin-tests/test
Copy link
Contributor

Choose a reason for hiding this comment

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

would be nice to comment why are those additional options needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, also if it wasn't clear - they will be removed once we remove partest itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an intention to remove partest before we merge this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No

- ;set testOptions in LocalProject("dotty-compiler-bootstrapped") += Tests.Argument(TestFrameworks.JUnit, "--exclude-categories=dotty.tools.dotc.ParallelTesting") ;publishLocal ;dotty-bootstrapped/test
- ;set testOptions in LocalProject("dotty-compiler") += Tests.Argument(TestFrameworks.JUnit, "--exclude-categories=dotty.tools.dotc.ParallelTesting") ;partest-only-no-bootstrap --show-diff --verbose
- ;set testOptions in LocalProject("dotty-compiler-bootstrapped") += Tests.Argument(TestFrameworks.JUnit, "--exclude-categories=dotty.tools.dotc.ParallelTesting") ;partest-only --show-diff --verbose
Copy link
Contributor Author

@felixmulder felixmulder Mar 29, 2017

Choose a reason for hiding this comment

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

@DarkDimius - here you can see that partest is still included, with the new unit tests filtered out.

Once we want to remove partest from the CI these, lines dissappear and the only two left will be:

- ;test ;dotty-bin-tests/test
- ;publishLocal ;dotty-bootstrapped/test

Copy link
Contributor

Choose a reason for hiding this comment

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

@felixmulder, thank you for clarification.

- ;dotty-compiler/testOnly dotty.tools.dotc.CompilationTests
- ;publishLocal ;dotty-bootstrapped/testOnly dotty.tools.dotc.CompilationTests
2 changes: 1 addition & 1 deletion .drone.yml.sig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
eyJhbGciOiJIUzI1NiJ9.cGlwZWxpbmU6CiAgdGVzdDoKICAgIGltYWdlOiBsYW1wZXBmbC9kb3R0eTpsYXRlc3QKICAgIHB1bGw6IHRydWUKICAgIGNvbW1hbmRzOgogICAgICAtIGxuIC1zIC92YXIvY2FjaGUvZHJvbmUvc2NhbGEtc2NhbGEgc2NhbGEtc2NhbGEKICAgICAgLSBsbiAtcyAvdmFyL2NhY2hlL2Ryb25lL2l2eTIgIiRIT01FLy5pdnkyIgogICAgICAtIC4vc2NyaXB0cy91cGRhdGUtc2NhbGEtbGlicmFyeQogICAgICAtIHNidCAtSi1YbXg0MDk2bSAtSi1YWDpSZXNlcnZlZENvZGVDYWNoZVNpemU9NTEybSAtSi1YWDpNYXhNZXRhc3BhY2VTaXplPTEwMjRtIC1EZG90dHkuZHJvbmUubWVtPTQwOTZtICIke1RFU1R9IgogICAgd2hlbjoKICAgICAgYnJhbmNoOgogICAgICAgIGV4Y2x1ZGU6IGdoLXBhZ2VzCgogIGRvY3VtZW50YXRpb246CiAgICBpbWFnZTogbGFtcGVwZmwvZG90dHk6bGF0ZXN0CiAgICBwdWxsOiB0cnVlCiAgICBjb21tYW5kczoKICAgICAgL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saXNoTG9jYWwgO2RvdHR5LWJvb3RzdHJhcHBlZC90ZXN0CiAgICAtIDtzZXQgdGVzdE9wdGlvbnMgaW4gTG9jYWxQcm9qZWN0KCJkb3R0eS1jb21waWxlciIpICs9IFRlc3RzLkFyZ3VtZW50KFRlc3RGcmFtZXdvcmtzLkpVbml0LCAiLS1leGNsdWRlLWNhdGVnb3JpZXM9ZG90dHkudG9vbHMuZG90Yy5QYXJhbGxlbFRlc3RpbmciKSA7cGFydGVzdC1vbmx5LW5vLWJvb3RzdHJhcCAtLXNob3ctZGlmZiAtLXZlcmJvc2UKICAgIC0gO3NldCB0ZXN0T3B0aW9ucyBpbiBMb2NhbFByb2plY3QoImRvdHR5LWNvbXBpbGVyLWJvb3RzdHJhcHBlZCIpICs9IFRlc3RzLkFyZ3VtZW50KFRlc3RGcmFtZXdvcmtzLkpVbml0LCAiLS1leGNsdWRlLWNhdGVnb3JpZXM9ZG90dHkudG9vbHMuZG90Yy5QYXJhbGxlbFRlc3RpbmciKSA7cGFydGVzdC1vbmx5IC0tc2hvdy1kaWZmIC0tdmVyYm9zZQogICAgLSA7ZG90dHktY29tcGlsZXIvdGVzdE9ubHkgZG90dHkudG9vbHMuZG90Yy5Db21waWxhdGlvblRlc3RzCiAgICAtIDtwdWJsaXNoTG9jYWwgO2RvdHR5LWJvb3RzdHJhcHBlZC90ZXN0T25seSBkb3R0eS50b29scy5kb3RjLkNvbXBpbGF0aW9uVGVzdHMK.IAe3X-XmMyf3-GnA1ENr-D3t_YM_28CAhHX6lP0EB6E
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class Compiler {
.setMode(Mode.ImplicitsEnabled)
.setTyperState(new MutableTyperState(ctx.typerState, ctx.typerState.reporter, isCommittable = true))
.setFreshNames(new FreshNameCreator.Default)
ctx.initialize()(start) // re-initialize the base context with start
ctx.initialize()(start) // re-initialize the base context with start
def addImport(ctx: Context, refFn: () => TermRef) =
ctx.fresh.setImportInfo(ImportInfo.rootImport(refFn)(ctx))
(start.setRunInfo(new RunInfo(start)) /: defn.RootImportFns)(addImport)
Expand Down
3 changes: 0 additions & 3 deletions compiler/src/dotty/tools/dotc/reporting/ConsoleReporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ class ConsoleReporter(

import MessageContainer._

/** maximal number of error messages to be printed */
protected def ErrorLimit = 100

/** Prints the message. */
def printMessage(msg: String): Unit = { writer.print(msg + "\n"); writer.flush() }

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/reporting/Reporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ trait Reporting { this: Context =>
|This can be achieved by adding the import clause 'import $fqname'
|or by setting the compiler option -language:$feature.
|See the Scala docs for value $fqname for a discussion
|why the feature $req be explicitly enabled."""
|why the feature $req be explicitly enabled.""".stripMargin
}
}

Expand Down
33 changes: 19 additions & 14 deletions compiler/test/dotc/comptest.scala
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
package dotc

import dotty.tools.dotc.CompilerTest
import dotty.tools.dotc.ParallelTesting

object comptest extends CompilerTest {
object comptest extends ParallelTesting {

override val generatePartestFiles = false
val defaultOutputDir: String = ""
def isInteractive = true
def testFilter = None

implicit val defaultOutputDir: String = "."

val posDir = "./tests/pos/"
val negDir = "./tests/neg/"
val dotcDir = "./src/dotty/"

def main(args: Array[String]) =
compileList("comptest", List(
dotcDir + "tools/dotc/CompilationUnit.scala",
dotcDir + "tools/dotc/core/Types.scala",
dotcDir + "tools/dotc/ast/Trees.scala"), List(
"#runs", "2",
"-Ylog:frontend",
"-Xprompt"))(Nil)

// compileDir(dotcDir + "tools/dotc/", "printing", List("-Xprompt", "-Ylog:frontend", "#runs", "2", "-uniqid"))
def main(args: Array[String]): Unit =
compileList(
"comptest",
List(
dotcDir + "tools/dotc/CompilationUnit.scala",
dotcDir + "tools/dotc/core/Types.scala",
dotcDir + "tools/dotc/ast/Trees.scala"
),
Array(
"-Ylog:frontend",
"-Xprompt"
)
)
}
14 changes: 0 additions & 14 deletions compiler/test/dotc/tests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class tests extends CompilerTest {
val negDir = testsDir + "neg/"
val runDir = testsDir + "run/"
val newDir = testsDir + "new/"
val replDir = testsDir + "repl/"
val javaDir = testsDir + "pos-java-interop/"

val sourceDir = "./src/"
Expand Down Expand Up @@ -173,7 +172,6 @@ class tests extends CompilerTest {
@Test def pos_utf16 = compileFile(posSpecialDir, "utf16encoded", explicitUTF16)

@Test def new_all = compileFiles(newDir, twice)
@Test def repl_all = replFiles(replDir)

@Test def neg_all = compileFiles(negDir, verbose = true, compileSubDirs = false)
@Test def neg_typedIdents() = compileDir(negDir, "typedIdents")
Expand Down Expand Up @@ -205,18 +203,6 @@ class tests extends CompilerTest {

private val stdlibFiles: List[String] = StdLibSources.whitelisted

@Test def checkWBLists = {
val stdlibFilesBlackListed = StdLibSources.blacklisted

val duplicates = stdlibFilesBlackListed.groupBy(x => x).filter(_._2.size > 1).filter(_._2.size > 1)
val msg = duplicates.map(x => s"'${x._1}' appears ${x._2.size} times").mkString(s"Duplicate entries in ${StdLibSources.blacklistFile}:\n", "\n", "\n")
assertTrue(msg, duplicates.isEmpty)

val filesNotInStdLib = stdlibFilesBlackListed.toSet -- StdLibSources.all
val msg2 = filesNotInStdLib.map(x => s"'$x'").mkString(s"Entries in ${StdLibSources.blacklistFile} where not found:\n", "\n", "\n")
assertTrue(msg2, filesNotInStdLib.isEmpty)
}

@Test def compileStdLib = compileList("compileStdLib", stdlibFiles, "-migration" :: "-Yno-inline" :: scala2mode)
@Test def compileMixed = compileLine(
"""../tests/pos/B.scala
Expand Down
24 changes: 12 additions & 12 deletions compiler/test/dotty/partest/DPConsoleRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,18 @@ extends SuiteRunner(testSourcePath, fileManager, updateCheck, failed, javaCmdPat
}

/** Some tests require a limitation of resources, tests which are compiled
* with one or more of the flags in this list will be run with
* `limitedThreads`. This is necessary because some test flags require a lot
* of memory when running the compiler and may exhaust the available memory
* when run in parallel with too many other tests.
*
* This number could be increased on the CI, but might fail locally if
* scaled too extreme - override with:
*
* ```
* -Ddotty.tests.limitedThreads=X
* ```
*/
* with one or more of the flags in this list will be run with
* `limitedThreads`. This is necessary because some test flags require a lot
* of memory when running the compiler and may exhaust the available memory
* when run in parallel with too many other tests.
*
* This number could be increased on the CI, but might fail locally if
* scaled too extreme - override with:
*
* ```
* -Ddotty.tests.limitedThreads=X
* ```
*/
def limitResourceFlags = List("-Ytest-pickler")
private val limitedThreads = sys.props.get("dotty.tests.limitedThreads").getOrElse("2")

Expand Down
17 changes: 16 additions & 1 deletion compiler/test/dotty/tools/StdLibSources.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package dotty.tools

import java.io.File

import scala.io.Source
import org.junit.Test
import org.junit.Assert._

object StdLibSources {

Expand Down Expand Up @@ -57,3 +58,17 @@ object StdLibSources {
.toList

}

class StdLibSources {
@Test def checkWBLists = {
val stdlibFilesBlackListed = StdLibSources.blacklisted

val duplicates = stdlibFilesBlackListed.groupBy(x => x).filter(_._2.size > 1).filter(_._2.size > 1)
val msg = duplicates.map(x => s"'${x._1}' appears ${x._2.size} times").mkString(s"Duplicate entries in ${StdLibSources.blacklistFile}:\n", "\n", "\n")
assertTrue(msg, duplicates.isEmpty)

val filesNotInStdLib = stdlibFilesBlackListed.toSet -- StdLibSources.all
val msg2 = filesNotInStdLib.map(x => s"'$x'").mkString(s"Entries in ${StdLibSources.blacklistFile} where not found:\n", "\n", "\n")
assertTrue(msg2, filesNotInStdLib.isEmpty)
}
}
Loading