diff --git a/test/memspaces/memspace_fixtures.hpp b/test/memspaces/memspace_fixtures.hpp index 52f21c9347..e671caad31 100644 --- a/test/memspaces/memspace_fixtures.hpp +++ b/test/memspaces/memspace_fixtures.hpp @@ -50,7 +50,7 @@ struct numaNodesTest : ::umf_test::test { unsigned long maxNodeId = 0; }; -using isQuerySupportedFunc = bool (*)(size_t); +using isQuerySupportedFunc = void (*)(size_t); using memspaceGetFunc = umf_const_memspace_handle_t (*)(); using memspaceGetParams = std::tuple; @@ -64,9 +64,10 @@ struct memspaceGetTest : ::numaNodesTest, } auto [isQuerySupported, memspaceGet] = this->GetParam(); + isQuerySupported(nodeIds.front()); - if (!isQuerySupported(nodeIds.front())) { - GTEST_SKIP(); + if (IS_SKIPPED_OR_FAILED()) { + return; } hMemspace = memspaceGet(); @@ -80,10 +81,17 @@ struct memspaceProviderTest : ::memspaceGetTest { void SetUp() override { ::memspaceGetTest::SetUp(); - if (::memspaceGetTest::IsSkipped()) { + if (numa_available() == -1 || numa_all_nodes_ptr == nullptr) { GTEST_SKIP(); } + auto [isQuerySupported, memspaceGet] = ::memspaceGetTest::GetParam(); + isQuerySupported(nodeIds.front()); + + if (IS_SKIPPED_OR_FAILED()) { + return; + } + umf_result_t ret = umfMemoryProviderCreateFromMemspace(hMemspace, nullptr, &hProvider); ASSERT_EQ(ret, UMF_RESULT_SUCCESS); diff --git a/test/memspaces/memspace_helpers.hpp b/test/memspaces/memspace_helpers.hpp index 1adee26078..ff6402a36c 100644 --- a/test/memspaces/memspace_helpers.hpp +++ b/test/memspaces/memspace_helpers.hpp @@ -16,6 +16,8 @@ #define SIZE_4K (4096UL) #define SIZE_4M (SIZE_4K * 1024UL) +#define IS_SKIPPED_OR_FAILED() (HasFatalFailure() || IsSkipped()) + /// /// @brief Retrieves the memory policy information for \p ptr. /// @param ptr allocation pointer. diff --git a/test/memspaces/memspace_highest_bandwidth.cpp b/test/memspaces/memspace_highest_bandwidth.cpp index a5bffb41da..1e85276095 100644 --- a/test/memspaces/memspace_highest_bandwidth.cpp +++ b/test/memspaces/memspace_highest_bandwidth.cpp @@ -9,16 +9,20 @@ #include "memspace_internal.h" #include "test_helpers.h" -static bool canQueryBandwidth(size_t nodeId) { +static void canQueryBandwidth(size_t nodeId) { hwloc_topology_t topology = nullptr; int ret = hwloc_topology_init(&topology); - UT_ASSERTeq(ret, 0); + + ASSERT_EQ(ret, 0); + ret = hwloc_topology_load(topology); - UT_ASSERTeq(ret, 0); + + ASSERT_EQ(ret, 0); hwloc_obj_t numaNode = hwloc_get_obj_by_type(topology, HWLOC_OBJ_NUMANODE, nodeId); - UT_ASSERTne(numaNode, nullptr); + + ASSERT_NE(numaNode, nullptr); // Setup initiator structure. struct hwloc_location initiator; @@ -30,7 +34,10 @@ static bool canQueryBandwidth(size_t nodeId) { numaNode, &initiator, 0, &value); hwloc_topology_destroy(topology); - return (ret == 0); + + if (ret != 0) { + GTEST_SKIP() << "ret is equal to " << ret << ", should be " << 0; + } } INSTANTIATE_TEST_SUITE_P(memspaceLowestLatencyTest, memspaceGetTest, diff --git a/test/memspaces/memspace_highest_capacity.cpp b/test/memspaces/memspace_highest_capacity.cpp index 872865251c..986c709614 100644 --- a/test/memspaces/memspace_highest_capacity.cpp +++ b/test/memspaces/memspace_highest_capacity.cpp @@ -60,7 +60,7 @@ TEST_F(memspaceHighestCapacityProviderTest, highestCapacityVerify) { memset(ptr, 0, alloc_size); ASSERT_EQ(ret, UMF_RESULT_SUCCESS); - int nodeId; + int nodeId = 0; ASSERT_NO_FATAL_FAILURE(getNumaNodeByPtr(ptr, &nodeId)); diff --git a/test/memspaces/memspace_lowest_latency.cpp b/test/memspaces/memspace_lowest_latency.cpp index cf921612c3..f8b7c93637 100644 --- a/test/memspaces/memspace_lowest_latency.cpp +++ b/test/memspaces/memspace_lowest_latency.cpp @@ -9,16 +9,20 @@ #include "memspace_internal.h" #include "test_helpers.h" -static bool canQueryLatency(size_t nodeId) { +static void canQueryLatency(size_t nodeId) { hwloc_topology_t topology = nullptr; int ret = hwloc_topology_init(&topology); - UT_ASSERTeq(ret, 0); + + ASSERT_EQ(ret, 0); + ret = hwloc_topology_load(topology); - UT_ASSERTeq(ret, 0); + + ASSERT_EQ(ret, 0); hwloc_obj_t numaNode = hwloc_get_obj_by_type(topology, HWLOC_OBJ_NUMANODE, nodeId); - UT_ASSERTne(numaNode, nullptr); + + ASSERT_NE(numaNode, nullptr); // Setup initiator structure. struct hwloc_location initiator; @@ -30,7 +34,10 @@ static bool canQueryLatency(size_t nodeId) { &initiator, 0, &value); hwloc_topology_destroy(topology); - return (ret == 0); + + if (ret != 0) { + GTEST_SKIP() << "ret is equal to " << ret << ", should be " << 0; + } } INSTANTIATE_TEST_SUITE_P(memspaceLowestLatencyTest, memspaceGetTest,