Skip to content

Commit c429733

Browse files
committed
Update sequential tasks portion
1 parent fa6054b commit c429733

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

compiler/test/dotty/partest/DPConsoleRunner.scala

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,36 @@ extends SuiteRunner(testSourcePath, fileManager, updateCheck, failed, javaCmdPat
8888
""".stripMargin
8989
}
9090

91-
/** Tests which are compiled with one or more of the flags in this list will be run
92-
* one by one, without any other test running at the same time.
93-
* This is necessary because some test flags require a lot of memory when running
94-
* the compiler and may exhaust the available memory when run in parallel with other tests.
95-
*/
96-
def sequentialFlags = List("-Ytest-pickler")
91+
/** Some tests require a limitation of resources, tests which are compiled
92+
* with one or more of the flags in this list will be run with
93+
* `limitedThreads`. This is necessary because some test flags require a lot
94+
* of memory when running the compiler and may exhaust the available memory
95+
* when run in parallel with too many other tests.
96+
*
97+
* This number could be increased on the CI, but might fail locally if
98+
* scaled too extreme - override with:
99+
*
100+
* ```
101+
* -Ddotty.tests.limitedThreads=X
102+
* ```
103+
*/
104+
def limitResourceFlags = List("-Ytest-pickler")
105+
private val limitedThreads = sys.props.get("dotty.tests.limitedThreads").getOrElse("2")
97106

98107
override def runTestsForFiles(kindFiles: Array[File], kind: String): Array[TestState] = {
99-
val (sequentialTests, parallelTests) =
108+
val (limitResourceTests, parallelTests) =
100109
kindFiles partition { kindFile =>
101110
val flags = kindFile.changeExtension("flags").fileContents
102-
sequentialFlags.exists(seqFlag => flags.contains(seqFlag))
111+
limitResourceFlags.exists(seqFlag => flags.contains(seqFlag))
103112
}
104113

105114
val seqResults =
106-
if (!sequentialTests.isEmpty) {
115+
if (!limitResourceTests.isEmpty) {
107116
val savedThreads = sys.props("partest.threads")
108-
sys.props("partest.threads") = "2"
117+
sys.props("partest.threads") = limitedThreads
109118

110-
NestUI.echo(s"## we will run ${sequentialTests.length} tests using ${PartestDefaults.numThreads} thread(s)")
111-
val res = super.runTestsForFiles(sequentialTests, kind)
119+
NestUI.echo(s"## we will run ${limitResourceTests.length} tests using ${PartestDefaults.numThreads} thread(s)")
120+
val res = super.runTestsForFiles(limitResourceTests, kind)
112121

113122
if (savedThreads != null)
114123
sys.props("partest.threads") = savedThreads

0 commit comments

Comments
 (0)