[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
This commit is contained in:
Alastair Houghton
2024-03-07 16:33:49 +00:00
parent b06fb7439c
commit 07031a1ab5
2 changed files with 4 additions and 2 deletions

View File

@@ -10,6 +10,8 @@
//
//===----------------------------------------------------------------------===//
#include <cstdio>
#include "swift/Runtime/HeapObject.h"
namespace swift {

View File

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