From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4BACFA034E; Wed, 27 May 2020 16:17:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 366A11D9B1; Wed, 27 May 2020 16:17:21 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B2C461D9AF; Wed, 27 May 2020 16:17:19 +0200 (CEST) IronPort-SDR: xpU0vPXTiSYaydMXYP+iJkLCj1avQKasBRCB0NEMuRZMAJZhI7BxzjUH+rhYY4E1F406i9qRzQ k0yMPkdulPUg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2020 07:17:18 -0700 IronPort-SDR: pNLUvvaUthhiERRs9Q8dcM3XMmf1gLv39u8Qt3BG4PXqpLRuQxWjEh62zqrHIi1hNFxzGeMuCc KPTTI6DpvwjQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,441,1583222400"; d="scan'208";a="291608826" Received: from sivswdev08.ir.intel.com ([10.237.217.47]) by fmsmga004.fm.intel.com with ESMTP; 27 May 2020 07:17:16 -0700 From: Konstantin Ananyev To: dev@dpdk.org Cc: jerinj@marvell.com, stephen@networkplumber.org, mb@smartsharesystems.com, Konstantin Ananyev , stable@dpdk.org Date: Wed, 27 May 2020 15:16:49 +0100 Message-Id: <20200527141653.15576-2-konstantin.ananyev@intel.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200527141653.15576-1-konstantin.ananyev@intel.com> References: <20200518155245.11380-1-konstantin.ananyev@intel.com> <20200527141653.15576-1-konstantin.ananyev@intel.com> Subject: [dpdk-dev] [PATCH v2 1/5] test/bpf: fix few small issues X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Address for few small issues: - unreachable return statement - failed test-case can finish with 'success' status Also use unified cmp_res() function to check return value. Fixes: a9de470cc7c0 ("test: move to app directory") Cc: stable@dpdk.org Signed-off-by: Konstantin Ananyev --- app/test/test_bpf.c | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c index ee534687a..4a61a7d7c 100644 --- a/app/test/test_bpf.c +++ b/app/test/test_bpf.c @@ -1797,13 +1797,6 @@ test_call1_check(uint64_t rc, const void *arg) dummy_func1(arg, &v32, &v64); v64 += v32; - if (v64 != rc) { - printf("%s@%d: invalid return value " - "expected=0x%" PRIx64 ", actual=0x%" PRIx64 "\n", - __func__, __LINE__, v64, rc); - return -1; - } - return 0; return cmp_res(__func__, v64, rc, dv, dv, sizeof(*dv)); } @@ -1934,13 +1927,7 @@ test_call2_check(uint64_t rc, const void *arg) dummy_func2(&a, &b); v = a.u64 + a.u32 + b.u16 + b.u8; - if (v != rc) { - printf("%s@%d: invalid return value " - "expected=0x%" PRIx64 ", actual=0x%" PRIx64 "\n", - __func__, __LINE__, v, rc); - return -1; - } - return 0; + return cmp_res(__func__, v, rc, arg, arg, 0); } static const struct rte_bpf_xsym test_call2_xsym[] = { @@ -2429,7 +2416,6 @@ test_call5_check(uint64_t rc, const void *arg) v = 0; fail: - return cmp_res(__func__, v, rc, &v, &rc, sizeof(v)); } @@ -2458,6 +2444,7 @@ static const struct rte_bpf_xsym test_call5_xsym[] = { }, }; +/* all bpf test cases */ static const struct bpf_test tests[] = { { .name = "test_store1", @@ -2738,7 +2725,6 @@ run_test(const struct bpf_test *tst) } tst->prepare(tbuf); - rc = rte_bpf_exec(bpf, tbuf); ret = tst->check_result(rc, tbuf); if (ret != 0) { @@ -2746,17 +2732,20 @@ run_test(const struct bpf_test *tst) __func__, __LINE__, tst->name, ret, strerror(ret)); } + /* repeat the same test with jit, when possible */ rte_bpf_get_jit(bpf, &jit); - if (jit.func == NULL) - return 0; - - tst->prepare(tbuf); - rc = jit.func(tbuf); - rv = tst->check_result(rc, tbuf); - ret |= rv; - if (rv != 0) { - printf("%s@%d: check_result(%s) failed, error: %d(%s);\n", - __func__, __LINE__, tst->name, rv, strerror(ret)); + if (jit.func != NULL) { + + tst->prepare(tbuf); + rc = jit.func(tbuf); + rv = tst->check_result(rc, tbuf); + ret |= rv; + if (rv != 0) { + printf("%s@%d: check_result(%s) failed, " + "error: %d(%s);\n", + __func__, __LINE__, tst->name, + rv, strerror(ret)); + } } rte_bpf_destroy(bpf); -- 2.17.1