Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp4045117ybd; Tue, 25 Jun 2019 13:03:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyAmLhvQ3yMQMYM9JvP/YUtYYNuBFJmLx2qAZCPNlSihvPvbnqFe+40C5jcu396jSiLJco X-Received: by 2002:a17:902:bd0a:: with SMTP id p10mr550676pls.134.1561493039618; Tue, 25 Jun 2019 13:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561493039; cv=none; d=google.com; s=arc-20160816; b=o3KVrOYz85jktLwGmb/zz2tShEiab/5X+63h5L5EnZHmUNYtXz3WnNAjGGb9H/2WCt SMVfFgCsmDOwBhCYaKuK71www8ePc2J8+vTSJaXRNtAYbRzOA/pXO9fSUD8vM4yGP2fM dPem0f9aAXLax0BF/xIwQ0VotktyC+raXGm+s8a3C28qsLi1Ls9Hru6p+pzzwRIsSkqP 038H8WNDFiCzsdSN0o1wda6VFMUVEkjCfok5lzgtluKfg4Hye6UpvnxDU7MeqGEsoYs5 62GBU5K1YfVStsRYbV8aWdA24nUCT7sMR8ln4WbYvCkd51rFPO79xuWyuqRPL51OsTGe OXMg== 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=+VsQ/hHNcVRgyGfowhBC9LviGWtE+VmAC6qAcPnOXLw=; b=n+x6Jm6ugH6U1dzu9NBPGxzbZc6r1GLMWRBbx+MV5TCfVW1X12TaMgt6cYSjKWYcmr 0+XphtiXaMTLiitjdEIrLlG0D+1zDoGAi24QpK698ZaArHIMx3SP7Q5XAGxYD6THjYf4 qNPzuzEe8JxV6zbeQGV/NXBmwLhLaQZ1iLnkfsBAh/ZRPg96zrF5Ywc5UDbkRsbuw/WX 5aM5MB8nqYCcp+xOt/5w5ojEvlip6ZRJZQPj1IiNGunLEImN/ii2GjIu6BtVXzKLBJNK 6rV5oA4ebC7yReQ6nchKrUNk/BfgM/hPoyl40jbDZiQ+ANbjkmv63iltMGz75U8SdTm8 TXWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kinvolk.io header.s=google header.b=MNqpO7fl; 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 f92si1175339plb.330.2019.06.25.13.03.38; Tue, 25 Jun 2019 13:03:59 -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=MNqpO7fl; 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 S1729003AbfFYTmt (ORCPT + 99 others); Tue, 25 Jun 2019 15:42:49 -0400 Received: from mail-wr1-f54.google.com ([209.85.221.54]:43483 "EHLO mail-wr1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728070AbfFYTms (ORCPT ); Tue, 25 Jun 2019 15:42:48 -0400 Received: by mail-wr1-f54.google.com with SMTP id p13so19202794wru.10 for ; Tue, 25 Jun 2019 12:42:46 -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=+VsQ/hHNcVRgyGfowhBC9LviGWtE+VmAC6qAcPnOXLw=; b=MNqpO7flohV2LHC/0o99V4Flq60k6Xqi5mVOq7pvi5o8/vUhZmA/FJZ08L3RSQMEAm G7W8ulQn3fUI0QAd4qjYDL+bd3bm6kUM1Cn6TLsRE1CpPVJumaw1JYS0Oopvhiwr7CSV Zjmxix/Yfqu0BysCNAzYd2cLYdcbSIm1mN/wo= 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=+VsQ/hHNcVRgyGfowhBC9LviGWtE+VmAC6qAcPnOXLw=; b=nc6wNIDOwZlok9G+oxXjbfrrykg2jTH53o71NBFXoCxAS3BfrOKMtbcd34VcFS+3Ho tSv4vvp1h2lH1sNvjnSO2qCFItui+HNA+5h3Sj7johR/tTNV6D+YHD7o0arDHqAHw8Wc jXT9RW65vGdsgeMidgB025lJIN/5HQcTRECdlShCxvOmFBD1QxySqbCbupkO4n8RmcPA VtN/zpFFtphCX479dvjYE9tBUqCJR2Tb6oJ8REz1oCzGc0PdhGTWk5wBFbGX0tctC8mL MXWd/BCYFVAZHoQXailEUKVeyjW74h7TSMwXCauPcW7QxRYQTphKBtxaKwwU2xGDEfyr aAdw== X-Gm-Message-State: APjAAAUxuaV2hUh96miqbmzGjULV4id9oahCPxMh86wmJIMjCopxZzwo KiRE2C6vk0ijpxRKsIJTxJxNFw== X-Received: by 2002:a5d:4708:: with SMTP id y8mr3829076wrq.85.1561491765822; Tue, 25 Jun 2019 12:42:45 -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.44 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 12:42:45 -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 01/10] selftests/bpf: Print a message when tester could not run a program Date: Tue, 25 Jun 2019 21:42:06 +0200 Message-Id: <20190625194215.14927-2-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 This prints a message when the error is about program type being not supported by the test runner or because of permissions problem. This is to see if the program we expected to run was actually executed. The messages are open-coded because strerror(ENOTSUPP) returns "Unknown error 524". Signed-off-by: Krzesimir Nowak --- tools/testing/selftests/bpf/test_verifier.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index c5514daf8865..9e17bda016ef 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c @@ -831,11 +831,20 @@ static int do_prog_test_run(int fd_prog, bool unpriv, uint32_t expected_val, tmp, &size_tmp, &retval, NULL); if (unpriv) set_admin(false); - if (err && errno != 524/*ENOTSUPP*/ && errno != EPERM) { - printf("Unexpected bpf_prog_test_run error "); - return err; + if (err) { + switch (errno) { + case 524/*ENOTSUPP*/: + printf("Did not run the program (not supported) "); + return 0; + case EPERM: + printf("Did not run the program (no permission) "); + return 0; + default: + printf("Unexpected bpf_prog_test_run error (%s) ", strerror(saved_errno)); + return err; + } } - if (!err && retval != expected_val && + if (retval != expected_val && expected_val != POINTER_VALUE) { printf("FAIL retval %d != %d ", retval, expected_val); return 1; -- 2.20.1