@@ -88,27 +88,36 @@ extends SuiteRunner(testSourcePath, fileManager, updateCheck, failed, javaCmdPat
88
88
""" .stripMargin
89
89
}
90
90
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" )
97
106
98
107
override def runTestsForFiles (kindFiles : Array [File ], kind : String ): Array [TestState ] = {
99
- val (sequentialTests , parallelTests) =
108
+ val (limitResourceTests , parallelTests) =
100
109
kindFiles partition { kindFile =>
101
110
val flags = kindFile.changeExtension(" flags" ).fileContents
102
- sequentialFlags .exists(seqFlag => flags.contains(seqFlag))
111
+ limitResourceFlags .exists(seqFlag => flags.contains(seqFlag))
103
112
}
104
113
105
114
val seqResults =
106
- if (! sequentialTests .isEmpty) {
115
+ if (! limitResourceTests .isEmpty) {
107
116
val savedThreads = sys.props(" partest.threads" )
108
- sys.props(" partest.threads" ) = " 2 "
117
+ sys.props(" partest.threads" ) = limitedThreads
109
118
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)
112
121
113
122
if (savedThreads != null )
114
123
sys.props(" partest.threads" ) = savedThreads
0 commit comments