@@ -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
*
@@ -1258,8 +1258,8 @@ trait ParallelTesting extends RunnerOrchestration { self =>
1258
1258
* Tests in the first part of the tuple must be executed before the second.
1259
1259
* Both testsRequires explicit delete().
1260
1260
*/
1261
- def compileTastyInDir (f : String , flags0 : TestFlags , blacklist : Set [String ])(
1262
- implicit testGroup : TestGroup ): ( CompilationTest , CompilationTest , CompilationTest , String ) = {
1261
+ def compileTastyInDir (f : String , flags0 : TestFlags , blacklist : Set [String ], recompilationBlacklist : Set [ String ] )(
1262
+ implicit testGroup : TestGroup ): TastyCompilationTest = {
1263
1263
val outDir = defaultOutputDir + testGroup + " /"
1264
1264
val flags = flags0 and " -Yretain-trees"
1265
1265
val sourceDir = new JFile (f)
@@ -1287,14 +1287,50 @@ trait ParallelTesting extends RunnerOrchestration { self =>
1287
1287
1288
1288
val decompilationDir = outDir + sourceDir.getName + " _decompiled"
1289
1289
1290
- (
1290
+ new TastyCompilationTest (
1291
1291
generateClassFiles.keepOutput,
1292
1292
new CompilationTest (targets).keepOutput,
1293
1293
new CompilationTest (targets2).keepOutput,
1294
- decompilationDir
1294
+ recompilationBlacklist,
1295
+ decompilationDir,
1296
+ shouldDelete = true
1295
1297
)
1296
1298
}
1297
1299
1300
+ class TastyCompilationTest (step1 : CompilationTest , step2 : CompilationTest , step3 : CompilationTest ,
1301
+ recompilationBlacklist : Set [String ], decompilationDir : String , shouldDelete : Boolean )(implicit testGroup : TestGroup ) {
1302
+
1303
+ def keepOutput : TastyCompilationTest =
1304
+ new TastyCompilationTest (step1, step2, step3, recompilationBlacklist, decompilationDir, shouldDelete)
1305
+
1306
+ def checkCompile ()(implicit summaryReport : SummaryReporting ): this .type = {
1307
+ step1.checkCompile() // Compile all files to generate the class files with tasty
1308
+ step2.checkCompile() // Compile from tasty
1309
+ step3.checkCompile() // Decompile from tasty
1310
+
1311
+ val step4 = compileFilesInDir(decompilationDir, defaultOptions, recompilationBlacklist).keepOutput
1312
+ step4.checkCompile() // Recompile decompiled code
1313
+
1314
+ if (shouldDelete)
1315
+ (step1 + step2 + step3 + step4).delete()
1316
+
1317
+ this
1318
+ }
1319
+
1320
+ def checkRuns ()(implicit summaryReport : SummaryReporting ): this .type = {
1321
+ step1.checkCompile() // Compile all files to generate the class files with tasty
1322
+ step2.checkRuns() // Compile from tasty
1323
+ step3.checkCompile() // Decompile from tasty
1324
+
1325
+ val step4 = compileFilesInDir(decompilationDir, defaultOptions, recompilationBlacklist).keepOutput
1326
+ step4.checkRuns() // Recompile decompiled code
1327
+
1328
+ if (shouldDelete)
1329
+ (step1 + step2 + step3 + step4).delete()
1330
+
1331
+ this
1332
+ }
1333
+ }
1298
1334
1299
1335
/** This function behaves similar to `compileFilesInDir` but it ignores
1300
1336
* sub-directories and as such, does **not** perform separate compilation
0 commit comments