[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YGOD2xtqR+zMw0o8@krava>
Date: Tue, 30 Mar 2021 22:02:35 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Song Liu <songliubraving@...com>
Cc: Jiri Olsa <jolsa@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andriin@...com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
Martin Lau <kafai@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [RFC PATCH bpf-next 2/4] selftests/bpf: Add re-attach test to
fentry_test
On Tue, Mar 30, 2021 at 01:23:15AM +0000, Song Liu wrote:
>
>
> > On Mar 28, 2021, at 4:26 AM, Jiri Olsa <jolsa@...nel.org> wrote:
> >
> > Adding the test to re-attach (detach/attach again) tracing
> > fentry programs, plus check that already linked program can't
> > be attached again.
> >
> > Fixing the number of check-ed results, which should be 8.
> >
> > Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> >
> [...]
> > +
> > +void test_fentry_test(void)
> > +{
> > + struct fentry_test *fentry_skel = NULL;
> > + struct bpf_link *link;
> > + int err;
> > +
> > + fentry_skel = fentry_test__open_and_load();
> > + if (CHECK(!fentry_skel, "fentry_skel_load", "fentry skeleton failed\n"))
> > + goto cleanup;
> > +
> > + err = fentry_test__attach(fentry_skel);
> > + if (CHECK(err, "fentry_attach", "fentry attach failed: %d\n", err))
> > + goto cleanup;
> > +
> > + err = fentry_test(fentry_skel);
> > + if (CHECK(err, "fentry_test", "fentry test failed: %d\n", err))
> > + goto cleanup;
> > +
> > + fentry_test__detach(fentry_skel);
> > +
> > + /* Re-attach and test again */
> > + err = fentry_test__attach(fentry_skel);
> > + if (CHECK(err, "fentry_attach", "fentry re-attach failed: %d\n", err))
> > + goto cleanup;
> > +
> > + link = bpf_program__attach(fentry_skel->progs.test1);
> > + if (CHECK(!IS_ERR(link), "attach_fentry re-attach without detach",
> > + "err: %ld\n", PTR_ERR(link)))
>
> nit: I guess we shouldn't print PTR_ERR(link) when link is not an error code?
> This shouldn't break though.
true, makes no sense.. I'll remove it
thanks,
jirka
Powered by blists - more mailing lists