@@ -2,27 +2,27 @@ package dotty
2
2
package tools
3
3
package vulpix
4
4
5
- import java .io .{ File => JFile }
5
+ import java .io .{File => JFile }
6
6
import java .text .SimpleDateFormat
7
7
import java .util .HashMap
8
8
import java .nio .file .StandardCopyOption .REPLACE_EXISTING
9
- import java .nio .file .{ Files , Path , Paths , NoSuchFileException }
10
- import java .util .concurrent .{ Executors => JExecutors , TimeUnit , TimeoutException }
9
+ import java .nio .file .{Files , NoSuchFileException , Path , Paths }
10
+ import java .util .concurrent .{TimeUnit , TimeoutException , Executors => JExecutors }
11
11
12
12
import scala .io .Source
13
13
import scala .util .control .NonFatal
14
14
import scala .util .Try
15
15
import scala .collection .mutable
16
16
import scala .util .matching .Regex
17
17
import scala .util .Random
18
-
19
18
import dotc .core .Contexts ._
20
- import dotc .reporting .{ Reporter , TestReporter }
19
+ import dotc .reporting .{Reporter , TestReporter }
21
20
import dotc .reporting .diagnostic .MessageContainer
22
21
import dotc .interfaces .Diagnostic .ERROR
23
22
import dotc .util .DiffUtil
24
- import dotc .{ Driver , Compiler }
23
+ import dotc .{Compiler , Driver }
25
24
import dotc .decompiler
25
+ import dotty .tools .vulpix .TestConfiguration .defaultOptions
26
26
27
27
/** A parallel testing suite whose goal is to integrate nicely with JUnit
28
28
*
@@ -1260,8 +1260,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
1260
1260
* Tests in the first part of the tuple must be executed before the second.
1261
1261
* Both testsRequires explicit delete().
1262
1262
*/
1263
- def compileTastyInDir (f : String , flags0 : TestFlags , blacklist : Set [String ])(
1264
- implicit testGroup : TestGroup ): ( CompilationTest , CompilationTest , CompilationTest , String ) = {
1263
+ def compileTastyInDir (f : String , flags0 : TestFlags , blacklist : Set [String ], recompilationBlacklist : Set [ String ] )(
1264
+ implicit testGroup : TestGroup ): TastyCompilationTest = {
1265
1265
val outDir = defaultOutputDir + testGroup + " /"
1266
1266
val flags = flags0 and " -Yretain-trees"
1267
1267
val sourceDir = new JFile (f)
@@ -1289,14 +1289,50 @@ trait ParallelTesting extends RunnerOrchestration { self =>
1289
1289
1290
1290
val decompilationDir = outDir + sourceDir.getName + " _decompiled"
1291
1291
1292
- (
1292
+ new TastyCompilationTest (
1293
1293
generateClassFiles.keepOutput,
1294
1294
new CompilationTest (targets).keepOutput,
1295
1295
new CompilationTest (targets2).keepOutput,
1296
- decompilationDir
1296
+ recompilationBlacklist,
1297
+ decompilationDir,
1298
+ shouldDelete = true
1297
1299
)
1298
1300
}
1299
1301
1302
+ class TastyCompilationTest (step1 : CompilationTest , step2 : CompilationTest , step3 : CompilationTest ,
1303
+ recompilationBlacklist : Set [String ], decompilationDir : String , shouldDelete : Boolean )(implicit testGroup : TestGroup ) {
1304
+
1305
+ def keepOutput : TastyCompilationTest =
1306
+ new TastyCompilationTest (step1, step2, step3, recompilationBlacklist, decompilationDir, shouldDelete)
1307
+
1308
+ def checkCompile ()(implicit summaryReport : SummaryReporting ): this .type = {
1309
+ step1.checkCompile() // Compile all files to generate the class files with tasty
1310
+ step2.checkCompile() // Compile from tasty
1311
+ step3.checkCompile() // Decompile from tasty
1312
+
1313
+ val step4 = compileFilesInDir(decompilationDir, defaultOptions, recompilationBlacklist).keepOutput
1314
+ step4.checkCompile() // Recompile decompiled code
1315
+
1316
+ if (shouldDelete)
1317
+ (step1 + step2 + step3 + step4).delete()
1318
+
1319
+ this
1320
+ }
1321
+
1322
+ def checkRuns ()(implicit summaryReport : SummaryReporting ): this .type = {
1323
+ step1.checkCompile() // Compile all files to generate the class files with tasty
1324
+ step2.checkRuns() // Compile from tasty
1325
+ step3.checkCompile() // Decompile from tasty
1326
+
1327
+ val step4 = compileFilesInDir(decompilationDir, defaultOptions, recompilationBlacklist).keepOutput
1328
+ step4.checkRuns() // Recompile decompiled code
1329
+
1330
+ if (shouldDelete)
1331
+ (step1 + step2 + step3 + step4).delete()
1332
+
1333
+ this
1334
+ }
1335
+ }
1300
1336
1301
1337
/** This function behaves similar to `compileFilesInDir` but it ignores
1302
1338
* sub-directories and as such, does **not** perform separate compilation
0 commit comments