From 10d6f6c849ce2c6bc6275793c17a4a93c73b80de Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 2 Mar 2024 10:25:31 -0500 Subject: tests/ioq: Check that we push and pop the same number of times --- tests/ioq.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/ioq.c b/tests/ioq.c index 3d35650..56e1886 100644 --- a/tests/ioq.c +++ b/tests/ioq.c @@ -54,15 +54,17 @@ static void check_ioq_push_block(void) { ioq_cancel(ioq); // Drain the queue - struct ioq_ent *ent; - while ((ent = ioq_pop(ioq, true))) { - bfs_verify(ent->op == IOQ_OPENDIR); + for (size_t i = 0; i < depth; ++i) { + struct ioq_ent *ent = ioq_pop(ioq, true); + bfs_verify(ent && ent->op == IOQ_OPENDIR); + if (ent->result >= 0) { bfs_closedir(ent->opendir.dir); } free(ent->opendir.dir); ioq_free(ioq, ent); } + bfs_verify(!ioq_pop(ioq, true)); ioq_destroy(ioq); } -- cgit v1.2.3