staticvoid subtest_dmabuf_iter_check_open_coded(struct dmabuf_iter *skel, int map_fd)
{
LIBBPF_OPTS(bpf_test_run_opts, topts); char key[DMA_BUF_NAME_LEN]; int err, fd; bool found;
/* No need to attach it, just run it directly */
fd = bpf_program__fd(skel->progs.iter_dmabuf_for_each);
err = bpf_prog_test_run_opts(fd, &topts); if (!ASSERT_OK(err, "test_run_opts err")) return; if (!ASSERT_OK(topts.retval, "test_run_opts retval")) return;
if (!ASSERT_OK(bpf_map_get_next_key(map_fd, NULL, key), "get next key")) return;
do {
ASSERT_OK(bpf_map_lookup_elem(map_fd, key, &found), "lookup");
ASSERT_TRUE(found, "found test buffer");
} while (bpf_map_get_next_key(map_fd, key, key));
}
void test_dmabuf_iter(void)
{ struct dmabuf_iter *skel = NULL; int map_fd; constbool f = false;
skel = dmabuf_iter__open_and_load(); if (!ASSERT_OK_PTR(skel, "dmabuf_iter__open_and_load")) return;
map_fd = bpf_map__fd(skel->maps.testbuf_hash); if (!ASSERT_OK_FD(map_fd, "map_fd")) goto destroy_skel;
if (!ASSERT_OK(bpf_map_update_elem(map_fd, udmabuf_test_buffer_name, &f, BPF_ANY), "insert udmabuf")) goto destroy_skel; if (!ASSERT_OK(bpf_map_update_elem(map_fd, sysheap_test_buffer_name, &f, BPF_ANY), "insert sysheap buffer")) goto destroy_skel;
if (!ASSERT_OK(create_test_buffers(), "create_test_buffers")) goto destroy;
if (!ASSERT_OK(dmabuf_iter__attach(skel), "skel_attach")) goto destroy;
if (test__start_subtest("no_infinite_reads"))
subtest_dmabuf_iter_check_no_infinite_reads(skel); if (test__start_subtest("default_iter"))
subtest_dmabuf_iter_check_default_iter(skel); if (test__start_subtest("open_coded"))
subtest_dmabuf_iter_check_open_coded(skel, map_fd);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.