Skip to content

Commit 548de3d

Browse files
committed
io_uring: address review nits in BoundedInjectedCompletionsPerEvent
Per ravenblackx review: tighten EXPECT_GE to EXPECT_EQ since the eventfd is only written by IoUring's self-poke, so the callback fires exactly 3 times for 3+3+1. Also unify event_callback_invocations to int32_t for consistency with the other counters.
1 parent 448fb78 commit 548de3d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

test/common/io/io_uring_impl_test.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ TEST_F(IoUringImplTest, BoundedInjectedCompletionsPerEvent) {
283283
const Event::FileTriggerType trigger = Event::PlatformDefaultTriggerType;
284284

285285
int32_t total_completions = 0;
286-
uint32_t event_callback_invocations = 0;
286+
int32_t event_callback_invocations = 0;
287287
std::vector<int32_t> per_invocation_counts;
288288

289289
auto file_event = dispatcher->createFileEvent(
@@ -314,9 +314,11 @@ TEST_F(IoUringImplTest, BoundedInjectedCompletionsPerEvent) {
314314
waitForCondition(*dispatcher, [&total_completions]() { return total_completions == 7; });
315315

316316
// Each tick after the first must have been driven by the eventfd self-poke since we never
317-
// called activate() again — proving the re-arm path works.
317+
// called activate() again — proving the re-arm path works. With cap=3 and 7 injected
318+
// completions the drain must split exactly 3 + 3 + 1 across three ticks, and the eventfd
319+
// is only written by IoUring itself, so the callback is invoked exactly 3 times.
318320
EXPECT_EQ(7, total_completions);
319-
EXPECT_GE(event_callback_invocations, 3u);
321+
EXPECT_EQ(3, event_callback_invocations);
320322
EXPECT_EQ(3, per_invocation_counts[0]);
321323
EXPECT_EQ(3, per_invocation_counts[1]);
322324
EXPECT_EQ(1, per_invocation_counts[2]);

0 commit comments

Comments
 (0)