IC tests: make exceptions from compiler more visible in tests
otherwise they are easily swallowed by the reporting logic. This commit was needed to ensure that the problem described in KT-63665 is reproducible in IC test But some JS IC logic relies on handling compiler exceptions as a signal for scope expansions, and the newly introduced exception logging broke a few tests. To mitigate it, the directive was introduced to disable exception logging for particular test.
This commit is contained in:
committed by
Space Team
parent
7398f9e4e0
commit
6dfcc927f4
+12
-1
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.parseCommandLineArguments
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.*
|
||||
import org.jetbrains.kotlin.incremental.utils.TestCompilationResult
|
||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
||||
import org.junit.Assert
|
||||
import java.io.File
|
||||
@@ -79,6 +80,11 @@ abstract class AbstractIncrementalCompilerRunnerTestBase<Args : CommonCompilerAr
|
||||
fun Iterable<File>.relativePaths() =
|
||||
map { it.relativeTo(workingDir).path.replace('\\', '/') }
|
||||
|
||||
val reportInternalCompilerErrors =
|
||||
File(testDir, InTextDirectivesUtils.DIRECTIVES_FILE_NAME).takeIf { it.exists() && it.isFile }?.let {
|
||||
InTextDirectivesUtils.isDirectiveDefined(it.readText(), "// HIDE_INTERNAL_COMPILER_ERRORS")
|
||||
} != true
|
||||
|
||||
val srcDir = File(workingDir, "src").apply { mkdirs() }
|
||||
val cacheDir = File(workingDir, "incremental-data").apply { mkdirs() }
|
||||
val outDir = File(workingDir, "out").apply { mkdirs() }
|
||||
@@ -140,7 +146,12 @@ abstract class AbstractIncrementalCompilerRunnerTestBase<Args : CommonCompilerAr
|
||||
)
|
||||
)
|
||||
actualSB.appendLine(stepLogAsString(step, compiledSources.relativePaths(), compileErrors))
|
||||
actualSBWithoutErrors.appendLine(stepLogAsString(step, compiledSources.relativePaths(), compileErrors, includeErrors = false))
|
||||
actualSBWithoutErrors.appendLine(
|
||||
stepLogAsString(
|
||||
step, compiledSources.relativePaths(), compileErrors,
|
||||
includeErrors = reportInternalCompilerErrors && (lastExitCode == ExitCode.INTERNAL_ERROR)
|
||||
)
|
||||
)
|
||||
step++
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user