Skip to content

Commit

Permalink
Bug various test failures on arm (#334)
Browse files Browse the repository at this point in the history
This PR fixes a couple of test failures on ARM being caused by different
behaviour of the TSC and the numa library.
  • Loading branch information
danielealbano committed Apr 13, 2023
1 parent 66aea93 commit 965b446
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/unit_tests/test-epoch-operation-queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ TEST_CASE("epoch_operation_queue.c", "[epoch_operation_queue]") {
epoch_operation_queue_operation_t *op2 = epoch_operation_queue_enqueue(epoch_operation_queue);

REQUIRE(op2 != nullptr);
REQUIRE(op2->data.start_epoch > op1->data.start_epoch);
REQUIRE(op2->data.start_epoch < intrinsics_tsc());
REQUIRE(op2->data.start_epoch >= op1->data.start_epoch);
REQUIRE(op2->data.start_epoch <= intrinsics_tsc());
REQUIRE(op2->data.completed == false);
REQUIRE(&op2->_packed == &epoch_operation_queue->ring->items[1]);
REQUIRE(ring_bounded_queue_spsc_uint64_get_length(epoch_operation_queue->ring) == 2);
Expand Down
11 changes: 8 additions & 3 deletions tests/unit_tests/test-utils-numa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <unistd.h>
#include <numa.h>

#include "misc.h"
#include "utils_numa.h"

TEST_CASE("utils_numa.c", "[utils_numa]") {
Expand All @@ -19,12 +20,16 @@ TEST_CASE("utils_numa.c", "[utils_numa]") {
}

SECTION("utils_numa_node_configured_count") {
REQUIRE(utils_numa_node_configured_count() == numa_num_configured_nodes());
int count = numa_num_configured_nodes();
if (count == 0) {
count = 1;
}
REQUIRE(utils_numa_node_configured_count() == count);
}

SECTION("utils_numa_node_current_index") {
uint32_t numa_node_index;
getcpu(NULL, &numa_node_index);
getcpu(nullptr, &numa_node_index);

REQUIRE(utils_numa_node_current_index() == numa_node_index);
}
Expand All @@ -39,7 +44,7 @@ TEST_CASE("utils_numa.c", "[utils_numa]") {

SECTION("utils_numa_cpu_current_index") {
uint32_t cpu_index;
getcpu(&cpu_index, NULL);
getcpu(&cpu_index, nullptr);

REQUIRE(utils_numa_cpu_current_index() == cpu_index);
}
Expand Down

0 comments on commit 965b446

Please sign in to comment.