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