Minor: add functions to distinguish initial and incremental builds when debugging IC tests
This commit is contained in:
committed by
romanart
parent
537199e0fa
commit
83f060ad3e
+8
-6
@@ -41,11 +41,8 @@ abstract class AbstractIncrementalCompilerRunnerTestBase<Args : CommonCompilerAr
|
|||||||
val mapWorkingToOriginalFile = HashMap(copyTestSources(testDir, srcDir, filePrefix = ""))
|
val mapWorkingToOriginalFile = HashMap(copyTestSources(testDir, srcDir, filePrefix = ""))
|
||||||
val sourceRoots = listOf(srcDir)
|
val sourceRoots = listOf(srcDir)
|
||||||
val args = createCompilerArguments(outDir, testDir)
|
val args = createCompilerArguments(outDir, testDir)
|
||||||
// initial build
|
val (_, _, errors) = initialMake(cacheDir, sourceRoots, args)
|
||||||
val (_, _, errors) = make(cacheDir, sourceRoots, args)
|
check(errors.isEmpty()) { "Initial build failed: \n${errors.joinToString("\n")}" }
|
||||||
if (errors.isNotEmpty()) {
|
|
||||||
throw IllegalStateException("Initial build failed: \n${errors.joinToString("\n")}")
|
|
||||||
}
|
|
||||||
|
|
||||||
// modifications
|
// modifications
|
||||||
val buildLogFile = buildLogFinder.findBuildLog(testDir) ?: throw IllegalStateException("build log file not found in $workingDir")
|
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
|
var step = 1
|
||||||
for ((modificationStep, buildLogStep) in modifications.zip(buildLogSteps)) {
|
for ((modificationStep, buildLogStep) in modifications.zip(buildLogSteps)) {
|
||||||
modificationStep.forEach { it.perform(workingDir, mapWorkingToOriginalFile) }
|
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))
|
expectedSB.appendLine(stepLogAsString(step, buildLogStep.compiledKotlinFiles, buildLogStep.compileErrors))
|
||||||
expectedSBWithoutErrors.appendLine(
|
expectedSBWithoutErrors.appendLine(
|
||||||
@@ -100,6 +97,11 @@ abstract class AbstractIncrementalCompilerRunnerTestBase<Args : CommonCompilerAr
|
|||||||
rebuildAndCompareOutput(sourceRoots, testDir, buildLogSteps, outDir)
|
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(
|
protected open fun rebuildAndCompareOutput(
|
||||||
sourceRoots: List<File>,
|
sourceRoots: List<File>,
|
||||||
testDir: File,
|
testDir: File,
|
||||||
|
|||||||
Reference in New Issue
Block a user