@@ -44,7 +44,7 @@ std::vector<int> get_available_cpus() {
44
44
int ret = sched_getaffinity (0 , sizeof (cpu_set_t ), mask);
45
45
46
46
if (ret != 0 ) {
47
- available_cpus.emplace_back (-__LINE__ );
47
+ available_cpus.emplace_back (-1 );
48
48
CPU_FREE (mask);
49
49
50
50
return available_cpus;
@@ -98,17 +98,17 @@ struct testNuma : testing::Test {
98
98
std::pair<int , bitmask *> retrieve_nodemask (void *addr) {
99
99
struct bitmask *retrieved_nodemask = numa_allocate_nodemask ();
100
100
101
- if (nodemask == nullptr ){
102
- return std::make_pair (__LINE__ , nodemask);
101
+ if (nodemask == nullptr ) {
102
+ return std::make_pair (- 1 , nodemask);
103
103
}
104
-
104
+
105
105
int ret = get_mempolicy (nullptr , retrieved_nodemask->maskp ,
106
106
nodemask->size , addr, MPOL_F_ADDR);
107
107
108
108
if (ret != 0 ) {
109
- return std::make_pair (__LINE__ , retrieved_nodemask);
109
+ return std::make_pair (- 1 , retrieved_nodemask);
110
110
}
111
-
111
+
112
112
return std::pair (0 , retrieved_nodemask);
113
113
}
114
114
@@ -263,10 +263,10 @@ struct testNumaOnEachCpu : testNuma, testing::WithParamInterface<int> {
263
263
int cpuNumber = this ->GetParam ();
264
264
265
265
if (cpuNumber < 0 ) {
266
- GTEST_FAIL () << " ret is not equal to 0 in " << __FILE__ << " : " << -cpuNumber;
266
+ GTEST_FAIL () << " get_available_cpus(): sched_getaffinity() return "
267
+ " value is not equal to 0" ;
267
268
}
268
269
}
269
-
270
270
};
271
271
272
272
INSTANTIATE_TEST_SUITE_P (testNumaNodesAllocationsAllCpus, testNumaOnEachCpu,
@@ -302,7 +302,6 @@ TEST_P(testNumaOnEachCpu, checkModePreferredEmptyNodeset) {
302
302
// Verify we're on the expected CPU
303
303
int cpu_check = sched_getcpu ();
304
304
ASSERT_EQ (cpu, cpu_check);
305
-
306
305
307
306
int numa_node_number = numa_node_of_cpu (cpu);
308
307
printf (" Got CPU: %d, got numa node: %d\n " , cpu, numa_node_number);
@@ -418,14 +417,14 @@ TEST_F(testNuma, checkModeInterleave) {
418
417
EXPECT_NODE_EQ ((char *)ptr + page_size * i, numa_nodes[index ]);
419
418
}
420
419
421
- // bitmask *retrieved_nodemask = retrieve_nodemask(ptr);
422
- auto [fileLine, retrieved_nodemask] = retrieve_nodemask (ptr);
420
+ auto [fileLine, retrieved_nodemask] = retrieve_nodemask (ptr);
423
421
if (fileLine != 0 ) {
424
422
if (retrieved_nodemask == nullptr ) {
425
- GTEST_FAIL () << " retrieved_nodemask is nullptr " << __FILE__ << " : " << fileLine;
426
- }
427
- else {
428
- GTEST_FAIL () << " ret is not equal to 0 " << __FILE__ << " : " << fileLine;
423
+ GTEST_FAIL () << " retrieve_nodemask(): numa_allocate_nodemask() "
424
+ " returned nullptr" ;
425
+ } else {
426
+ GTEST_FAIL () << " retrieve_nodemask(): get_mempolicy() return value "
427
+ " is not equal to 0" ;
429
428
}
430
429
}
431
430
int ret = numa_bitmask_equal (retrieved_nodemask, nodemask);
0 commit comments