Skip to content

Commit 3bdfbe4

Browse files
committed
Skip allocsSpreadAcrossAllNumaNodes test...
instead of failing. Arbitrary free space can't be guaranteed during the test runtime, hence not meeting the free space requirement should warrant a skip not a fail.
1 parent cb6b8bb commit 3bdfbe4

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

test/memspaces/memspace_host_all.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -173,29 +173,23 @@ TEST_F(memspaceHostAllProviderTest, allocsSpreadAcrossAllNumaNodes) {
173173
long long numaFreeSize = 0;
174174
long long numaSize = numa_node_size64(id, &numaFreeSize);
175175
UT_ASSERTne(numaSize, -1);
176-
UT_ASSERT(numaFreeSize >= (long long)(remainingSpace + size));
176+
if (numaFreeSize < (long long)(remainingSpace + size)) {
177+
GTEST_SKIP() << "Test skipped, not enough memory on numa node #"
178+
<< id;
179+
}
177180

178181
numaCombinedFreeSize += numaFreeSize;
179182
}
180183

181184
umf_result_t umf_ret = UMF_RESULT_SUCCESS;
182-
// Create allocations until all the NUMA nodes until there's space only for
183-
// one allocation.
185+
// Create allocations until there's space only 'remainingSpace' bytes
186+
// of memory left.
184187
std::vector<void *> allocs;
185188
std::unordered_set<size_t> allocNodeIds;
186189
while (numaCombinedFreeSize >= (long long)(remainingSpace + size)) {
187190
void *ptr = nullptr;
188191
umf_ret = umfMemoryProviderAlloc(hProvider, size, alignment, &ptr);
189-
if (umf_ret != UMF_RESULT_SUCCESS) {
190-
UT_ASSERTeq(umf_ret, UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC);
191-
const char *msg = nullptr;
192-
int32_t err = 0;
193-
umfMemoryProviderGetLastNativeError(hProvider, &msg, &err);
194-
// In this scenario, 'UMF_OS_RESULT_ERROR_ALLOC_FAILED' indicates OOM.
195-
UT_ASSERTeq(err, UMF_OS_RESULT_ERROR_ALLOC_FAILED);
196-
break;
197-
}
198-
192+
UT_ASSERTeq(umf_ret, UMF_RESULT_SUCCESS);
199193
UT_ASSERTne(ptr, nullptr);
200194
// Access the allocation, so that all the pages associated with it are
201195
// allocated on available NUMA nodes.

0 commit comments

Comments
 (0)