Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp389035yba; Thu, 16 May 2019 02:31:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTyDDkk1UWZeI6qm9ti7Zs6rJLJ6aP+VgB9kulHkMrOY39V/Za47mqqiwGcyMML7cz4qSg X-Received: by 2002:a65:5647:: with SMTP id m7mr48489878pgs.348.1557999076322; Thu, 16 May 2019 02:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557999076; cv=none; d=google.com; s=arc-20160816; b=VIlh/gDtWQKP9RjCbFLrDR3G1FJLsRBc2eutZe+UUZr299Trj3GSBEMggpuVscNR+v e13KrlCvle4IaebmhE9KaXWzLzOBHXLL3Tw8BpGfOlrVk3oNfCT7qtVzIIQBItVzBHK0 7LZYT/mYWrRbvtnBei44uEtQb3MkcGYI6YckZQPAl1CPYr8a13G5E0M692J0RvbWsD4/ lAm8z8tnJcazTJph0O0mutFKrBeqlSxMg/mw1E4b0daFQof2RddLY1wZzhLUwHzW+RH0 i1IUrF9mdDxMjYkuL9KusVTFfzAdw1U4+X/9qte9/+JTItnIHDqotBvPJaXmNljd3gPn g45Q== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HM9SvHS2yQg5lQDqjeY//dYhXZJ7+P9Sm7ZfbrJXCXU=; b=0h9sXWnGxiEIXNRUyBI49j9xFYoeCAAPVkoRHAfGfimyPBZlg7bLmP4dEyE/JIgcZN 8J6wQHVrWmsDPPLuS/uGCQ3ClZGcZD8lkvbbKsLFPIvSkMgzfdwCvll/DU3F2GNkWWmS iQAospCW8Lol0Hq/+2buHwVMgM8E5ygy+5PoilQqq2VyAuNa8eg2WaY2giMcavilkgCa /bLXY5FIpt/ZC2m8xRs2uz7A9fI25PMrBL3MHUQaE96tOkausi8MRa/dA01Wt29IEXfH yHvgYprJAVH6HmwZFIcab6twz5UhE7PVo6OyjsS5JG3JDrlNLXW/CCWcbpMYZWdKC5kw h/ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kinvolk.io header.s=google header.b="V1k3/XZx"; 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 d80si4901610pfd.9.2019.05.16.02.31.01; Thu, 16 May 2019 02:31:16 -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="V1k3/XZx"; 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 S1726899AbfEPJ3w (ORCPT + 99 others); Thu, 16 May 2019 05:29:52 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:39878 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbfEPJ3w (ORCPT ); Thu, 16 May 2019 05:29:52 -0400 Received: by mail-lf1-f66.google.com with SMTP id f1so2074706lfl.6 for ; Thu, 16 May 2019 02:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kinvolk.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=HM9SvHS2yQg5lQDqjeY//dYhXZJ7+P9Sm7ZfbrJXCXU=; b=V1k3/XZxzovk7JJHkqCg3cH/W8kUyNgUXSi9/WPf1de6k7MSutSrHrHYIUTtkb8ngW 5t2E2dQf3TQMSjodY05gI/CccMyZ379RU0hPVE/6M8CMJdW8Oyq8nKSvhuU5Kd2WQLcd LBf/nrR0cKxOB5jBDoYvUDwEadTJwcnV6WymY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=HM9SvHS2yQg5lQDqjeY//dYhXZJ7+P9Sm7ZfbrJXCXU=; b=Ug8RlmGsLdjxLRHzZv/jy7cXWnUHaGILcjMeN49WXtfyWNmdDI+sKf3FuYZWUbbAdX ltYLT3MwMolInU0aS0UYO+sHHWgwIGFIy6jZoPZ5U181s1UVqivJp/Dhps4YbxdHI0w8 J0rD4aZFBO0MPCEEfKzzgW/l7W0idNyk8cMxwadobIBxzqiOI7cTiPZsPi5rDsIUAO5q FgqmDYOEtYldPARsCxMHOWoXG1pzyltSnVfzo1ADkmbmwpARydd9ywaA2UaDvyVNHRpj gyVpblNT/R2lUbTf3Uiy9jr/oo2Y/s7Bi9uDhUB870MeqWvJBfc7tLAq1BbWS6api4uO cJig== X-Gm-Message-State: APjAAAVX1DwJOZ4PjbnbCulhMmuZWgBfBsrOtX2LsRiBBLBdJZNEA4Ze o+V+wLtE3XW3TthvHREwDpdVKUjopc/gt8pCwh6InQ== X-Received: by 2002:a19:ae14:: with SMTP id f20mr22736742lfc.49.1557998989943; Thu, 16 May 2019 02:29:49 -0700 (PDT) MIME-Version: 1.0 References: <20190515134731.12611-1-krzesimir@kinvolk.io> <20190515134731.12611-3-krzesimir@kinvolk.io> <20190515144537.57f559e7@cakuba.netronome.com> In-Reply-To: <20190515144537.57f559e7@cakuba.netronome.com> From: Krzesimir Nowak Date: Thu, 16 May 2019 11:29:39 +0200 Message-ID: Subject: Re: [PATCH bpf v1 2/3] selftests/bpf: Print a message when tester could not run a program To: Jakub Kicinski Cc: bpf@vger.kernel.org, =?UTF-8?Q?Iago_L=C3=B3pez_Galeiras?= , "Alban Crequy (Kinvolk)" , Shuah Khan , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrey Ignatov , linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 15, 2019 at 11:46 PM Jakub Kicinski wrote: > > On Wed, 15 May 2019 15:47:27 +0200, Krzesimir Nowak wrote: > > 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/testin= g/selftests/bpf/test_verifier.c > > index ccd896b98cac..bf0da03f593b 100644 > > --- a/tools/testing/selftests/bpf/test_verifier.c > > +++ b/tools/testing/selftests/bpf/test_verifier.c > > @@ -825,11 +825,20 @@ static int do_prog_test_run(int fd_prog, bool unp= riv, uint32_t expected_val, > > tmp, &size_tmp, &retval, NULL); > > if (unpriv) > > set_admin(false); > > - if (err && errno !=3D 524/*ENOTSUPP*/ && errno !=3D 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; > > Perhaps use strerror(errno)? As I said in the commit message, I open-coded those messages because strerror for ENOTSUPP returns "Unknown error 524". > > > + default: > > + printf("Unexpected bpf_prog_test_run error "); > > + return err; > > + } > > } > > - if (!err && retval !=3D expected_val && > > + if (retval !=3D expected_val && > > expected_val !=3D POINTER_VALUE) { > > printf("FAIL retval %d !=3D %d ", retval, expected_val); > > return 1; > --=20 Kinvolk GmbH | Adalbertstr.6a, 10999 Berlin | tel: +491755589364 Gesch=C3=A4ftsf=C3=BChrer/Directors: Alban Crequy, Chris K=C3=BChl, Iago L= =C3=B3pez Galeiras Registergericht/Court of registration: Amtsgericht Charlottenburg Registernummer/Registration number: HRB 171414 B Ust-ID-Nummer/VAT ID number: DE302207000