Skip to content

Commit

Permalink
GH-37276: [C++] Skip multithread tests on single thread env (#37327)
Browse files Browse the repository at this point in the history
### Rationale for this change

Some tests assume a multi-threaded environment without checking the actual threading capacity. Given that they intend to check the behavior of multi-threaded execution, they should be skipped if there is only one thread available.

### What changes are included in this PR?

`SegmentedAggregationWithMultiThreading` and `InvalidRowsSkippedAsync` are skipped if there is only one thread available in the default ThreadPool.

### Are these changes tested?

Tested on my local machine. Unfortunately there is no single core CI pipeline avaible.

### Are there any user-facing changes?
 No.

* Closes: #37276

Authored-by: Jin Shang <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
  • Loading branch information
js8544 authored Aug 23, 2023
1 parent 7c1e71c commit bfb9219
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cpp/src/arrow/acero/plan_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1623,6 +1623,9 @@ TEST(ExecPlanExecution, SegmentedAggregationWithMultiThreading) {
#ifndef ARROW_ENABLE_THREADING
GTEST_SKIP() << "Test requires threading enabled";
#endif
if (internal::GetCpuThreadPool()->GetCapacity() < 2) {
GTEST_SKIP() << "Test requires at least 2 threads";
}
BatchesWithSchema data;
data.batches = {ExecBatchFromJSON({int32()}, "[[1]]")};
data.schema = schema({field("i32", int32())});
Expand Down
3 changes: 3 additions & 0 deletions cpp/src/arrow/csv/reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ TEST(StreamingReaderTests, InvalidRowsSkipped) {
TestInvalidRowsSkipped(MakeStreamingFactory(/*use_threads=*/false), /*async=*/false);
}
TEST(StreamingReaderTests, InvalidRowsSkippedAsync) {
if (internal::GetCpuThreadPool()->GetCapacity() < 2) {
GTEST_SKIP() << "Test requires at least 2 threads";
}
TestInvalidRowsSkipped(MakeStreamingFactory(), /*async=*/true);
}

Expand Down

0 comments on commit bfb9219

Please sign in to comment.