Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14407949pxu; Tue, 5 Jan 2021 00:14:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJy074weqCT8AqeZa3x9Yre5D6fe96+HK3Eia4SMQeGO4tERP/cSbnS5FBdrgxhO9zL4j/3j X-Received: by 2002:a17:907:20cc:: with SMTP id qq12mr72898005ejb.316.1609834483532; Tue, 05 Jan 2021 00:14:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609834483; cv=none; d=google.com; s=arc-20160816; b=zdyDm5tHBVSGwVhMSysFjPn1gkqlaFjRAwuQ4a3RslaDY1CosKD/UuoK+QfZi5JPLv N+7eo6eNdquDVQl1n9YxGToasB7CNlBrMY5NL0kluML/SmAqGrbgwxNxYUfzHt6qY5Qk OakAYrdj9Qj+P9uLx70W8YyJ44EmM1w/jscEShGjdR1fNteLRxb+0XeBzVT8oQwSzJBZ u4/pCGYcS+uunvpeDv+bR3xZAO8fDpSV/sgVRUULwjUMOKZ0WpCExhECE9bfrfPRcEQe O7CjOnOfr1/dWpNV0TG7RHRWu1Zd4cS3ncQ4brgKdtZ70iuKGR55Ad4SRFwUfjMDFogr lOhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=h425IKua8egA7hibTomNYgW5ILeD5RrxThMGf/Earxw=; b=jn9COnElMdVsKV5NExp/L6kvy9entf7UZAUDXl0V2TbTw33F2t+PMNjqTSVQZzatP/ zRpzvfdPzGDQA8IksCnagumtwpRgZ/WIx3hT2RC9i9dsGggmon5ZSie4w7W+Wz0HySgy 0Bmg5WL2a6Cob9nVBMx+9d7wBSBL/tskOmmbvMXGnymPamI1XLBqBtQVlOA+K22rJzcF vmgJxqne030k20PuskrC8ksrbtKxtDEFaGR7JfbK7wSMt/seiH+pU3P07Buns9Iw5zd0 coy1jnIuVRawQ+GF7bmRSykOPPD33OpfvDEhzr32c+ghj2eWnl+4eO/SwJxw4v90u3wx O1ZQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si29238254ejs.1.2021.01.05.00.14.18; Tue, 05 Jan 2021 00:14:43 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727134AbhAEIMD (ORCPT + 99 others); Tue, 5 Jan 2021 03:12:03 -0500 Received: from a.mx.secunet.com ([62.96.220.36]:39416 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725766AbhAEIMC (ORCPT ); Tue, 5 Jan 2021 03:12:02 -0500 Received: from localhost (localhost [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id 101E020082; Tue, 5 Jan 2021 09:11:21 +0100 (CET) X-Virus-Scanned: by secunet Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hIQUkGXe1nHz; Tue, 5 Jan 2021 09:11:08 +0100 (CET) Received: from cas-essen-01.secunet.de (unknown [10.53.40.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by a.mx.secunet.com (Postfix) with ESMTPS id E9B8C2006F; Tue, 5 Jan 2021 09:11:08 +0100 (CET) Received: from mbx-dresden-01.secunet.de (10.53.40.199) by cas-essen-01.secunet.de (10.53.40.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 5 Jan 2021 09:11:03 +0100 Received: from gauss2.secunet.de (10.182.7.193) by mbx-dresden-01.secunet.de (10.53.40.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Tue, 5 Jan 2021 09:11:03 +0100 Received: by gauss2.secunet.de (Postfix, from userid 1000) id 66C7D3180C94; Tue, 5 Jan 2021 09:11:02 +0100 (CET) Date: Tue, 5 Jan 2021 09:11:02 +0100 From: Steffen Klassert To: Po-Hsu Lin CC: , , , , , , Subject: Re: [PATCH] selftests: xfrm: fix test return value override issue in xfrm_policy.sh Message-ID: <20210105081102.GI3576117@gauss3.secunet.de> References: <20201230095204.21467-1-po-hsu.lin@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20201230095204.21467-1-po-hsu.lin@canonical.com> X-ClientProxiedBy: cas-essen-02.secunet.de (10.53.40.202) To mbx-dresden-01.secunet.de (10.53.40.199) X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 30, 2020 at 05:52:04PM +0800, Po-Hsu Lin wrote: > When running this xfrm_policy.sh test script, even with some cases > marked as FAIL, the overall test result will still be PASS: > > $ sudo ./xfrm_policy.sh > PASS: policy before exception matches > FAIL: expected ping to .254 to fail (exceptions) > PASS: direct policy matches (exceptions) > PASS: policy matches (exceptions) > FAIL: expected ping to .254 to fail (exceptions and block policies) > PASS: direct policy matches (exceptions and block policies) > PASS: policy matches (exceptions and block policies) > FAIL: expected ping to .254 to fail (exceptions and block policies after hresh changes) > PASS: direct policy matches (exceptions and block policies after hresh changes) > PASS: policy matches (exceptions and block policies after hresh changes) > FAIL: expected ping to .254 to fail (exceptions and block policies after hthresh change in ns3) > PASS: direct policy matches (exceptions and block policies after hthresh change in ns3) > PASS: policy matches (exceptions and block policies after hthresh change in ns3) > FAIL: expected ping to .254 to fail (exceptions and block policies after htresh change to normal) > PASS: direct policy matches (exceptions and block policies after htresh change to normal) > PASS: policy matches (exceptions and block policies after htresh change to normal) > PASS: policies with repeated htresh change > $ echo $? > 0 > > This is because the $lret in check_xfrm() is not a local variable. > Therefore when a test failed in check_exceptions(), the non-zero $lret > will later get reset to 0 when the next test calls check_xfrm(). > > With this fix, the final return value will be 1. Make it easier for > testers to spot this failure. > > Fixes: 39aa6928d462d0 ("xfrm: policy: fix netlink/pf_key policy lookups") > Signed-off-by: Po-Hsu Lin Applied to the ipsec tree, thanks!