[K/N][Tests] Rename compileToExecutable to reflect its one-staged behavior
^KT-66014
This commit is contained in:
committed by
Space Team
parent
35acade031
commit
b6a6b12f0f
+2
-3
@@ -54,9 +54,8 @@ abstract class AbstractNativeCInteropKT39120Test : AbstractNativeCInteropBaseTes
|
||||
val module = TestModule.Exclusive(DEFAULT_MODULE_NAME, emptySet(), emptySet(), emptySet()).apply {
|
||||
files += TestFile.createCommitted(ktFile, this)
|
||||
}
|
||||
// KT-66014: TODO convert compileToExecutable() to TestCompilationFactory.testCasesToExecutable(),
|
||||
// to respect possible `mode=TWO_STAGE_MULTI_MODULE`: factory would then add intermediate LibraryCompilation(kt->klib).
|
||||
val compilationResult = compileToExecutable(
|
||||
// KT-39120 is irrelevant to compiler backend, so executable can be compiled in the simplest way, without splitting to stages.
|
||||
val compilationResult = compileToExecutableInOneStage(
|
||||
createTestCaseNoTestRun(module, TestCompilerArgs.EMPTY),
|
||||
klib1.asLibraryDependency(),
|
||||
klib2.asLibraryDependency()
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ class CachesAutoBuildTest : AbstractNativeSimpleTest() {
|
||||
vararg dependencies: KLIB
|
||||
): File {
|
||||
autoCacheDir.mkdirs()
|
||||
return compileToExecutable(
|
||||
return compileToExecutableInOneStage(
|
||||
sourcesDir,
|
||||
tryPassSystemCacheDirectory = false, // With auto-cache mode, the compiler chooses the system cache directory itself.
|
||||
freeCompilerArgs = TestCompilerArgs(
|
||||
|
||||
+2
-2
@@ -78,9 +78,9 @@ class CInteropPackagesTest : AbstractNativeSimpleTest() {
|
||||
freeCompilerArgs = TestCompilerArgs.EMPTY
|
||||
).assertSuccess().resultingArtifact
|
||||
|
||||
// KT-66014: TODO convert compileToExecutable() to TestCompilationFactory.testCasesToExecutable(),
|
||||
// KT-66014: TODO convert compileToExecutableInOneStage() to TestCompilationFactory.testCasesToExecutable(),
|
||||
// to respect possible `mde=TWO_STAGE_MULTI_MODULE`: factory would then add intermediate LibraryCompilation(kt->klib).
|
||||
compileToExecutable(
|
||||
compileToExecutableInOneStage(
|
||||
generateTestCaseWithSingleFile(
|
||||
sourceFile = ktFile,
|
||||
testKind = TestKind.STANDALONE_NO_TR,
|
||||
|
||||
+2
-2
@@ -56,13 +56,13 @@ class InfrastructureDumpedTestListingTest : AbstractNativeSimpleTest() {
|
||||
if (fromSources) {
|
||||
// Compile test, NOT respecting possible `mode=TWO_STAGE_MULTI_MODULE`: don't add intermediate LibraryCompilation(kt->klib).
|
||||
// KT-66014: Extract this test from usual Native test run, and run it in scope of new test module
|
||||
barTestCase to compileToExecutable(barTestCase, fooLibrary.asLibraryDependency())
|
||||
barTestCase to compileToExecutableInOneStage(barTestCase, fooLibrary.asLibraryDependency())
|
||||
} else {
|
||||
val barCompilationResult: Success<out KLIB> = compileToLibrary(barTestCase, fooLibrary.asLibraryDependency())
|
||||
val barLibrary: KLIB = barCompilationResult.resultingArtifact
|
||||
|
||||
val executableTestCase = generateTestCaseWithSingleModule(moduleDir = null) // No sources.
|
||||
executableTestCase to compileToExecutable(
|
||||
executableTestCase to compileToExecutableInOneStage(
|
||||
executableTestCase,
|
||||
fooLibrary.asLibraryDependency(),
|
||||
barLibrary.asIncludedLibraryDependency()
|
||||
|
||||
+2
-5
@@ -11,9 +11,6 @@ import kotlinx.metadata.KmClass
|
||||
import kotlinx.metadata.KmDeclarationContainer
|
||||
import kotlinx.metadata.klib.KlibModuleMetadata
|
||||
import kotlinx.metadata.klib.annotations
|
||||
import org.jetbrains.kotlin.backend.common.serialization.*
|
||||
import org.jetbrains.kotlin.backend.common.serialization.proto.*
|
||||
import org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclaration.DeclaratorCase.*
|
||||
import org.jetbrains.kotlin.konan.file.unzipTo
|
||||
import org.jetbrains.kotlin.konan.file.zipDirAs
|
||||
import org.jetbrains.kotlin.konan.test.blackbox.support.EnforcedHostTarget
|
||||
@@ -58,9 +55,9 @@ class KT59030WorkaroundTest : AbstractNativeSimpleTest() {
|
||||
).assertSuccess().resultingArtifact
|
||||
spoilDeprecatedAnnotationsInLibrary(library)
|
||||
|
||||
// Compile test, NOT respecting possible `mode=TWO_STAGE_MULTI_MODULE`: don't add intermediate LibraryCompilation(kt->klib).
|
||||
// For this test it's ok to compile executable in the simplest way, not respecting possible `mode=TWO_STAGE_MULTI_MODULE`
|
||||
// KT-66014: Extract this test from usual Native test run, and run it in scope of new test module
|
||||
compileToExecutable(
|
||||
compileToExecutableInOneStage(
|
||||
generateTestCaseWithSingleFile(
|
||||
sourceFile = File(MAIN_FILE_PATH),
|
||||
testKind = TestKind.STANDALONE_NO_TR,
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ class KlibResolverTest : AbstractNativeSimpleTest() {
|
||||
// Compile test, NOT respecting possible `mode=TWO_STAGE_MULTI_MODULE`: don't add intermediate LibraryCompilation(kt->klib).
|
||||
// KT-66014: Extract this test from usual Native test run, and run it in scope of new test module
|
||||
val executableResult =
|
||||
compileToExecutable(testCase, klibResult.resultingArtifact.asLibraryDependency()).assertSuccess()
|
||||
compileToExecutableInOneStage(testCase, klibResult.resultingArtifact.asLibraryDependency()).assertSuccess()
|
||||
val testExecutable = TestExecutable(
|
||||
executableResult.resultingArtifact,
|
||||
executableResult.loggedData,
|
||||
|
||||
+8
-9
@@ -94,7 +94,7 @@ internal class ExecutableBuilder(
|
||||
|
||||
// WARNING: compiles in one-stage mode (sources->executable) even when `mode=TWO_STAGE_MULTI_MODULE`
|
||||
override fun build(sourcesDir: File, outputDir: File, dependencies: List<TestCompilationArtifact.KLIB>) =
|
||||
test.compileToExecutable(
|
||||
test.compileToExecutableInOneStage(
|
||||
sourcesDir,
|
||||
tryPassSystemCacheDirectory,
|
||||
freeCompilerArgs = if (freeCompilerArgs.isEmpty()) TestCompilerArgs.EMPTY else TestCompilerArgs(freeCompilerArgs),
|
||||
@@ -164,30 +164,29 @@ internal class CompiledExecutable(
|
||||
}
|
||||
|
||||
// WARNING: compiles in one-stage mode (sources->executable) even when `mode=TWO_STAGE_MULTI_MODULE`
|
||||
internal fun AbstractNativeSimpleTest.compileToExecutable(
|
||||
internal fun AbstractNativeSimpleTest.compileToExecutableInOneStage(
|
||||
sourcesDir: File,
|
||||
tryPassSystemCacheDirectory: Boolean,
|
||||
freeCompilerArgs: TestCompilerArgs,
|
||||
vararg dependencies: TestCompilationArtifact.KLIB
|
||||
) = compileToExecutable(sourcesDir, tryPassSystemCacheDirectory, freeCompilerArgs, dependencies.asList())
|
||||
) = compileToExecutableInOneStage(sourcesDir, tryPassSystemCacheDirectory, freeCompilerArgs, dependencies.asList())
|
||||
|
||||
// WARNING: compiles in one-stage mode (sources->executable) even when `mode=TWO_STAGE_MULTI_MODULE`
|
||||
internal fun AbstractNativeSimpleTest.compileToExecutable(
|
||||
internal fun AbstractNativeSimpleTest.compileToExecutableInOneStage(
|
||||
sourcesDir: File,
|
||||
tryPassSystemCacheDirectory: Boolean,
|
||||
freeCompilerArgs: TestCompilerArgs,
|
||||
dependencies: List<TestCompilationArtifact.KLIB>
|
||||
): CompiledExecutable {
|
||||
val testCase: TestCase = generateTestCaseWithSingleModule(sourcesDir, freeCompilerArgs)
|
||||
val compilationResult = compileToExecutable(testCase, tryPassSystemCacheDirectory, dependencies.map { it.asLibraryDependency() })
|
||||
val compilationResult = compileToExecutableInOneStage(testCase, tryPassSystemCacheDirectory, dependencies.map { it.asLibraryDependency() })
|
||||
return CompiledExecutable(testCase, compilationResult.assertSuccess())
|
||||
}
|
||||
|
||||
// WARNING: compiles in one-stage mode (sources->executable) even when `mode=TWO_STAGE_MULTI_MODULE`
|
||||
internal fun AbstractNativeSimpleTest.compileToExecutable(testCase: TestCase, vararg dependencies: TestCompilationDependency<*>) =
|
||||
compileToExecutable(testCase, true, dependencies.asList())
|
||||
internal fun AbstractNativeSimpleTest.compileToExecutableInOneStage(testCase: TestCase, vararg dependencies: TestCompilationDependency<*>) =
|
||||
compileToExecutableInOneStage(testCase, true, dependencies.asList())
|
||||
|
||||
// WARNING: compiles in one-stage mode (sources->static cache) even when `mode=TWO_STAGE_MULTI_MODULE`
|
||||
internal fun AbstractNativeSimpleTest.compileToStaticCache(
|
||||
klib: TestCompilationArtifact.KLIB,
|
||||
cacheDir: File,
|
||||
@@ -317,7 +316,7 @@ private fun AbstractNativeSimpleTest.compileToLibrary(
|
||||
return compilation.result.assertSuccess()
|
||||
}
|
||||
|
||||
private fun AbstractNativeSimpleTest.compileToExecutable(
|
||||
private fun AbstractNativeSimpleTest.compileToExecutableInOneStage(
|
||||
testCase: TestCase,
|
||||
tryPassSystemCacheDirectory: Boolean,
|
||||
dependencies: List<TestCompilationDependency<*>>
|
||||
|
||||
Reference in New Issue
Block a user