Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp784928ybh; Tue, 21 Jul 2020 07:55:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkJBtghojGHpLXUggrk/gf26ZYngL3wWmBJnqMIgyYfq1AnqVHPWfZFoR8t0p+HHuQZj/Z X-Received: by 2002:a17:906:9244:: with SMTP id c4mr24926957ejx.60.1595343323071; Tue, 21 Jul 2020 07:55:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595343323; cv=none; d=google.com; s=arc-20160816; b=ch2JmpY4gnt77VizTPR9HqKlenR2Qn00B0Y/Z6DEtXZx08g195z6zff1Ei+qR6zDtK r/mDA1nLqQjwomiOJMLy8ApdBb3nF1hVTu+QXtcYB6Zz5AejXBSAtBi0kJrWpJeRi0DE 5VjEEsIiu30ll7nFx1OyevMOGAUsnhk7I+FEljeqSK0n0vPeHX0ubZDqBH7t9WflfIXJ dZxiA4lSxIUnZGNDO04DCe3WMDBKk9HoHvnE9U/QyPZ8FEI+bI/e478bzO/jZR9o+IC0 y29PQB08KFaeBQdEz9hvty1oP2lOunsXIYz6G272BDOC6iXaHxAF7k/E8nYwYJ1k8Qao BpPQ== 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 :message-id:date:subject:cc:to:from; bh=FLApBD3i5n4okwdn0YZwniWuowC6c9WBihaHW4Q6gaM=; b=sZm/vYr5bTtd6vzQ3WVhHzXdzspFc+B4bdQcoNWu5WyHv/kHi4mPpghe4NHlIh3WR2 cKqksL3jzUdZoPoflAE7+C177+eKLYca+03/AD5LKU6bbrHijEPDt/JyiwdZcswnGsd5 y7FS7s8cHbb1gJ2QN+hGjqbLGuA1yhcv1QgB60ZJvWkdPQLj2JBurfVX1tJfJv4wv5r5 481756TRpZ6B/aQ8FVTK45fAWvYyxkMFEuFKAVhn0iEX3mk1L4VuoZBl+2OetiU1+KKK vbdSsAlKlSgnFy3hQkKUySFMZ0L34WaxzHrJFphHSWOYJkD0ygqyOKnd5DnluvR1heSX hlNQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n20si11835665ejs.158.2020.07.21.07.55.00; Tue, 21 Jul 2020 07:55:23 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728850AbgGUOwy (ORCPT + 99 others); Tue, 21 Jul 2020 10:52:54 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:55431 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728156AbgGUOwx (ORCPT ); Tue, 21 Jul 2020 10:52:53 -0400 Received: from 1.general.ppisati.uk.vpn ([10.172.193.134] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jxtdR-0002Sv-Ig; Tue, 21 Jul 2020 14:52:49 +0000 From: Paolo Pisati To: "David S . Miller" , Jakub Kicinski , Shuah Khan , Willem de Bruijn , Jian Yang Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] selftests: txtimestamp: tear down setup() 'tc' and 'ip' env on EXIT Date: Tue, 21 Jul 2020 16:52:49 +0200 Message-Id: <20200721145249.72153-1-paolo.pisati@canonical.com> X-Mailer: git-send-email 2.25.1 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 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 --- tools/testing/selftests/net/txtimestamp.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/testing/selftests/net/txtimestamp.sh b/tools/testing/selftests/net/txtimestamp.sh index eea6f5193693..77f29cabff87 100755 --- a/tools/testing/selftests/net/txtimestamp.sh +++ b/tools/testing/selftests/net/txtimestamp.sh @@ -23,6 +23,14 @@ setup() { action mirred egress redirect dev ifb_netem0 } +cleanup() { + tc filter del dev lo parent ffff: + tc qdisc del dev lo handle ffff: ingress + tc qdisc del dev ifb_netem0 root + ip link del ifb_netem0 + tc qdisc del dev lo root +} + run_test_v4v6() { # SND will be delayed 1000us # ACK will be delayed 6000us: 1 + 2 ms round-trip @@ -75,6 +83,8 @@ main() { fi } +trap cleanup EXIT + if [[ "$(ip netns identify)" == "root" ]]; then ./in_netns.sh $0 $@ else -- 2.27.0