From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F94BC433DF for ; Tue, 21 Jul 2020 14:52:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 459C52068F for ; Tue, 21 Jul 2020 14:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728342AbgGUOwy (ORCPT ); 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-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@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