@@ -18,8 +18,9 @@ static umf_os_memory_provider_params_t UMF_OS_MEMORY_PROVIDER_PARAMS_TEST =
18
18
umfOsMemoryProviderParamsDefault ();
19
19
20
20
std::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
+ }
23
24
24
25
std::vector<unsigned > available_numa_nodes;
25
26
// Get all available NUMA nodes numbers.
@@ -57,9 +58,6 @@ std::vector<int> get_available_cpus() {
57
58
}
58
59
59
60
void set_all_available_nodemask_bits (bitmask *nodemask) {
60
- UT_ASSERTne (numa_available (), -1 );
61
- UT_ASSERTne (numa_all_nodes_ptr, nullptr );
62
-
63
61
numa_bitmask_clearall (nodemask);
64
62
65
63
// Set all available NUMA nodes numbers.
@@ -124,6 +122,24 @@ struct testNuma : testing::Test {
124
122
struct testNumaOnEachNode : testNuma, testing::WithParamInterface<unsigned > {};
125
123
struct testNumaOnEachCpu : testNuma, testing::WithParamInterface<int > {};
126
124
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
+
127
143
INSTANTIATE_TEST_SUITE_P (testNumaNodesAllocations, testNumaOnEachNode,
128
144
::testing::ValuesIn (get_available_numa_nodes()));
129
145
0 commit comments