[K/N] XCTest launcher for CompilerOutput's TEST_BUNDLE

This change adds a Native Obj-C launcher that implements XCTestCase
and overrides defaultTestSuite property to provide XCTest with generated
test suites and test cases.

The defaultTestSuite method is essentially a starting point with runtime
initialization. It requires a `Konan_create_testSuite()` method to be
implemented in a Kotlin library that returns a list of XCTestCases.

This launcher should be compiled as a TEST_BUNDLE to be used then with
XCTest.

This commit is a part of ^KT-58928


Co-authored-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>

Merge-request: KT-MR-12841
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
This commit is contained in:
Pavel Punegov
2023-11-07 11:56:08 +00:00
committed by Space Team
parent d6acba1c33
commit 0d8960088e
6 changed files with 65 additions and 1 deletions
@@ -93,11 +93,14 @@ private fun collectLlvmModules(generationState: NativeGenerationState, generated
val additionalBitcodeFilesToLink = generationState.llvm.additionalProducedBitcodeFiles
val exceptionsSupportNativeLibrary = listOf(config.exceptionsSupportNativeLibrary)
.takeIf { config.produce == CompilerOutputKind.DYNAMIC_CACHE }.orEmpty()
val xcTestRunnerNativeLibrary = listOf(config.xcTestLauncherNativeLibrary)
.takeIf { config.produce == CompilerOutputKind.TEST_BUNDLE }.orEmpty()
val additionalBitcodeFiles = nativeLibraries +
generatedBitcodeFiles +
additionalBitcodeFilesToLink +
bitcodeLibraries +
exceptionsSupportNativeLibrary
exceptionsSupportNativeLibrary +
xcTestRunnerNativeLibrary
val runtimeNativeLibraries = config.runtimeNativeLibraries
@@ -405,6 +405,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
internal val objCNativeLibrary: String =
File(distribution.defaultNatives(target)).child("objc.bc").absolutePath
internal val xcTestLauncherNativeLibrary: String =
File(distribution.defaultNatives(target)).child("xctest_launcher.bc").absolutePath
internal val exceptionsSupportNativeLibrary: String =
File(distribution.defaultNatives(target)).child("exceptionsSupport.bc").absolutePath