From patchwork Fri Nov 24 09:27:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13467347 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z2dxgjxZ" Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9F8B130; Fri, 24 Nov 2023 01:29:32 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1cf8b6eb13bso10330235ad.1; Fri, 24 Nov 2023 01:29:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700818172; x=1701422972; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zxEV5FzRvRX1x0hhKZITJJ95Qa82xmwC9iIgqcYm5hA=; b=Z2dxgjxZ289wqv9A+jE1LQOneeYRDpd4JLDkpl37Gh9vp7sbkBdKqYTb2+F3HuDOuL aWN5NdnTHS18H9oEMiTtejRkppozD/1FghWa2zBiKYhcO87k3MR6P5GdEvKW8IRM8/uA cw8tcQiDcVlBWt8/nAeOp+ATY2FGygtKrghKSQJYGwsSF0FD6L/I4RHLORGYOqmNgtpv q39gN0N5O7+X6WEEV0yuqYCrRohJguezHfqa6vbaJ/Krr5WA2ImSa9448Z40KPHQuRem VBCRwxx7AY0QCw8lPJWJCHhYxA674YmEwEYhwZCRUXlEn3RcEw4pzVmlC1qesE2S2qxt iIpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700818172; x=1701422972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zxEV5FzRvRX1x0hhKZITJJ95Qa82xmwC9iIgqcYm5hA=; b=DuAoRA9dsg0ushGUmJhA3SHVpXsWV/Q5oDa/xZ8s+HaJmKyHDssJKgMPRanflJHYxA i8qd9ye4WejZmM+/1bWqzNdZXDL7yNaZN+Tw5qyxma9wy3p9CALi1TN8IxIOnqnaWwuv I+rHSc+NLTbktoTzyEZ3ngS4AY20j7OTO1k6yzM4DL4l24XO+S48b3ggGX4LDYxi8Alk h8xMmvZHxlsoduLtkHMA8BqImnGX9IMUlqAKZvwkmsQxTjXQej4OiwIELYCh+/b3C8QV 17ANdkTTztW/z5vSPyynXPF6sS51rsKQ4m00AHckbzEdENb4+Y5HJ6WdsBloXNpih+zk uOOw== X-Gm-Message-State: AOJu0YzN11j62jrqS9Ftr+gqyH4UxSROpjLHFmcmLDTFSACV2z//bGTq f4Pfew+oNQaDGLkpoD3mQEatFYWXYXatiK0w X-Google-Smtp-Source: AGHT+IH3NNo9PU5JTBMjibw6zFpLBlWH5RpJsY3pg3QlPgcfCVVqILizsu/oZeRc3nvxyiVcq6Ob0w== X-Received: by 2002:a17:902:efd4:b0:1cf:9756:e9fb with SMTP id ja20-20020a170902efd400b001cf9756e9fbmr2038300plb.30.1700818171857; Fri, 24 Nov 2023 01:29:31 -0800 (PST) Received: from Laptop-X1.redhat.com ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id o10-20020a170902d4ca00b001cfacc54674sm32679plg.106.2023.11.24.01.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 01:29:31 -0800 (PST) From: Hangbin Liu To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Shuah Khan , David Ahern , linux-kselftest@vger.kernel.org, Po-Hsu Lin , Guillaume Nault , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Ryan Roberts , Andrew Morton , Mark Brown , Luis Chamberlain , Hangbin Liu Subject: [PATCH net-next 23/38] selftests/net: use unique netns name for setup_loopback.sh setup_veth.sh Date: Fri, 24 Nov 2023 17:27:21 +0800 Message-ID: <20231124092736.3673263-24-liuhangbin@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231124092736.3673263-1-liuhangbin@gmail.com> References: <20231124092736.3673263-1-liuhangbin@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org rename server_ns/client_ns to unique name so we can run the tests in parallel. Signed-off-by: Hangbin Liu --- tools/testing/selftests/net/setup_loopback.sh | 8 +++++--- tools/testing/selftests/net/setup_veth.sh | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/net/setup_loopback.sh b/tools/testing/selftests/net/setup_loopback.sh index e57bbfbc5208..6b1150bf3995 100755 --- a/tools/testing/selftests/net/setup_loopback.sh +++ b/tools/testing/selftests/net/setup_loopback.sh @@ -5,6 +5,8 @@ readonly FLUSH_PATH="/sys/class/net/${dev}/gro_flush_timeout" readonly IRQ_PATH="/sys/class/net/${dev}/napi_defer_hard_irqs" readonly FLUSH_TIMEOUT="$(< ${FLUSH_PATH})" readonly HARD_IRQS="$(< ${IRQ_PATH})" +readonly server_ns=$(mktemp -u server-XXXXXXXX) +readonly client_ns=$(mktemp -u client-XXXXXXXX) netdev_check_for_carrier() { local -r dev="$1" @@ -97,12 +99,12 @@ setup_interrupt() { setup_ns() { # Set up server_ns namespace and client_ns namespace - setup_macvlan_ns "${dev}" server_ns server "${SERVER_MAC}" - setup_macvlan_ns "${dev}" client_ns client "${CLIENT_MAC}" + setup_macvlan_ns "${dev}" ${server_ns} server "${SERVER_MAC}" + setup_macvlan_ns "${dev}" ${client_ns} client "${CLIENT_MAC}" } cleanup_ns() { - cleanup_macvlan_ns server_ns server client_ns client + cleanup_macvlan_ns ${server} server ${client_ns} client } setup() { diff --git a/tools/testing/selftests/net/setup_veth.sh b/tools/testing/selftests/net/setup_veth.sh index 1003ddf7b3b2..a9a1759e035c 100644 --- a/tools/testing/selftests/net/setup_veth.sh +++ b/tools/testing/selftests/net/setup_veth.sh @@ -1,6 +1,9 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +readonly server_ns=$(mktemp -u server-XXXXXXXX) +readonly client_ns=$(mktemp -u client-XXXXXXXX) + setup_veth_ns() { local -r link_dev="$1" local -r ns_name="$2" @@ -19,14 +22,14 @@ setup_ns() { # Set up server_ns namespace and client_ns namespace ip link add name server type veth peer name client - setup_veth_ns "${dev}" server_ns server "${SERVER_MAC}" - setup_veth_ns "${dev}" client_ns client "${CLIENT_MAC}" + setup_veth_ns "${dev}" ${server_ns} server "${SERVER_MAC}" + setup_veth_ns "${dev}" ${client_ns} client "${CLIENT_MAC}" } cleanup_ns() { local ns_name - for ns_name in client_ns server_ns; do + for ns_name in ${client_ns} ${server_ns}; do [[ -e /var/run/netns/"${ns_name}" ]] && ip netns del "${ns_name}" done }