On Tue, Mar 30, 2021 at 01:23:15AM +0000, Song Liu wrote: > > > > On Mar 28, 2021, at 4:26 AM, Jiri Olsa <jolsa@xxxxxxxxxx> 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@xxxxxxxxxx> > > > [...] > > + > > +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