Skip to content

Commit

Permalink
Merge pull request #3303 from sanvila/main
Browse files Browse the repository at this point in the history
[TEST] Skip parallel tests on machines having a single CPU
  • Loading branch information
eseiler authored Nov 11, 2024
2 parents 3b4f644 + 54e011d commit 89cc4d3
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions test/unit/contrib/parallel/buffer_queue_parallel_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
template <typename sequential_push_t, typename sequential_pop_t>
void test_buffer_queue_wait_status()
{
size_t thread_count = std::thread::hardware_concurrency();

// limit thread count as virtualbox (used by Travis) seems to have problems with thread congestion
if (thread_count > 4)
thread_count = 4;
// At least two threads (one producer and one consumer), at most 4 threads (avoid congestion).
size_t thread_count = std::clamp<size_t>(std::thread::hardware_concurrency(), 2u, 4u);

size_t writer_count = thread_count / 2;
if constexpr (sequential_push_t::value)
Expand Down Expand Up @@ -129,11 +126,9 @@ void test_buffer_queue_wait_throw(size_t initialCapacity)
}

volatile std::atomic<size_t> chk_sum2 = 0;
size_t thread_count = std::thread::hardware_concurrency();

// limit thread count as virtualbox (used by Travis) seems to have problems with thread congestion
if (thread_count > 4)
thread_count = 4;
// At least two threads (one producer and one consumer), at most 4 threads (avoid congestion).
size_t thread_count = std::clamp<size_t>(std::thread::hardware_concurrency(), 2u, 4u);

size_t writer_count = thread_count / 2;
if constexpr (sequential_push_t::value)
Expand Down

0 comments on commit 89cc4d3

Please sign in to comment.