From: Jiri Olsa <olsajiri@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Simon Sundberg <simon.sundberg@kau.se>,
bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH bpf 4/4] selftests/bpf: Add test for kfunc module order
Date: Tue, 8 Oct 2024 19:46:46 +0200 [thread overview]
Message-ID: <ZwVwBiT8XASa7Jy_@krava> (raw)
In-Reply-To: <20241008-fix-kfunc-btf-caching-for-modules-v1-4-dfefd9aa4318@redhat.com>
On Tue, Oct 08, 2024 at 12:35:19PM +0200, Toke Høiland-Jørgensen wrote:
SNIP
> +static int test_run_prog(const struct bpf_program *prog,
> + struct bpf_test_run_opts *opts, int expect_val)
> +{
> + int err;
> +
> + err = bpf_prog_test_run_opts(bpf_program__fd(prog), opts);
> + if (!ASSERT_OK(err, "bpf_prog_test_run_opts"))
> + return err;
> +
> + if (!ASSERT_EQ((int)opts->retval, expect_val, bpf_program__name(prog)))
> + return -EINVAL;
> +
> + return 0;
> +}
> +
> +void test_kfunc_module_order(void)
> +{
> + struct kfunc_module_order *skel;
> + char pkt_data[64] = {};
> + int err = 0;
> +
> + DECLARE_LIBBPF_OPTS(bpf_test_run_opts, test_opts, .data_in = pkt_data,
> + .data_size_in = sizeof(pkt_data));
> +
> + err = load_module("bpf_test_modorder_x.ko",
> + env_verbosity > VERBOSE_NONE);
> + if (!ASSERT_OK(err, "load bpf_test_modorder_x.ko"))
> + return;
> +
> + err = load_module("bpf_test_modorder_y.ko",
> + env_verbosity > VERBOSE_NONE);
> + if (!ASSERT_OK(err, "load bpf_test_modorder_y.ko"))
> + goto exit_modx;
> +
> + skel = kfunc_module_order__open_and_load();
> + if (!ASSERT_OK_PTR(skel, "kfunc_module_order__open_and_load()")) {
> + err = -EINVAL;
> + goto exit_mods;
> + }
> +
> + test_run_prog(skel->progs.call_kfunc_xy, &test_opts, 0);
> + test_run_prog(skel->progs.call_kfunc_yx, &test_opts, 0);
nit, no need to pass expect_val, it's always 0
jirka
next prev parent reply other threads:[~2024-10-08 17:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 10:35 [PATCH bpf 0/4] Fix caching of BTF for kfuncs in the verifier Toke Høiland-Jørgensen
2024-10-08 10:35 ` [PATCH bpf 1/4] bpf: fix kfunc btf caching for modules Toke Høiland-Jørgensen
2024-10-08 17:46 ` Jiri Olsa
2024-10-09 1:43 ` Kumar Kartikeya Dwivedi
2024-10-08 10:35 ` [PATCH bpf 2/4] selftests/bpf: Consolidate kernel modules into common directory Toke Høiland-Jørgensen
2024-10-08 17:46 ` Jiri Olsa
2024-10-08 17:55 ` Toke Høiland-Jørgensen
2024-10-08 18:18 ` Jiri Olsa
2024-10-08 18:23 ` Toke Høiland-Jørgensen
2024-10-09 2:08 ` Alexei Starovoitov
2024-10-09 7:39 ` Toke Høiland-Jørgensen
2024-10-09 23:36 ` Alexei Starovoitov
2024-10-10 8:59 ` Toke Høiland-Jørgensen
2024-10-08 10:35 ` [PATCH bpf 3/4] selftests/bpf: Provide a generic [un]load_module helper Toke Høiland-Jørgensen
2024-10-08 17:54 ` Jiri Olsa
2024-10-09 1:44 ` Kumar Kartikeya Dwivedi
2024-10-08 10:35 ` [PATCH bpf 4/4] selftests/bpf: Add test for kfunc module order Toke Høiland-Jørgensen
2024-10-08 17:46 ` Jiri Olsa [this message]
2024-10-08 18:05 ` Toke Høiland-Jørgensen
2024-10-09 2:09 ` Kumar Kartikeya Dwivedi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZwVwBiT8XASa7Jy_@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sdf@fomichev.me \
--cc=simon.sundberg@kau.se \
--cc=song@kernel.org \
--cc=toke@redhat.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).