Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp768297ybt; Mon, 6 Jul 2020 23:10:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsxFKER3o0zwCJXjzIoXVCvObe9m32gflblZkYFzcLxX1VcvI1d3CRmFu5uCftrJEWVM4d X-Received: by 2002:a05:6402:1c96:: with SMTP id cy22mr58378104edb.79.1594102204674; Mon, 06 Jul 2020 23:10:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594102204; cv=none; d=google.com; s=arc-20160816; b=z1Es+4v1kbPxS8n1Fw+fdggCyQLiDICNRYJeOg9daR4wB54SmvMOSb+RP4B2nMpIZJ OsugUVvm7SSo9gHpAHtCrSPMJZMg+qVnqPFlsa0yW0iKymSLmsZ5sx9YdXIPChjCD+o7 kYyIGSSEXZHa/FBH90LP+FNqEr9MK/M9qxxDh7mLxW5fllZEkyN1xvVYpiHhJF72okDr M0LO2j6PM3+jWLAjGDYGQScAmV5i0fgP9SSwlgHPk7cz5n/HupNSEINnebeW8z/+vIxX QxJp8NMcw5CIM2cU8tCazxSOkmQs7uTZKOrem1QowDZpy0bmx/8gp0wMjRaZb8ah9Yo8 8UkQ== 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:subject:cc:to:from:date :dkim-signature; bh=M6vzX4pgRklp7CNc1swxRtrbo/Er7OvueNgs+gb+Ros=; b=iNg5ntl/Abk5EcBwLoOB/mJdhY9uYB1fjlmQKHvRJCiayPhgtNbdsYJ4mllN0drq/F FjRqtcLHGIGo08G6OR6ApaP323BhVrTY4OlHUUmui9k3IVH4R79hAkzpJXwjqIzVFcaX q41/EGv1gwfZ150QuQuWGCzJpU29Q+SpRw7qx6FiUR9bgQifCEWZU/ISiwF+LHR+DxYV aSQN1oIRLQurQns3OWdlr1NyS/PXOIFOn6SYIQjUYYQBYuihQUIFIy4wiQTBIG99kgG3 RP7Et/gmKxD+54uXmfVTaNnh/2JMkeA73KdE5yk2g0p436TmrqgOEV6lveBv4zJBnrK/ j+Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UdqHyib+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si14012615ejs.137.2020.07.06.23.09.40; Mon, 06 Jul 2020 23:10:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UdqHyib+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727875AbgGGGJQ (ORCPT + 99 others); Tue, 7 Jul 2020 02:09:16 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:33098 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727008AbgGGGJO (ORCPT ); Tue, 7 Jul 2020 02:09:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594102153; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M6vzX4pgRklp7CNc1swxRtrbo/Er7OvueNgs+gb+Ros=; b=UdqHyib+bFEoy+PsSqKBd+2CG+lUOzAoyTIl+d3I64dJ0Ugbjutc5ZjHAOXyigjuX3sLKy r4Peav3naEwhtcYmpgmgTbDDHub1W7e9ti6vyuu3DLagRrjZ5IGJ1ZbWeymKk40uFVULL9 cF3OMZy5kD1CBCzFiptlAkHnYIWK4Jc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-97-sQPcG_A1O8m0LYGZvKO0OQ-1; Tue, 07 Jul 2020 02:09:09 -0400 X-MC-Unique: sQPcG_A1O8m0LYGZvKO0OQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6975880058A; Tue, 7 Jul 2020 06:09:08 +0000 (UTC) Received: from carbon (unknown [10.40.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 528D25C1B2; Tue, 7 Jul 2020 06:08:59 +0000 (UTC) Date: Tue, 7 Jul 2020 08:08:57 +0200 From: Jesper Dangaard Brouer To: Andrii Nakryiko Cc: bpf , Hangbin Liu , Daniel Borkmann , Alexei Starovoitov , Veronika Kabatova , Jiri Benc , Yonghong Song , Martin Lau , Networking , open list , brouer@redhat.com Subject: Re: [PATCH bpf-next V2 2/2] selftests/bpf: test_progs avoid minus shell exit codes Message-ID: <20200707080857.29d45856@carbon> In-Reply-To: References: <159405478968.1091613.16934652228902650021.stgit@firesoul> <159405481655.1091613.6475075949369245359.stgit@firesoul> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 6 Jul 2020 15:17:57 -0700 Andrii Nakryiko wrote: > On Mon, Jul 6, 2020 at 10:00 AM Jesper Dangaard Brouer > wrote: > > > > There are a number of places in test_progs that use minus-1 as the argument > > to exit(). This improper use as a process exit status is masked to be a > > number between 0 and 255 as defined in man exit(3). > > nit: I wouldn't call it improper use, as it's a well defined behavior > (lower byte of returned integer). > > > > > This patch use two different positive exit codes instead, to allow a shell > > typo: uses > > > script to tell the two error cases apart. > > > > Fixes: fd27b1835e70 ("selftests/bpf: Reset process and thread affinity after each test/sub-test") > > Fixes: 811d7e375d08 ("bpf: selftests: Restore netns after each test") > > Signed-off-by: Jesper Dangaard Brouer > > --- > > tools/testing/selftests/bpf/test_progs.c | 12 +++++++----- > > 1 file changed, 7 insertions(+), 5 deletions(-) > > > > diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c > > index e8f7cd5dbae4..50803b080593 100644 > > --- a/tools/testing/selftests/bpf/test_progs.c > > +++ b/tools/testing/selftests/bpf/test_progs.c > > @@ -12,7 +12,9 @@ > > #include > > #include /* backtrace */ > > > > -#define EXIT_NO_TEST 2 > > +#define EXIT_NO_TEST 2 > > +#define EXIT_ERR_NETNS 3 > > +#define EXIT_ERR_RESET_AFFINITY 4 > > Let's not overdo this with too granular error codes? All of those seem > to be just a failure, is there any practical need to differentiate > between NETNS vs RESET_AFFINITY failure? I agree, because both cases (NETNS vs RESET_AFFINITY) print to stderr, which makes it possible to troubleshoot for a human afterwards. The shell script just need to differentiate that is an "infra" setup issue, as we e.g. might want to allow the RPM build to continue in those cases. > I'd go with 3 values: > > 1 - at least one test failed > 2 - no tests were selected > 3 - "infra" (not a test-specific failure) error (like netns or affinity failed). > > Thoughts? Sure, I can do this. What define name reflect this best: EXIT_ERR_SETUP ? EXIT_ERR_INFRA ? EXIT_ERR_SETUP_INFRA ? -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer