Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp9063814rwb; Thu, 24 Nov 2022 07:38:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf7BIsG47+2N69s7F+3iISCLKJQGsJQgtcSt2sWz5unXtCAcJNEH/6tvqYvu2Pa5vXrAfWpp X-Received: by 2002:a17:906:a58:b0:7ad:b45c:dbca with SMTP id x24-20020a1709060a5800b007adb45cdbcamr16736079ejf.388.1669304304802; Thu, 24 Nov 2022 07:38:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669304304; cv=none; d=google.com; s=arc-20160816; b=xuH44RUgeJQvXGBiBIyurbGYkMT+5b4IzV2ur5jSHOj0Hwg/s0ixzgJkGbqCY9tvn/ mnDtuigrSyODrkwTiRlvlEj53suoLjgKolRq6+dh/0ZehRvd8mDuKiRIA4wG7cMsSQT6 /Dc5Z4tYunwht6DJSa1n19xBCiQ+4bQp29CmE6sBeDKbZYlZ5qoH/o1dXHIvcIf8TuCm yx/xrqh0V6AdmKQorrGbBJ6h+ILLOc8hJkC6oLhujgRHbqiJ++FpeB+OsSX8f3v+csIf oASEbGuQp1LJZs3meGVWzAmvkmBAMKU8EM4Hm1XbKlZNy2Yfms9sDYsAcrvzOTm7/GaX 2mbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YVpzZ9PuKYYYwbqGuIV03fYvtpDzSokFyED3tXA9BEI=; b=GrtUzhtw0QH0nxL6tYxHoVsyoadwxxGmFlEN6XUTHeV5DT72DQj5dy2BzC7ooMd0mx pnryQi68v+9/ZQro/oI57eAGliF/TDi5i7WMhnAhg1neVfxfZSRyNuNdArPJuPGucDgq QL2cuKRrWe6Yv0PC6gYH23YZPIaP7KNEbhehSGN5RvkghMyTn7uL/O09+c/xa2+YGPgu SXMvPKO5oef8UQDOl7XzOdRHzDtFCucxBqRQrYhfzU4o/z56IIUQudbdideD+U3vtKDW BJT6DpxkP+esNsCNzmpYF6mgewua9hn9+LGrWFbsbscz/tqyWTvJSPLZPGdtkPYgE0JT ucjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B36Q3UMc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b17-20020aa7df91000000b0045d539f05a8si984947edy.576.2022.11.24.07.38.03; Thu, 24 Nov 2022 07:38:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B36Q3UMc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230094AbiKXPTx (ORCPT + 86 others); Thu, 24 Nov 2022 10:19:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230092AbiKXPTH (ORCPT ); Thu, 24 Nov 2022 10:19:07 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71B1316FB05 for ; Thu, 24 Nov 2022 07:16:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669302993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YVpzZ9PuKYYYwbqGuIV03fYvtpDzSokFyED3tXA9BEI=; b=B36Q3UMcI3tslgV4ugcVbiS3nMZJOWJby466rsrTGalxKcMkNFY18drczPk1itHTa7tywc 2EINR4TZAA+9aW2iY6daK/cKVetT9juW4wuD1Zx4C8QqLFHsf4/2uj1NEUzP34Pbl2Mk3P MHbcwkAnjKO97GQptIkA2DyvZ/kQ0nE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-246-nlR9u26LOHi58kiUJjaWYA-1; Thu, 24 Nov 2022 10:16:28 -0500 X-MC-Unique: nlR9u26LOHi58kiUJjaWYA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B97293C01E0F; Thu, 24 Nov 2022 15:16:27 +0000 (UTC) Received: from plouf.redhat.com (unknown [10.39.193.200]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06D4940C2064; Thu, 24 Nov 2022 15:16:25 +0000 (UTC) From: Benjamin Tissoires To: Greg KH , Jiri Kosina , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Dmitry Torokhov Cc: Tero Kristo , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Benjamin Tissoires Subject: [RFC hid v1 09/10] selftests: hid: ensure the program is correctly pinned Date: Thu, 24 Nov 2022 16:16:02 +0100 Message-Id: <20221124151603.807536-10-benjamin.tissoires@redhat.com> In-Reply-To: <20221124151603.807536-1-benjamin.tissoires@redhat.com> References: <20221124151603.807536-1-benjamin.tissoires@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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