summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-03-02 10:25:31 -0500
committerTavian Barnes <tavianator@tavianator.com>2024-03-02 10:25:31 -0500
commit10d6f6c849ce2c6bc6275793c17a4a93c73b80de (patch)
treefacb090bed42741168a28592e15dd101453a9c27
parentabcac506d025ebf6f0d003635ee5b156f549d93f (diff)
downloadbfs-10d6f6c849ce2c6bc6275793c17a4a93c73b80de.tar.xz
tests/ioq: Check that we push and pop the same number of times
-rw-r--r--tests/ioq.c8
1 files changed, 5 insertions, 3 deletions
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);
}