All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Greg KH <gregkh@linuxfoundation.org>,
	Jiri Kosina <jikos@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Tero Kristo <tero.kristo@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>
Subject: [RFC hid v1 09/10] selftests: hid: ensure the program is correctly pinned
Date: Thu, 24 Nov 2022 16:16:02 +0100	[thread overview]
Message-ID: <20221124151603.807536-10-benjamin.tissoires@redhat.com> (raw)
In-Reply-To: <20221124151603.807536-1-benjamin.tissoires@redhat.com>

Turns out that if bpffs was not mounted, the test was silently passing.

So ensure it passes, but also force the mount of the bpffs in vmtest.sh
so we get passing results.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 tools/testing/selftests/hid/hid_bpf.c | 3 ++-
 tools/testing/selftests/hid/vmtest.sh | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/hid/hid_bpf.c b/tools/testing/selftests/hid/hid_bpf.c
index 4bdd1cfa7d13..3ae544bf24fe 100644
--- a/tools/testing/selftests/hid/hid_bpf.c
+++ b/tools/testing/selftests/hid/hid_bpf.c
@@ -712,7 +712,8 @@ TEST_F(hid_bpf, test_attach_detach)
 
 	/* pin the 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);
diff --git a/tools/testing/selftests/hid/vmtest.sh b/tools/testing/selftests/hid/vmtest.sh
index f124cf6b0d0f..bd60f65acb72 100755
--- a/tools/testing/selftests/hid/vmtest.sh
+++ b/tools/testing/selftests/hid/vmtest.sh
@@ -108,8 +108,10 @@ EOF
 	if [[ "${debug_shell}" != "yes" ]]
 	then
 		touch ${OUTPUT_DIR}/${LOG_FILE}
-		command="set -o pipefail ; ${command} 2>&1 | tee ${OUTPUT_DIR}/${LOG_FILE}"
+		command="mount bpffs -t bpf /sys/fs/bpf/; set -o pipefail ; ${command} 2>&1 | tee ${OUTPUT_DIR}/${LOG_FILE}"
 		post_command="cat ${OUTPUT_DIR}/${LOG_FILE}"
+	else
+		command="mount bpffs -t bpf /sys/fs/bpf/; ${command}"
 	fi
 
 	set +e
-- 
2.38.1


  parent reply	other threads:[~2022-11-24 15:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 15:15 [RFC hid v1 00/10] HID-BPF: add support for in-tree BPF programs Benjamin Tissoires
2022-11-24 15:15 ` [RFC hid v1 01/10] bpftool: generate json output of skeletons Benjamin Tissoires
2022-11-30 23:05   ` Andrii Nakryiko
2022-12-01 14:22     ` Benjamin Tissoires
2022-12-01 18:21       ` Andrii Nakryiko
2022-11-24 15:15 ` [RFC hid v1 02/10] WIP: bpf: allow to pin programs from the kernel when bpffs is mounted Benjamin Tissoires
2022-11-24 15:15 ` [RFC hid v1 03/10] HID: add a tool to convert a bpf source into a generic bpf loader Benjamin Tissoires
2022-11-24 15:15 ` [RFC hid v1 04/10] HID: add the bpf loader that can attach a generic hid-bpf program Benjamin Tissoires
2022-11-25  2:48   ` kernel test robot
2022-11-25  2:48   ` kernel test robot
2022-11-25  8:01   ` kernel test robot
2022-11-24 15:15 ` [RFC hid v1 05/10] HID: add report descriptor override for the X-Keys XK24 Benjamin Tissoires
2022-11-24 15:15 ` [RFC hid v1 06/10] selftests: hid: add vmtest.sh Benjamin Tissoires
2022-11-24 15:16 ` [RFC hid v1 07/10] selftests: hid: Add a variant parameter so we can emulate specific devices Benjamin Tissoires
2022-11-24 15:16 ` [RFC hid v1 08/10] selftests: hid: add XK-24 tests Benjamin Tissoires
2022-11-24 15:16 ` Benjamin Tissoires [this message]
2022-11-24 15:16 ` [RFC hid v1 10/10] wip: vmtest aarch64 Benjamin Tissoires

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=20221124151603.807536-10-benjamin.tissoires@redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tero.kristo@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.