[K/N] Fix tests failing in GC aggressive mode
This commit is contained in:
@@ -97,6 +97,7 @@ ext.isExperimentalMM = !(project.globalTestArgs.contains("-memory-model") &&
|
||||
project.globalTestArgs.contains("strict")) &&
|
||||
project.testTarget != 'wasm32'
|
||||
ext.isNoopGC = project.globalTestArgs.contains("-Xgc=noop")
|
||||
ext.isAggressiveGC = project.globalTestArgs.contains("-Xbinary=gcSchedulerType=aggressive")
|
||||
|
||||
// TODO: It also makes sense to test -g without asserts, and also to test -opt with asserts.
|
||||
if (project.globalTestArgs.contains("-g")) {
|
||||
@@ -5409,6 +5410,9 @@ if (isAppleTarget(project)) {
|
||||
if (isNoopGC) {
|
||||
swiftExtraOpts += ["-D", "NOOP_GC"]
|
||||
}
|
||||
if (isAggressiveGC) {
|
||||
swiftExtraOpts += ["-D", "AGGRESSIVE_GC"]
|
||||
}
|
||||
}
|
||||
|
||||
frameworkTest('testObjCExportNoGenerics') {
|
||||
|
||||
@@ -896,10 +896,6 @@ func testWeakRefs0(frozen: Bool) throws {
|
||||
Holder.ref2 = obj2
|
||||
}
|
||||
|
||||
try assertFalse(Holder.ref1 === nil)
|
||||
try assertFalse(Holder.ref2 === nil)
|
||||
try assertEquals(actual: Holder.deinitialized, expected: 0)
|
||||
|
||||
ValuesKt.gc()
|
||||
|
||||
try assertTrue(Holder.ref1 === nil)
|
||||
@@ -942,9 +938,13 @@ class TestSharedRefs {
|
||||
let ignore = SharedRefs() // Ensures that Kotlin runtime gets initialized.
|
||||
}
|
||||
|
||||
Closure.currentBlock!()
|
||||
// Take the block from Closure to avoid races when block() execution triggers
|
||||
// calling launchInNewThread on another thread (e.g. on the finalizer thread).
|
||||
let block = Closure.currentBlock!
|
||||
Closure.currentBlock = nil
|
||||
|
||||
block()
|
||||
|
||||
return nil
|
||||
}, nil)
|
||||
try! assertEquals(actual: createCode, expected: 0)
|
||||
|
||||
Reference in New Issue
Block a user