Minor: add functions to distinguish initial and incremental builds when debugging IC tests

This commit is contained in:
Alexey Tsvetkov
2019-10-25 04:45:06 +03:00
committed by romanart
parent 537199e0fa
commit 83f060ad3e
@@ -41,11 +41,8 @@ abstract class AbstractIncrementalCompilerRunnerTestBase<Args : CommonCompilerAr
val mapWorkingToOriginalFile = HashMap(copyTestSources(testDir, srcDir, filePrefix = ""))
val sourceRoots = listOf(srcDir)
val args = createCompilerArguments(outDir, testDir)
// initial build
val (_, _, errors) = make(cacheDir, sourceRoots, args)
if (errors.isNotEmpty()) {
throw IllegalStateException("Initial build failed: \n${errors.joinToString("\n")}")
}
val (_, _, errors) = initialMake(cacheDir, sourceRoots, args)
check(errors.isEmpty()) { "Initial build failed: \n${errors.joinToString("\n")}" }
// modifications
val buildLogFile = buildLogFinder.findBuildLog(testDir) ?: throw IllegalStateException("build log file not found in $workingDir")
@@ -72,7 +69,7 @@ abstract class AbstractIncrementalCompilerRunnerTestBase<Args : CommonCompilerAr
var step = 1
for ((modificationStep, buildLogStep) in modifications.zip(buildLogSteps)) {
modificationStep.forEach { it.perform(workingDir, mapWorkingToOriginalFile) }
val (_, compiledSources, compileErrors) = make(cacheDir, sourceRoots, args)
val (_, compiledSources, compileErrors) = incrementalMake(cacheDir, sourceRoots, args)
expectedSB.appendLine(stepLogAsString(step, buildLogStep.compiledKotlinFiles, buildLogStep.compileErrors))
expectedSBWithoutErrors.appendLine(
@@ -100,6 +97,11 @@ abstract class AbstractIncrementalCompilerRunnerTestBase<Args : CommonCompilerAr
rebuildAndCompareOutput(sourceRoots, testDir, buildLogSteps, outDir)
}
// these functions are needed only to simplify debugging of IC tests
private fun initialMake(cacheDir: File, sourceRoots: List<File>, args: Args) = make(cacheDir, sourceRoots, args)
private fun incrementalMake(cacheDir: File, sourceRoots: List<File>, args: Args) = make(cacheDir, sourceRoots, args)
protected open fun rebuildAndCompareOutput(
sourceRoots: List<File>,
testDir: File,