@@ -18,8 +18,9 @@ static umf_os_memory_provider_params_t UMF_OS_MEMORY_PROVIDER_PARAMS_TEST =
1818 umfOsMemoryProviderParamsDefault ();
1919
2020std::vector<unsigned > get_available_numa_nodes () {
21- UT_ASSERTne (numa_available (), -1 );
22- UT_ASSERTne (numa_all_nodes_ptr, nullptr );
21+ if (numa_available () == -1 || numa_all_nodes_ptr == nullptr ) {
22+ return std::vector<unsigned >();
23+ }
2324
2425 std::vector<unsigned > available_numa_nodes;
2526 // Get all available NUMA nodes numbers.
@@ -57,9 +58,6 @@ std::vector<int> get_available_cpus() {
5758}
5859
5960void set_all_available_nodemask_bits (bitmask *nodemask) {
60- UT_ASSERTne (numa_available (), -1 );
61- UT_ASSERTne (numa_all_nodes_ptr, nullptr );
62-
6361 numa_bitmask_clearall (nodemask);
6462
6563 // Set all available NUMA nodes numbers.
@@ -124,6 +122,24 @@ struct testNuma : testing::Test {
124122struct testNumaOnEachNode : testNuma, testing::WithParamInterface<unsigned > {};
125123struct testNumaOnEachCpu : testNuma, testing::WithParamInterface<int > {};
126124
125+ /*
126+ - In case of the lack of support for NUMA on the system
127+ get_available_numa_nodes() returns an empty vector<unsigned>
128+ - Then in INSTANTIATE_TEST_SUITE_P an empty container is passed as the 3rd arg
129+ (param_generator)
130+ - Therefore INSTANTIATE_TEST_SUITE_P expands to nothing, which causes the test
131+ to fail in the test suite GoogleTestVerification
132+ - GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(testNumaOnEachNode) allows the
133+ test suite testNumaOnEachNode to be uninstantiated, suppressing
134+ the test failure
135+ - Additionally, the fixture testNumaOnEachNode uses SetUp from testNuma before
136+ running every test, thus the test is eventually skipped when the lack of NUMA
137+ support is determined by numa_available()
138+ - (Therefore probably a vector with dummy values could be returned instead of
139+ using the macro)
140+ */
141+ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST (testNumaOnEachNode);
142+
127143INSTANTIATE_TEST_SUITE_P (testNumaNodesAllocations, testNumaOnEachNode,
128144 ::testing::ValuesIn (get_available_numa_nodes()));
129145
0 commit comments