Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp4046031ybd; Tue, 25 Jun 2019 13:04:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWwyrqT3ELl/tMcQP1bURNa5ZXH0F9szyLwMdxDdzoSJthnMhDouBwnN082FVD4y87glgV X-Received: by 2002:a63:18c:: with SMTP id 134mr35226252pgb.432.1561493094782; Tue, 25 Jun 2019 13:04:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561493094; cv=none; d=google.com; s=arc-20160816; b=niAcOkKpZano8OukeBrt8qwN0tT852hs0kNuUs3KZSnL15vIgvr5rIie+abC5fmjpJ 9GWKoqDvuq9O30pBk15PhOdzFnQKFAZRcZSp7fqDfO67AjB7wGHytksvI+QHrZ2qauzD Pg3KZ+VK5owlYO7XLFfBLwdUa1++4PA1qGdwF+L9lHe/SOBizGMx6L7Qq6G44xrSq5a7 QZxd9BXeD5akmpgaqWUlS+xtm0OBHMksHvNcKIBec7FxIuoNrR93Nu6ws9xNZXK089+d ELhKvH/CEAnsV02hBRPJkhrsgVN82TEd6tqktbbjqS8CBHqmPVUTjUNlymueZ5B2wyV5 MHTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NZJAZB5vdXR/WpDyZLPJ4DPn0c9D938wugTs5ASTa68=; b=D8lvLCBl4jXZJjo99ohub4K9JnAQYb7P55demHnDOa5Hd31tAxPNrJdNVKpRd0T7AK 72c2NbSKVEvtBMyA4vzVyv9GLhPYdDhvZMrySeMGmfqnVzDs0JYp6x92rr0UNwRZ/BRK EIAGtxKnUN7ZQRJUY1F9g1zxp0ld7nLHkvv2U32gz1HedY8OpHUZICrZDhf72mArLHUm LbE64S8iHQPfSG9crdLGiQS9gtAGPPGC1Uq1mLYAFF3sQ3psMN7LDgTr6Sc7upIKjIOD by9hHo6OFisWzIweltB8/grlcZfDGicz9yeF/jaSBT3saTdh90E2XwonKPIbXNeY2Trs R6hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kinvolk.io header.s=google header.b=YCgwE95s; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si111041pjv.38.2019.06.25.13.04.39; Tue, 25 Jun 2019 13:04:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kinvolk.io header.s=google header.b=YCgwE95s; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729312AbfFYTmx (ORCPT + 99 others); Tue, 25 Jun 2019 15:42:53 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35451 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729039AbfFYTmu (ORCPT ); Tue, 25 Jun 2019 15:42:50 -0400 Received: by mail-wr1-f68.google.com with SMTP id f15so9335376wrp.2 for ; Tue, 25 Jun 2019 12:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kinvolk.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NZJAZB5vdXR/WpDyZLPJ4DPn0c9D938wugTs5ASTa68=; b=YCgwE95siTWIMkFuGxiPLTfcpNRyh8nvZejCJIhLS+rzApzf7Mg54bJHdIR85mb4zc kr/3cbL1I4W/m3elY3gDS3qqciSg8rWJa+GC/Tnypr6naIpx09ZJE3zTIvYkj0zUlqDw YAdXxoHiXF1vPbrqDTgG8NdV99yiQO34OOCR4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NZJAZB5vdXR/WpDyZLPJ4DPn0c9D938wugTs5ASTa68=; b=HYarOs7T0uGrNJnJPKylkpn7N7MbwbkS8BwtyIiV0W+QSK/Cszg+Ct+IwaScfe4dOX kM5MShhF60gyFNFdWgCprxW/RBUKxE+awPYJry4wcxyscpM404nVHsr+LWwPcBaa7EhB JsSo2R/hMoaaoy3WFmI61DZDz4Je9JtUU+YpCrMVJcSOn0S0gAxMdwTdi1UpU4fcCaYT Poqnep5iHB9lo8EUI86zdTR81TmmNaHmXrdf2WwT1wErJP6NXCCLYw8k47izu9Z8giRI C4aZ4xVvFjP6LIxY55DSiJTAqvmr8Sbuh1VIqXcNObyYgeNAl77dp8H0kCTLnOTCII3u qebQ== X-Gm-Message-State: APjAAAUNO/yOVXtAL817adcSeGdgT4NJucjrcAC1G84F5YLJOgYALjKp TMgFcewHAqtSNavj8ro5D0joZg== X-Received: by 2002:adf:fb8d:: with SMTP id a13mr25689557wrr.273.1561491768959; Tue, 25 Jun 2019 12:42:48 -0700 (PDT) Received: from localhost.localdomain (ip5f5aedb6.dynamic.kabel-deutschland.de. [95.90.237.182]) by smtp.gmail.com with ESMTPSA id q193sm84991wme.8.2019.06.25.12.42.48 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 12:42:48 -0700 (PDT) From: Krzesimir Nowak To: netdev@vger.kernel.org Cc: Alban Crequy , =?UTF-8?q?Iago=20L=C3=B3pez=20Galeiras?= , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Krzesimir Nowak Subject: [bpf-next v2 04/10] selftests/bpf: Use bpf_prog_test_run_xattr Date: Tue, 25 Jun 2019 21:42:09 +0200 Message-Id: <20190625194215.14927-5-krzesimir@kinvolk.io> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190625194215.14927-1-krzesimir@kinvolk.io> References: <20190625194215.14927-1-krzesimir@kinvolk.io> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The bpf_prog_test_run_xattr function gives more options to set up a test run of a BPF program than the bpf_prog_test_run function. We will need this extra flexibility to pass ctx data later. Signed-off-by: Krzesimir Nowak --- tools/testing/selftests/bpf/test_verifier.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index 779e30b96ded..db1f0f758f81 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c @@ -822,14 +822,20 @@ static int do_prog_test_run(int fd_prog, bool unpriv, uint32_t expected_val, { __u8 tmp[TEST_DATA_LEN << 2]; __u32 size_tmp = sizeof(tmp); - uint32_t retval; int err; int saved_errno; + struct bpf_prog_test_run_attr attr = { + .prog_fd = fd_prog, + .repeat = 1, + .data_in = data, + .data_size_in = size_data, + .data_out = tmp, + .data_size_out = size_tmp, + }; if (unpriv) set_admin(true); - err = bpf_prog_test_run(fd_prog, 1, data, size_data, - tmp, &size_tmp, &retval, NULL); + err = bpf_prog_test_run_xattr(&attr); saved_errno = errno; if (unpriv) set_admin(false); @@ -846,9 +852,9 @@ static int do_prog_test_run(int fd_prog, bool unpriv, uint32_t expected_val, return err; } } - if (retval != expected_val && + if (attr.retval != expected_val && expected_val != POINTER_VALUE) { - printf("FAIL retval %d != %d ", retval, expected_val); + printf("FAIL retval %d != %d ", attr.retval, expected_val); return 1; } -- 2.20.1