Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp793445ybh; Tue, 21 Jul 2020 08:05:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJGcHbZvANS01gsgzpZtpaRpm6w0ij4K2FDUGFqT5qA0J/64xemtMpGD0PwvTOAEBMorfZ X-Received: by 2002:a50:d50e:: with SMTP id u14mr1340266edi.256.1595343933250; Tue, 21 Jul 2020 08:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595343933; cv=none; d=google.com; s=arc-20160816; b=mqyLBQawvb9J9oFei13A6hjd6M2K6mLUNoLuPXBcT96MBis+dNaaHfnx7CPW5QB+/l kY052frREpKXNFsOWUwjSymWSRc4HsAZrHB8Nxg37GVL2E9SkmsLRHM6h2xZtyN5f6D6 QCbFb6ZN3A6NFEgvDJNxVr4HvB81r7ll2aQMfaze6TKo+Py7/vejXDBzUDWfm0MWzSOP TaByt3LpsEejV+doVIASOLGd785RsEjArs17w5tQ7SKnJwcSNctcrXhy9oorYSXoDvoq 8pbJjqQ8dEvPKfol09SMbJhBNTxxdQ+TxOX7otphw+RfRxq20vNPh+M7C9eBHFG265mc VfJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xcBXfL/2ghXmfWUhIUFmjDIyiJHk+JdIwC3C6WYMhpA=; b=BdNZSnhk4FWPPHZvojd+V1NvRg439Ql+J5mXkoqTwu6OtxXJj6LhN9P34r79vzuewg WlQEkCsDVA+ZlfwW5Fvb05fFDyhUhUEWk+uJI/lhNQLgia2buDLbLKfiYXLqOPbrL9tX zrtYBG0tk9MYFJn1oyFGMbcGS7ONVyBaMpupxl0HIMNIYLvlhWRLjnsenVTv3G3zJnTF QbMIwzQ+hcQhGRdlthkWu0QDB3iAfx37E4HHFn8Bgc3k4dA3r/xdNJKwO7fEUtNHLD/K cTZs+0Np7N0y3p1QaDUz2/2haspNZZRWINOOOMRUJ3YdKYd7CLF/fOzyXeISJAsjTtVj RZRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nkEVU9ZU; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si12492898edn.454.2020.07.21.08.05.09; Tue, 21 Jul 2020 08:05:33 -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=@gmail.com header.s=20161025 header.b=nkEVU9ZU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729685AbgGUPEr (ORCPT + 99 others); Tue, 21 Jul 2020 11:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728064AbgGUPEq (ORCPT ); Tue, 21 Jul 2020 11:04:46 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 573BFC061794 for ; Tue, 21 Jul 2020 08:04:46 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id k18so16329435qtm.10 for ; Tue, 21 Jul 2020 08:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xcBXfL/2ghXmfWUhIUFmjDIyiJHk+JdIwC3C6WYMhpA=; b=nkEVU9ZU87N0ifRBVfB1q8YCi1RxVxmEu5RdvsDBXhFiPEL0+m0yusDrGS/FPQ3rV4 xIvv4ogoqcsmhBb2zKHlT8evZyfcSrjlNRIDagEWf2bZJ+APn9ZNgdOWqtt3jSVKMQjc 8jA9M3khDvpJ/TEVAbWFQNwBkiJyvtzM7IUzy0BA1NgrC9LRk93FKRVqtD9AEsVn6viX kgsPnKKqECnJc6sBS4aeiSeBZeS7SKdsRVwoyZ5zVYFPPkcY7RARcI5IxXIJT+kqyJKJ /9YzVuyStefKMLITBThkojKd8PUiTeZAmOJfUyw230YDsecfXsxPQHpsqj579b/xhvBO TQXg== 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; bh=xcBXfL/2ghXmfWUhIUFmjDIyiJHk+JdIwC3C6WYMhpA=; b=UZXmj14PmyyOAP6XIi5AHJ4QS8OO45+W4QY95AGTsV12cPeiv8nxO4+2hY/tM9yr3O QNXe2f6dccmJPRvjNsYm8B0vsTc1xsCKnAGbc9ZkySwmLrABvNFrRI03a9wq8g+IO0dk AGq+PzAbxS0uWTfjzS7Jw8DM8Ursw64LzqCb47fO1C3JXjNGdWF/oRQdYbxoBgxndFpj kq9tr4ynCI/ztVKlORLeBdqm8ghlyabUpZnySoN/9KEA1tlOxNx/yhaRGfkQ3nB2pIg9 LXa6AEgM4UktQlghCPGDWlO+6Jght5ANgPPi2B1D/D4qsssK8PJ3ObTlqUE+F9DBXRoj mgnQ== X-Gm-Message-State: AOAM533dGa3hBoppsmbI5KnBFqi10ASdEHn0UmLpNWR641xJkc2OnnR0 ReG7zTGfZxRs6++q57dTFPuC9co2 X-Received: by 2002:ac8:957:: with SMTP id z23mr29480958qth.68.1595343884455; Tue, 21 Jul 2020 08:04:44 -0700 (PDT) Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com. [209.85.222.174]) by smtp.gmail.com with ESMTPSA id p4sm2543441qkj.135.2020.07.21.08.04.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Jul 2020 08:04:43 -0700 (PDT) Received: by mail-qk1-f174.google.com with SMTP id h7so3701184qkk.7 for ; Tue, 21 Jul 2020 08:04:43 -0700 (PDT) X-Received: by 2002:a25:4886:: with SMTP id v128mr40285167yba.53.1595343882471; Tue, 21 Jul 2020 08:04:42 -0700 (PDT) MIME-Version: 1.0 References: <20200721145249.72153-1-paolo.pisati@canonical.com> In-Reply-To: <20200721145249.72153-1-paolo.pisati@canonical.com> From: Willem de Bruijn Date: Tue, 21 Jul 2020 11:04:06 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] selftests: txtimestamp: tear down setup() 'tc' and 'ip' env on EXIT To: Paolo Pisati Cc: "David S . Miller" , Jakub Kicinski , Shuah Khan , Jian Yang , Network Development , "open list:KERNEL SELFTEST FRAMEWORK" , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 21, 2020 at 10:52 AM Paolo Pisati wrote: > > Add a cleanup() path upon exit, making it possible to run the test twice in a > row: > > $ sudo bash -x ./txtimestamp.sh > + set -e > ++ ip netns identify > + [[ '' == \r\o\o\t ]] > + main > + [[ 0 -eq 0 ]] > + run_test_all > + setup > + tc qdisc add dev lo root netem delay 1ms > Error: Exclusivity flag on, cannot modify. > > Signed-off-by: Paolo Pisati The test should already clean up after itself, by being run inside a network namespace. That is a more robust method to ensure that all state is reset. The issue here is that the else branch is taken in if [[ "$(ip netns identify)" == "root" ]]; then ./in_netns.sh $0 $@ else main $@ fi because the ip netns identify usually returns an empty string, not "root". If we fix that, no need to add additional cleanup.