On Thu, May 8, 2025 at 11:20 AM T.J. Mercier <tjmerc...@google.com> wrote: [...]
> + > +void test_dmabuf_iter(void) > +{ > + struct dmabuf_iter *skel = NULL; > + char buf[256]; > + int iter_fd; > + > + skel = dmabuf_iter__open_and_load(); > + if (!ASSERT_OK_PTR(skel, "dmabuf_iter__open_and_load")) > + return; > + > + if (!ASSERT_OK(create_test_buffers(), "create_buffers")) > + goto destroy; > + > + if (!ASSERT_OK(dmabuf_iter__attach(skel), "skel_attach")) > + goto destroy; >From here... > + iter_fd = bpf_iter_create(bpf_link__fd(skel->links.dmabuf_collector)); > + if (!ASSERT_OK_FD(iter_fd, "iter_create")) > + goto destroy; > + > + while (read(iter_fd, buf, sizeof(buf)) > 0) > + ; /* Read out all contents */ > + > + /* Next reads should return 0 */ > + ASSERT_EQ(read(iter_fd, buf, sizeof(buf)), 0, "read"); to here, can be a separate subtest. Then iter_fd can be moved to that subtest. > + > + if (test__start_subtest("default_iter")) > + subtest_dmabuf_iter_check_default_iter(skel); > + > + close(iter_fd); > + > +destroy: > + destroy_test_buffers(); > + dmabuf_iter__destroy(skel); [...]