[K/N] Fix interop_objc_kt56402 with different GCs ^KT-56402

Merge-request: KT-MR-9865
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
This commit is contained in:
Alexander Shabalin
2023-04-28 17:10:07 +00:00
committed by Space Team
parent dee3bbb4bf
commit 968bf424b4
2 changed files with 9 additions and 2 deletions
@@ -5291,7 +5291,9 @@ if (PlatformInfo.isAppleTarget(project)) {
interopTest("interop_objc_kt56402") { interopTest("interop_objc_kt56402") {
// Test depends on macOS-specific AppKit // Test depends on macOS-specific AppKit
enabled = (project.testTarget == 'macos_x64' || project.testTarget == 'macos_arm64' || project.testTarget == null) && isExperimentalMM enabled = (project.testTarget == 'macos_x64' || project.testTarget == 'macos_arm64' || project.testTarget == null)
&& isExperimentalMM
&& !isNoopGC // requires some GC
source = 'interop/objc/kt56402/main.kt' source = 'interop/objc/kt56402/main.kt'
interop = "objc_kt56402" interop = "objc_kt56402"
flags = ["-tr", "-e", "runAllTests"] // Generate test suites, but use custom entrypoint. flags = ["-tr", "-e", "runAllTests"] // Generate test suites, but use custom entrypoint.
@@ -53,7 +53,12 @@ fun alloc(ctor: ((ULong) -> Unit) -> ULong): ULong = autoreleasepool {
fun waitDestruction(id: ULong) { fun waitDestruction(id: ULong) {
assertTrue(isMainThread()) assertTrue(isMainThread())
kotlin.native.internal.GC.collect() // Make sure the finalizers are not run on the main thread even for STMS.
withWorker {
execute(TransferMode.SAFE, {}) {
kotlin.native.internal.GC.collect()
}.result
}
while (true) { while (true) {
spin() spin()
if (!(id in aliveObjectIds)) { if (!(id in aliveObjectIds)) {