From patchwork Thu Aug 17 22:02:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 136037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp1527637vqi; Fri, 18 Aug 2023 09:32:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGVM7s4e8cLlBENsPagCHQIMnO062firSF0JuFPj3gG87pzHHxC35c9thmDDuO0MOxeq/pj X-Received: by 2002:a17:903:1248:b0:1bb:d59d:8c57 with SMTP id u8-20020a170903124800b001bbd59d8c57mr3061864plh.18.1692376372839; Fri, 18 Aug 2023 09:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692376372; cv=none; d=google.com; s=arc-20160816; b=QQI97P3m3NIrLXloeG8ARelGHGSfepZt+EVGZ66R8/y8Xr7d0Z1ge5WNEZdlWa6t3k AMruo2e441spm15rd/9RYEgVgfimDbJ+BMvEaKYTvRQeINeMQWtPpzNDmsbrgvQIL4oW 0aCmPaIVtfBFt4mPPTM5XlEQSzSKE9b7Optjl+pBxxj2RV3l7REf5QmWDGVH9+qsabqE pszROWx2mwvJabw5aYMRZi10aeRW9ewZdRudJxvV9/U4hdAkssC/M3dVi96lKEzHUMa8 kMRgcn4Kbe1zTpeezrAPOVCLPvEuwgsTi5rlG+1keax41EvTOFTK7s02riD6XweibYlL u3Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date; bh=muasIqnKuIfCqdDB+3RRPJm+0ZRpS4F8rgVa2bVpsYc=; fh=0GrzwP2Ez0VKcSICc8RGP8RAVCBW7W5dgzH2ATGCNWg=; b=YLZYwu6T2oiY7CCKQvwow0Q1SbjBAB1uNXAioprvKvBYgns4otS5pznGV44SyPzaXi LlPufNjQhDXCQz0OqCsTFOFtXpMourHOnPSM3CAM9BxfqoVlJH0rnp7FTCPn7onTteG3 73d8DC/MMj01tRCh7XGsIYQkLFU8B/c6pBMSPYvC+sM9HuYVo+Xh53wqsyxAr5yhza+v E19jsl8EU9irWTHv34kV8h1deBpRUjWXd+kpAKtxXLPLWJJcaggoohzCsJ0CuMtljlcf NNFq8mx9JTnnJiInYq/6ILnCWHe4mN3yepWpWSkM1qfQyFTwurnaVtgGmPyu4x+NYoMP QdYQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r19-20020a170902e3d300b001bf1d1d99b7si1607621ple.368.2023.08.18.09.32.36; Fri, 18 Aug 2023 09:32:52 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355516AbjHQWCx (ORCPT + 99 others); Thu, 17 Aug 2023 18:02:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355635AbjHQWCr (ORCPT ); Thu, 17 Aug 2023 18:02:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E502C2698; Thu, 17 Aug 2023 15:02:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 79C9D63B7A; Thu, 17 Aug 2023 22:02:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2E08C433C7; Thu, 17 Aug 2023 22:02:43 +0000 (UTC) Date: Fri, 18 Aug 2023 00:02:40 +0200 From: Helge Deller To: bpf@vger.kernel.org Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] bpf/tests: Enhance output on error and fix typos Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774585247617589663 X-GMAIL-MSGID: 1774585247617589663 If a testcase returns a wrong (unexpected) value, print the expected and returned value in hex notation in addition to the decimal notation. This is very useful in tests which bit-shift hex values left or right and helped me a lot while developing the JIT compiler for the hppa architecture. Additionally fix two typos: dowrd -> dword, tall calls -> tail calls. Signed-off-by: Helge Deller diff --git a/lib/test_bpf.c b/lib/test_bpf.c index fa0833410ac1..2c01932524b3 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c @@ -596,8 +596,8 @@ static int __bpf_fill_alu_shift(struct bpf_test *self, u8 op, { static const s64 regs[] = { 0x0123456789abcdefLL, /* dword > 0, word < 0 */ - 0xfedcba9876543210LL, /* dowrd < 0, word > 0 */ - 0xfedcba0198765432LL, /* dowrd < 0, word < 0 */ + 0xfedcba9876543210LL, /* dword < 0, word > 0 */ + 0xfedcba0198765432LL, /* dword < 0, word < 0 */ 0x0123458967abcdefLL, /* dword > 0, word > 0 */ }; int bits = alu32 ? 32 : 64; @@ -14577,8 +14577,9 @@ static int run_one(const struct bpf_prog *fp, struct bpf_test *test) if (ret == test->test[i].result) { pr_cont("%lld ", duration); } else { - pr_cont("ret %d != %d ", ret, - test->test[i].result); + s32 res = test->test[i].result; + pr_cont("ret %d != %d (%#x != %#x)", + ret, res, ret, res); err_cnt++; } } @@ -15055,7 +15056,7 @@ static __init int prepare_tail_call_tests(struct bpf_array **pprogs) struct bpf_array *progs; int which, err; - /* Allocate the table of programs to be used for tall calls */ + /* Allocate the table of programs to be used for tail calls */ progs = kzalloc(struct_size(progs, ptrs, ntests + 1), GFP_KERNEL); if (!progs) goto out_nomem;