Skip to content

Commit 968bf42

Browse files
projediSpace Team
authored and
Space Team
committed
[K/N] Fix interop_objc_kt56402 with different GCs ^KT-56402
Merge-request: KT-MR-9865 Merged-by: Alexander Shabalin <[email protected]>
1 parent dee3bbb commit 968bf42

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

kotlin-native/backend.native/tests/build.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -5291,7 +5291,9 @@ if (PlatformInfo.isAppleTarget(project)) {
52915291

52925292
interopTest("interop_objc_kt56402") {
52935293
// Test depends on macOS-specific AppKit
5294-
enabled = (project.testTarget == 'macos_x64' || project.testTarget == 'macos_arm64' || project.testTarget == null) && isExperimentalMM
5294+
enabled = (project.testTarget == 'macos_x64' || project.testTarget == 'macos_arm64' || project.testTarget == null)
5295+
&& isExperimentalMM
5296+
&& !isNoopGC // requires some GC
52955297
source = 'interop/objc/kt56402/main.kt'
52965298
interop = "objc_kt56402"
52975299
flags = ["-tr", "-e", "runAllTests"] // Generate test suites, but use custom entrypoint.

kotlin-native/backend.native/tests/interop/objc/kt56402/main.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ fun alloc(ctor: ((ULong) -> Unit) -> ULong): ULong = autoreleasepool {
5353

5454
fun waitDestruction(id: ULong) {
5555
assertTrue(isMainThread())
56-
kotlin.native.internal.GC.collect()
56+
// Make sure the finalizers are not run on the main thread even for STMS.
57+
withWorker {
58+
execute(TransferMode.SAFE, {}) {
59+
kotlin.native.internal.GC.collect()
60+
}.result
61+
}
5762
while (true) {
5863
spin()
5964
if (!(id in aliveObjectIds)) {

0 commit comments

Comments
 (0)