Skip to content

Commit 5213a2e

Browse files
author
Petter Reinholdtsen
committed
Fixed conformance_arena_constraints test failure with no NUMA hardware.
On a system without NUMA support, like GNU Hurd, the test would fail like this: [doctest] doctest version is "2.4.12" [doctest] run with "--help" for options =============================================================================== test/conformance/conformance_arena_constraints.cpp:44: TEST CASE: Test NUMA topology traversal correctness test/conformance/conformance_arena_constraints.cpp:54: FATAL ERROR: REQUIRE( pos != numa_nodes_info.end() ) is NOT correct! values: REQUIRE( {?} != {?} ) logged: Wrong, extra or repeated NUMA node index detected. =============================================================================== [doctest] test cases: 5 | 4 passed | 1 failed | 0 skipped [doctest] assertions: 27 | 26 passed | 1 failed | [doctest] Status: FAILURE! With the fix in place, the test succeed. Fixes #2039
1 parent 34b3d4b commit 5213a2e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/conformance/conformance_arena_constraints.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@ TEST_CASE("Test NUMA topology traversal correctness") {
4747

4848
std::vector<oneapi::tbb::numa_node_id> numa_indexes = oneapi::tbb::info::numa_nodes();
4949
for (const auto& numa_id: numa_indexes) {
50+
// numa_info.index is set to -1 in numa_topology_parsing() if
51+
// no NUMA support is present. No use comparing it with the
52+
// numa_id which is 0 when no NUMA support is present, so
53+
// handle -1 specially.
5054
auto pos = std::find_if(numa_nodes_info.begin(), numa_nodes_info.end(),
51-
[&](const index_info& numa_info){ return numa_info.index == numa_id; }
55+
[&](const index_info& numa_info){ return -1 == numa_info.index || numa_info.index == numa_id; }
5256
);
5357

5458
REQUIRE_MESSAGE(pos != numa_nodes_info.end(), "Wrong, extra or repeated NUMA node index detected.");

0 commit comments

Comments
 (0)