Skip to content

Commit 07031a1

Browse files
committed
[Tests] Fix LongRefcounting test.
We were retaining one too many times in the two `_DeathTest` tests, which caused the tests to fail. This was previously masked by a bug. rdar://124212794
1 parent b06fb74 commit 07031a1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

stdlib/public/runtime/RefCount.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#include <cstdio>
14+
1315
#include "swift/Runtime/HeapObject.h"
1416

1517
namespace swift {

unittests/runtime/LongTests/LongRefcounting.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ TEST(LongRefcountingTest, unowned_retain_overflow_DeathTest) {
282282
auto object = allocTestObject(&deinited, 1);
283283

284284
// URC is 1. Retain to maxURC, then retain again and verify overflow error.
285-
unownedRetainALot<true>(object, maxURC);
285+
unownedRetainALot<true>(object, maxURC - 1);
286286
EXPECT_EQ(0u, deinited);
287287
EXPECT_ALLOCATED(object);
288288
ASSERT_DEATH(swift_unownedRetain(object),
@@ -329,7 +329,7 @@ TEST(LongRefcountingTest, nonatomic_unowned_retain_overflow_DeathTest) {
329329
auto object = allocTestObject(&deinited, 1);
330330

331331
// URC is 1. Retain to maxURC, then retain again and verify overflow error.
332-
unownedRetainALot<false>(object, maxURC);
332+
unownedRetainALot<false>(object, maxURC - 1);
333333
EXPECT_EQ(0u, deinited);
334334
EXPECT_ALLOCATED(object);
335335
ASSERT_DEATH(swift_nonatomic_unownedRetain(object),

0 commit comments

Comments
 (0)