selftests: hid: enforce new attach API
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Fri, 13 Jan 2023 09:09:33 +0000 (10:09 +0100)
committerJiri Kosina <jkosina@suse.cz>
Wed, 18 Jan 2023 21:08:38 +0000 (22:08 +0100)
Now that the new API for hid_bpf_attach_prog() is in place, ensure we
get an fd when calling this function. And remove the fallback code.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
tools/testing/selftests/hid/hid_bpf.c

index 9a262fe..2cf96f8 100644 (file)
@@ -638,11 +638,7 @@ TEST_F(hid_bpf, test_attach_detach)
        LOAD_PROGRAMS(progs);
 
        link = self->hid_links[0];
-       /* we might not be using the new code path where hid_bpf_attach_prog()
-        * returns a link.
-        */
-       if (!link)
-               link = bpf_program__fd(self->skel->progs.hid_first_event);
+       ASSERT_GT(link, 0) TH_LOG("HID-BPF link not created");
 
        /* inject one event */
        buf[0] = 1;