JPS, tests: Support multimodule mpp tests without steps
Original commit: ce4422e2ef
This commit is contained in:
+25
-15
@@ -67,8 +67,7 @@ import kotlin.reflect.jvm.javaField
|
||||
|
||||
abstract class AbstractIncrementalJpsTest(
|
||||
private val allowNoFilesWithSuffixInTestData: Boolean = false,
|
||||
private val checkDumpsCaseInsensitively: Boolean = false,
|
||||
private val allowNoBuildLogFileInTestData: Boolean = false
|
||||
private val checkDumpsCaseInsensitively: Boolean = false
|
||||
) : BaseKotlinJpsBuildTestCase() {
|
||||
companion object {
|
||||
private val COMPILATION_FAILED = "COMPILATION FAILED"
|
||||
@@ -305,6 +304,7 @@ abstract class AbstractIncrementalJpsTest(
|
||||
protected open fun doTest(testDataPath: String) {
|
||||
testDataDir = File(testDataPath)
|
||||
workDir = FileUtilRt.createTempDirectory(TEMP_DIRECTORY_TO_USE, "jps-build", null)
|
||||
val buildLogFile = buildLogFinder.findBuildLog(testDataDir)
|
||||
Disposer.register(testRootDisposable, Disposable { FileUtilRt.delete(workDir) })
|
||||
|
||||
val modulesTxt = configureModules()
|
||||
@@ -312,19 +312,19 @@ abstract class AbstractIncrementalJpsTest(
|
||||
|
||||
initialMake()
|
||||
|
||||
val otherMakeResults = performModificationsAndMake(modulesTxt?.modules?.map { it.name })
|
||||
val buildLogFile = buildLogFinder.findBuildLog(testDataDir)
|
||||
val logs = createBuildLog(otherMakeResults)
|
||||
val otherMakeResults = performModificationsAndMake(
|
||||
modulesTxt?.modules?.map { it.name },
|
||||
hasBuildLog = buildLogFile != null
|
||||
)
|
||||
|
||||
if (buildLogFile != null && buildLogFile.exists()) {
|
||||
buildLogFile?.let {
|
||||
val logs = createBuildLog(otherMakeResults)
|
||||
UsefulTestCase.assertSameLinesWithFile(buildLogFile.absolutePath, logs)
|
||||
} else if (!allowNoBuildLogFileInTestData) {
|
||||
throw IllegalStateException("No build log file in $testDataDir")
|
||||
}
|
||||
|
||||
val lastMakeResult = otherMakeResults.last()
|
||||
rebuildAndCheckOutput(lastMakeResult)
|
||||
clearCachesRebuildAndCheckOutput(lastMakeResult)
|
||||
val lastMakeResult = otherMakeResults.last()
|
||||
rebuildAndCheckOutput(lastMakeResult)
|
||||
clearCachesRebuildAndCheckOutput(lastMakeResult)
|
||||
}
|
||||
}
|
||||
|
||||
private fun createMappingsDump(
|
||||
@@ -411,15 +411,25 @@ abstract class AbstractIncrementalJpsTest(
|
||||
open val testDataSrc: File
|
||||
get() = testDataDir
|
||||
|
||||
private fun performModificationsAndMake(moduleNames: Collection<String>?): List<MakeResult> {
|
||||
private fun performModificationsAndMake(
|
||||
moduleNames: Collection<String>?,
|
||||
hasBuildLog: Boolean
|
||||
): List<MakeResult> {
|
||||
val results = arrayListOf<MakeResult>()
|
||||
val modifications = getModificationsToPerform(
|
||||
testDataSrc,
|
||||
moduleNames,
|
||||
allowNoFilesWithSuffixInTestData,
|
||||
TouchPolicy.TIMESTAMP
|
||||
allowNoFilesWithSuffixInTestData = allowNoFilesWithSuffixInTestData || !hasBuildLog,
|
||||
touchPolicy = TouchPolicy.TIMESTAMP
|
||||
)
|
||||
|
||||
if (!hasBuildLog) {
|
||||
check(modifications.size == 1 && modifications.single().isEmpty()) {
|
||||
"Bad test data: build steps are provided, but there is no `build.log` file"
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
val stepsTxt = File(testDataSrc, "_steps.txt")
|
||||
val modificationNames = if (stepsTxt.exists()) stepsTxt.readLines() else null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user