From patchwork Fri Feb 16 15:28:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 773538 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A34D612FF87 for ; Fri, 16 Feb 2024 15:28:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708097336; cv=none; b=rSgIpchEa1J4WeSPoWuGSewkIYPSMafwNA4UtUTD7jH262jk4OI3UVOa8BqAzPZhPxTLxoP7evYnVunr7YR/6HUSAUCNL+b0aCVrKtzPGKSchAFCdNCh6iydbda8h9+B9oKrTdkf7zh6aLnjh9sCA4DMJ+ww18tI/Uua9QMtUGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708097336; c=relaxed/simple; bh=2ScCJrJA5lZdY9sBm7rVR9EfM9rjVK16M7AEmsYUz5M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kwbkOH5uQVBIDLVG4mfDsa/p0nLqg8jyuUCLBIEaxfAA8PE/eNePt6+YryLFMR2ABVoLUVEsVS0+iAGm+a6myITThoEO9MC9n9ahOnSjvcfRTfGeFC32nP/o7o2SRxlET42B+OD3VpCI7FVlqRzn2Oof67ko60CtugBP7ZsVsgM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NXDK3dxz; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NXDK3dxz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708097333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cS43J9B9DiB6M1fCrf9zR1TxskmGVyf4cYBuBgPYnU4=; b=NXDK3dxzekYk6Mrzi2c2Pp4UFuw04thXB7ejwQ5qrALQT0VI2h9im45tZXTRbB0BgRagfa f8V3dxx1+VlxZenq/LZza0jJEq58BGCUw3td39Bgeqi0EOmBSjlhEeTIjesynIX8Hjfwj7 PtI9Tn5QIE0bbA3J3ZuPksqOXK7g4GA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-atuG1hO_OXqmsDcTnLLUYQ-1; Fri, 16 Feb 2024 10:28:50 -0500 X-MC-Unique: atuG1hO_OXqmsDcTnLLUYQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 71681863725; Fri, 16 Feb 2024 15:28:49 +0000 (UTC) Received: from RHTPC1VM0NT.lan (unknown [10.22.33.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2B4D1C06890; Fri, 16 Feb 2024 15:28:48 +0000 (UTC) From: Aaron Conole To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Pravin B Shelar , dev@openvswitch.org, Ilya Maximets , Simon Horman , Eelco Chaudron , Shuah Khan , linux-kselftest@vger.kernel.org Subject: [RFC 3/7] selftests: openvswitch: use non-graceful kills when needed Date: Fri, 16 Feb 2024 10:28:42 -0500 Message-ID: <20240216152846.1850120-4-aconole@redhat.com> In-Reply-To: <20240216152846.1850120-1-aconole@redhat.com> References: <20240216152846.1850120-1-aconole@redhat.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 Normally a spawned process under OVS is given a SIGTERM when the test ends as part of cleanup. However, in case the process is still lingering for some reason, we also send a SIGKILL to force it down faster. Signed-off-by: Aaron Conole --- tools/testing/selftests/net/openvswitch/openvswitch.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh index a5dbde482ba4..678a72ad47c1 100755 --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh @@ -91,7 +91,8 @@ ovs_add_if () { python3 $ovs_base/ovs-dpctl.py add-if \ -u "$2" "$3" >$ovs_dir/$3.out 2>$ovs_dir/$3.err & pid=$! - on_exit "ovs_sbx $1 kill -TERM $pid 2>/dev/null" + on_exit "ovs_sbx $1 kill --timeout 1000 TERM \ + --timeout 1000 KILL $pid 2>/dev/null" fi } @@ -108,7 +109,8 @@ ovs_netns_spawn_daemon() { info "spawning cmd: $*" ip netns exec $netns $* >> $ovs_dir/stdout 2>> $ovs_dir/stderr & pid=$! - ovs_sbx "$sbx" on_exit "kill -TERM $pid 2>/dev/null" + ovs_sbx "$sbx" on_exit "kill --timeout 1000 TERM \ + --timeout 1000 KILL $pid 2>/dev/null" } ovs_add_netns_and_veths () { From patchwork Fri Feb 16 15:28:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 773537 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05546139567 for ; Fri, 16 Feb 2024 15:28:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708097337; cv=none; b=Xs5kmzOG3OO70yKAKr8FdxoxMBIPIN/nitqCEQDnkpdQXNnDyXCXI2me700Jy/wIIUtYG6bYQtvM+7Ac24zSLfjLobnV4lZIdxOjqDXrhQeu7q4fuWI070h7UaJhwfWmuPD+QYFCg/BpxRkuHqeiOzuMOvi0QFqLXAXiiIXIKYI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708097337; c=relaxed/simple; bh=+VPEA2dIxiq+tX8ezqarB+b9JozN2PIUG9DrLT+mW38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TEutBAW98M1M4rawTAp2/dER2qLzKnJSaa7hl94ajFT8ibIv+hZlmX/vNt+28oVT6tDNn6wyE8AZATL9RkztLB/b4iRCtz2wQPeQHaaYd7Vi/DZs/zqJoHUUnvUCLYgjeh9+H/fSMOebtRFoqcLbt+qVpd1y2MVYT+P8+dulCs4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fVWWdybC; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fVWWdybC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708097334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fJ92gCXKw2n0LovijjEifDOZBlKXAd8WxMwKdfCj/2k=; b=fVWWdybCQL1cIQdeQc5YFMi3jOHZt41vuvS//LQGrrKdZ7fbf2igGPlkDeqEfriJHuxhnP VZpj9va7S6YhejwZQoZQ+Rm9xeYIyCNVQbt9pJiDag7xq0B1ZlPrP2Gp8eyuIjQKt7RYhR 9DupTCP/76HLrFCC6+qNAO/msN2+BQE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-92-8_nAtaiIPCazoS_e_UC5-w-1; Fri, 16 Feb 2024 10:28:50 -0500 X-MC-Unique: 8_nAtaiIPCazoS_e_UC5-w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 00E81185A784; Fri, 16 Feb 2024 15:28:50 +0000 (UTC) Received: from RHTPC1VM0NT.lan (unknown [10.22.33.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F84C1C05E0F; Fri, 16 Feb 2024 15:28:49 +0000 (UTC) From: Aaron Conole To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Pravin B Shelar , dev@openvswitch.org, Ilya Maximets , Simon Horman , Eelco Chaudron , Shuah Khan , linux-kselftest@vger.kernel.org Subject: [RFC 4/7] selftests: openvswitch: delete previously allocated netns Date: Fri, 16 Feb 2024 10:28:43 -0500 Message-ID: <20240216152846.1850120-5-aconole@redhat.com> In-Reply-To: <20240216152846.1850120-1-aconole@redhat.com> References: <20240216152846.1850120-1-aconole@redhat.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 Many openvswitch test cases reused netns and interface names. This works fine as long as the test case cleans up gracefully. However, if there is some kind of ungraceful termination (such as an external signal) the netns or interfaces can be left lingering. This happens when the selftest timeout gets exceeded, while running under very slow debugging conditions. The solution here is to cleanup the netns on executing the next test. Signed-off-by: Aaron Conole --- tools/testing/selftests/net/openvswitch/openvswitch.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh index 678a72ad47c1..8dc315585710 100755 --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh @@ -115,6 +115,10 @@ ovs_netns_spawn_daemon() { ovs_add_netns_and_veths () { info "Adding netns attached: sbx:$1 dp:$2 {$3, $4, $5}" + ntns_e=`ip netns list | grep $3` + [ "$ntns_e" != "" ] && ip netns del "$3" + if4_e=`ip link show $4 2>/dev/null` + [ "$if4_e" != "" ] && ip link del "$4" ovs_sbx "$1" ip netns add "$3" || return 1 on_exit "ovs_sbx $1 ip netns del $3" ovs_sbx "$1" ip link add "$4" type veth peer name "$5" || return 1 From patchwork Fri Feb 16 15:28:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 773536 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2254A1419B4 for ; Fri, 16 Feb 2024 15:28:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708097339; cv=none; b=oMU0TnLwdYT3BQe9ulRAYmuRDeOcfQxPMtIf5YWV73X1KkvaClEp7ilVWY6o+DGUp/JDofXOvbwn2dXJ0OtwVYYoUC2RI8ZGL+LxtAh2jvBV68R4aCj94JH03vU1So1NHgw35T2uzfUEITOsBp43KP4cl3fZhOR/XYJSu8jFZoo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708097339; c=relaxed/simple; bh=Mif2Pw9Dh6MEkFyqulQXsxVjnIm4JFp+wr4NhK2k9K8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gco8HF6W9auG8HWCpDkHiUVCfZdomUE2DOrvfFJRx6CsSDwhJCscBqoEeiNq3SBowdyCG6Z1VxfPXnQgOvLKZ5X0nHr1b1tsrBekg0Zd+8bYMq0i+4Jg1YTIChYo+IesRS2DFWttXkSYsCOPintEvZ9+5jnEInzJfREmem8q2vg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=cd7ttySd; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cd7ttySd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708097336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X7CZOyXG6xCsS25p93OCgGL3CKwaUM6KdPuUn2c9nUM=; b=cd7ttySda+P25l4eRrpF2AY6hBRWsBgeN3zkrxY7TyGs+e7MqiD4jp43EtO2U0LPu0vUqT DtjrRSfS3b0w4MT+8srZscGUiLZQXARBnduBakunfUGPE+G/lX3dkvDtghAumkbMe2AxQH EWDTwLxM3uP2xUlA1j4JSrfUm5ccLa8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-F2P-j2oBNnyNfOk3U04lOg-1; Fri, 16 Feb 2024 10:28:51 -0500 X-MC-Unique: F2P-j2oBNnyNfOk3U04lOg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 04472863721; Fri, 16 Feb 2024 15:28:51 +0000 (UTC) Received: from RHTPC1VM0NT.lan (unknown [10.22.33.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89C3F1C060B1; Fri, 16 Feb 2024 15:28:50 +0000 (UTC) From: Aaron Conole To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Pravin B Shelar , dev@openvswitch.org, Ilya Maximets , Simon Horman , Eelco Chaudron , Shuah Khan , linux-kselftest@vger.kernel.org Subject: [RFC 6/7] selftests: openvswitch: insert module when running the tests Date: Fri, 16 Feb 2024 10:28:45 -0500 Message-ID: <20240216152846.1850120-7-aconole@redhat.com> In-Reply-To: <20240216152846.1850120-1-aconole@redhat.com> References: <20240216152846.1850120-1-aconole@redhat.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 The openvswitch tests do not attempt to insert the openvswitch module automatically. Now the test will auto load the module and try to unload it at the end. The test harness includes the option to not load the module, which is helpful when developing changes and loading the module from a different location. Signed-off-by: Aaron Conole --- .../testing/selftests/net/openvswitch/openvswitch.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh index a2c106104fb8..e7c9b4fc5591 100755 --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh @@ -672,12 +672,14 @@ run_test() { exitcode=0 desc=0 all_skipped=true +LOAD_MOD=yes while getopts :pvt o do case $o in p) PAUSE_ON_FAIL=yes;; v) VERBOSE=1;; + n) LOAD_MOD=no;; t) if which tcpdump > /dev/null 2>&1; then TRACING=1 else @@ -697,6 +699,10 @@ for arg do command -v > /dev/null "test_${arg}" || { echo "=== Test ${arg} not found"; usage; } done +if [ "$LOAD_MOD" == "yes" ]; then + modprobe openvswitch +fi + name="" desc="" for t in ${tests}; do @@ -716,4 +722,9 @@ for t in ${tests}; do desc="" done + +if [ "$LOAD_MOD" == "yes" ]; then + modprobe -r openvswitch +fi + exit ${exitcode}