Skip to content

Commit

Permalink
selftests: hid: ensure the program is correctly pinned
Browse files Browse the repository at this point in the history
Turns out that if bpffs was not mounted, the test was silently passing.

So ensure it passes by checking the mount command result.

Signed-off-by: Benjamin Tissoires <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
bentiss authored and Jiri Kosina committed Jan 18, 2023
1 parent cea6c4d commit d9db1bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/testing/selftests/hid/hid_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ TEST_F(hid_bpf, test_attach_detach)

/* pin the first program and immediately unpin it */
#define PIN_PATH "/sys/fs/bpf/hid_first_event"
bpf_program__pin(self->skel->progs.hid_first_event, PIN_PATH);
err = bpf_program__pin(self->skel->progs.hid_first_event, PIN_PATH);
ASSERT_OK(err) TH_LOG("error while calling bpf_program__pin");
remove(PIN_PATH);
#undef PIN_PATH
usleep(100000);
Expand Down

0 comments on commit d9db1bb

Please sign in to comment.