From patchwork Thu Nov 16 03:22:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuran Pereira X-Patchwork-Id: 13457585 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=hotmail.com header.i=@hotmail.com header.b="Pd69ZkF5" Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03olkn2078.outbound.protection.outlook.com [40.92.59.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4E57199; Wed, 15 Nov 2023 19:23:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EwPrRS6O+siegdK2UwgZ7Xd7jYHivMKanZHUyEiUjwz1wNCtQQRF12EWLyy5AnwmjnbfsglSSeqG4nUyBwSJ/nXpygflqnPjPYLWDxZFi9GojVzmcheDPCzkrFbRN6qnsz/r7b1PqHwuVT+Gj+o4b+XkCzT2xNTJJ7MRL1sRnOgflY9V0VGPLwU2fozZMAeTPWPV5Fk//mLUsKybmvAAQv3CeC7ydSsOPwai3ME1xDvXX4EZYh6I6WMDXItczb6aGU1mc/LylKCskyVEBpOvj1vNqutMzm3hIsaoGz8ZzAkN2kqXEGRcB2yoRUVgZ/CJJGtlpVIAty5n6R+YKn7/bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SEV6FSvKBUg1qgQLg6TT1AC2iHwQLooeot5R9UOQzCQ=; b=CXp4t9LFA8qizmseF/6DYraK6lwG6H9kvZh6zYxU2L75XN12RNcVmsGxG7Cpgbp9CrNozyOKdDTezWMcaTVOh/UY6rWky/PffoKK3nw0fXWsohrl/7sdBrUFh+huxu5ED2PpOCmpT33O8ty5lk3Y/eCvcNX1dc/oAjsW9Z8TeNBKwLQW6EyhSQh9qtsytYJF+r4Ox6SCQQaihjx5zXsfomGvbzGB9EyKT+gYRKMZKJX27/Su6pYfna6N3YKMQratqvy2Xq+C51m1lMQvLWT1cNQWx/OVuR3+JJ9hFCInaJXaxaK+3vk3mu8tLG20MdKgjENboKR0HDHVDptUaOnXVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SEV6FSvKBUg1qgQLg6TT1AC2iHwQLooeot5R9UOQzCQ=; b=Pd69ZkF58wbDXztHq/KKSSQMQRPk2wRNSa2/DVMJoXXJMTh0WR6CUaRps7gYbV4wAHvnQ8LqU6JaQvXEU6ccPsP2LjktWvdoCrVcDbXMtK0K82PVumOWMZ2Tan496ZdqO1XakmcfbteP00oa0uNY0Mi9SNeg8ZyRAoJeDlpnJjwzZR6CTDRfNmucgudMR62JJC6EStrWnyGWqMPRLAt0pKvxGcVFMrfYLwYxW0koAwF2CFxvJDi/LWfJu623MaWsqSHt9LL6MN1h0PGjr7AN7147FQPF8EwuzMwv/3/hB2cMspjtwqf1i1DWe/htFRSQavILp3+P0VVRK7l6yz+n4g== Received: from GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:83::20) by GVXPR10MB6006.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Thu, 16 Nov 2023 03:23:06 +0000 Received: from GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM ([fe80::6c45:bfdf:a384:5450]) by GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM ([fe80::6c45:bfdf:a384:5450%7]) with mapi id 15.20.7002.021; Thu, 16 Nov 2023 03:23:06 +0000 From: Yuran Pereira To: bpf@vger.kernel.org Cc: Yuran Pereira , andrii@kernel.org, mykolal@fb.com, ast@kernel.org, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: [PATCH bpf-next 4/4] selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in vmlinux Date: Thu, 16 Nov 2023 08:52:43 +0530 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-TMN: [iMtSmVnLqn/2ghnN2cAbiWv5/xBu1pCR] X-ClientProxiedBy: JNAP275CA0032.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4d::9) To GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:83::20) X-Microsoft-Original-Message-ID: <20231116032243.71104-1-yuran.pereira@hotmail.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR10MB6563:EE_|GVXPR10MB6006:EE_ X-MS-Office365-Filtering-Correlation-Id: 777e759c-2e07-4ddd-0741-08dbe653596c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dxEroqIItCupgcP7+UoT7Y8mfgqpx/aVbWB5m9OPjaX/+Tt2Ip+FQPKgZrX4to8Ex9oFoeftYwqkoJvwdmhQgEmmxHxZjigqB+KXzrGUzssm8DL3OcQzXKn6uy9+AsqIKuPy2DitQyJ20cbWmLFv/1ewWpkw2jsUN7Ki8QscHgrQ9aeiegNb4E3YHhHdK1aeOPw2EPLQ94+St8SBC582OSRS4juQoeEqqz0wwYjz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xy0orLQF+zWJ59HorXp6h9J/5LGnQtP5TrVkuFUPv9752te4UGwRmvGU9JuAv5DntQoKR60+Z7Mb/opuAuBFtLFj//IE2Otq/lTL3sC1YoeygvQ3+r0uXRNmHjQdxsumvIwTMiLTSz36e257L8I8sfVh68QUr8HCetrAYKw6gkcnKi/ozFTH1/FUPIGmarstq6Kp9w5m4VIyL+aEAv/epYN4knUVuddxwMhOZMZ/rdyQRGyMtbmah8o+UEolrAlDLDMF4wCQmdc8LSgf6VBYs4aVtPkurf01UyYHtR2EHvb11LeGiOAK+F65XZcNxV4V79SG/7dzeCXpz82nUO7ckhWcTDbqEN10szexLTQCHHpnXKYzQS+KVTCcMBlgiGOT4GSIilpOj3xF21DO9ajsGgQc/4c0IxRi03RIKfBp+GnW2xncFGNDQ+QQUaY60qMt913/vXNIcwscymakyNji41VOD6jwdZ6e3ZsB2doWuitnIH/TTkP1xNN+2P0+0ysBJCzs9PZaDQ//saONJKCeDmQ+URy3/dvyAwHAPjhVDhI+UmVRuT7IcxmvC0RhI9RikeSS94HCZCqL/mUu5/A7+b6zMrl9VJjjv1SD5DHswbydJfD+8RFdwK64IX5o= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6b909.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 777e759c-2e07-4ddd-0741-08dbe653596c X-MS-Exchange-CrossTenant-AuthSource: GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 03:23:06.2889 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR10MB6006 vmlinux.c uses the `CHECK` calls even though the use of ASSERT_ series of macros is preferred in the bpf selftests. This patch replaces all `CHECK` calls for equivalent `ASSERT_` macro calls. Signed-off-by: Yuran Pereira --- tools/testing/selftests/bpf/prog_tests/vmlinux.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/vmlinux.c b/tools/testing/selftests/bpf/prog_tests/vmlinux.c index 72310cfc6474..6fb2217d940b 100644 --- a/tools/testing/selftests/bpf/prog_tests/vmlinux.c +++ b/tools/testing/selftests/bpf/prog_tests/vmlinux.c @@ -16,27 +16,27 @@ static void nsleep() void test_vmlinux(void) { - int duration = 0, err; + int err; struct test_vmlinux* skel; struct test_vmlinux__bss *bss; skel = test_vmlinux__open_and_load(); - if (CHECK(!skel, "skel_open", "failed to open skeleton\n")) + if (!ASSERT_OK_PTR(skel, "test_vmlinux__open_and_load")) return; bss = skel->bss; err = test_vmlinux__attach(skel); - if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err)) + if (!ASSERT_OK(err, "test_vmlinux__attach")) goto cleanup; /* trigger everything */ nsleep(); - CHECK(!bss->tp_called, "tp", "not called\n"); - CHECK(!bss->raw_tp_called, "raw_tp", "not called\n"); - CHECK(!bss->tp_btf_called, "tp_btf", "not called\n"); - CHECK(!bss->kprobe_called, "kprobe", "not called\n"); - CHECK(!bss->fentry_called, "fentry", "not called\n"); + ASSERT_TRUE(bss->tp_called, "tp"); + ASSERT_TRUE(bss->raw_tp_called, "raw_tp"); + ASSERT_TRUE(bss->tp_btf_called, "tp_btf"); + ASSERT_TRUE(bss->kprobe_called, "kprobe"); + ASSERT_TRUE(bss->fentry_called, "fentry"); cleanup: test_vmlinux__destroy(skel);