Skip to content

Commit c850bfd

Browse files
author
Davide Italiano
committed
[DebuggerSupport] Mark this test as requiring optimized stdlib.
1 parent 6535d8c commit c850bfd

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/stdlib/DebuggerSupport.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %target-run-simple-swift
22
// REQUIRES: executable_test
3+
// REQUIRES: optimized_stdlib
34

45
import StdlibUnittest
56

@@ -112,10 +113,18 @@ class RefCountedObj {
112113
let RefcountTests = TestSuite("RefCount")
113114
RefcountTests.test("Basic") {
114115
var Obj = RefCountedObj(47);
115-
expectEqual(_getRetainCount(Obj), 2);
116-
expectEqual(_getWeakRetainCount(Obj), 1);
117-
expectEqual(_getUnownedRetainCount(Obj), 1);
118-
let _ = Obj.f() // try to keep the object live here.
116+
117+
// Counters for live objects should be always positive.
118+
// We try to be a little bit more lax here because optimizations
119+
// or different stdlib versions might impact the exact value of
120+
// refcounting, and we're just interested in testing whether the
121+
// stub works properly.
122+
expectGT(_getRetainCount(Obj), 0);
123+
expectGT(_getWeakRetainCount(Obj), 0);
124+
expectGT(_getUnownedRetainCount(Obj), 0);
125+
126+
// Try to keep the object live here.
127+
let _ = Obj.f()
119128
}
120129

121130
runAllTests()

0 commit comments

Comments
 (0)