diff mbox series

[net,v4,2/2] selftests: rtnetlink: check enslaving iface in a bond

Message ID 20240108094103.2001224-3-nicolas.dichtel@6wind.com (mailing list archive)
State Accepted
Commit a159cbe81d3b88bf35cd4edb4e6040d015972fdd
Delegated to: Netdev Maintainers
Headers show
Series rtnetlink: allow to enslave with one msg an up interface | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success SINGLE THREAD; Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 0 of 0 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success net selftest script(s) already in Makefile
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch warning WARNING: line length of 84 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Nicolas Dichtel Jan. 8, 2024, 9:41 a.m. UTC
The goal is to check the following two sequences:
> ip link set dummy0 up
> ip link set dummy0 master bond0 down

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 tools/testing/selftests/net/rtnetlink.sh | 28 ++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Jiri Pirko Jan. 8, 2024, 10:31 a.m. UTC | #1
Mon, Jan 08, 2024 at 10:41:03AM CET, nicolas.dichtel@6wind.com wrote:
>The goal is to check the following two sequences:
>> ip link set dummy0 up
>> ip link set dummy0 master bond0 down
>
>Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Hangbin Liu Jan. 12, 2024, 1:15 a.m. UTC | #2
On Mon, Jan 08, 2024 at 10:41:03AM +0100, Nicolas Dichtel wrote:
> The goal is to check the following two sequences:
> > ip link set dummy0 up
> > ip link set dummy0 master bond0 down
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
>  tools/testing/selftests/net/rtnetlink.sh | 28 ++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
> index 26827ea4e3e5..bbf9d2bd3d7b 100755
> --- a/tools/testing/selftests/net/rtnetlink.sh
> +++ b/tools/testing/selftests/net/rtnetlink.sh
> @@ -28,6 +28,7 @@ ALL_TESTS="
>  	kci_test_neigh_get
>  	kci_test_bridge_parent_id
>  	kci_test_address_proto
> +	kci_test_enslave_bonding
>  "
>  
>  devdummy="test-dummy0"
> @@ -1239,6 +1240,33 @@ kci_test_address_proto()
>  	return $ret
>  }
>  
> +kci_test_enslave_bonding()
> +{
> +	local testns="testns"
> +	local bond="bond123"
> +	local dummy="dummy123"
> +	local ret=0
> +
> +	run_cmd ip netns add "$testns"
> +	if [ $ret -ne 0 ]; then
> +		end_test "SKIP bonding tests: cannot add net namespace $testns"
> +		return $ksft_skip
> +	fi
> +
> +	run_cmd ip -netns $testns link add dev $bond type bond mode balance-rr

Hi Nicolas,

FYI, the selftests/net/lib.sh has been merged to net tree. Please remember
send a following up update to create the netns with setup_ns.

Thanks
Hangbin
Nicolas Dichtel Jan. 12, 2024, 8:06 a.m. UTC | #3
Le 12/01/2024 à 02:15, Hangbin Liu a écrit :
[snip]
> Hi Nicolas,
> 
> FYI, the selftests/net/lib.sh has been merged to net tree. Please remember
> send a following up update to create the netns with setup_ns.
Please be patient and don't worry.
I said I will send an update, and thus I will send an update.


Regards,
Nicolas
Hangbin Liu Jan. 12, 2024, 9:38 a.m. UTC | #4
On Fri, Jan 12, 2024 at 09:06:56AM +0100, Nicolas Dichtel wrote:
> Le 12/01/2024 à 02:15, Hangbin Liu a écrit :
> [snip]
> > Hi Nicolas,
> > 
> > FYI, the selftests/net/lib.sh has been merged to net tree. Please remember
> > send a following up update to create the netns with setup_ns.
> Please be patient and don't worry.
> I said I will send an update, and thus I will send an update.

It's just a reminder. Not pushing you. Sorry if this makes you feel disturbed.

Regards
Hangbin
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 26827ea4e3e5..bbf9d2bd3d7b 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -28,6 +28,7 @@  ALL_TESTS="
 	kci_test_neigh_get
 	kci_test_bridge_parent_id
 	kci_test_address_proto
+	kci_test_enslave_bonding
 "
 
 devdummy="test-dummy0"
@@ -1239,6 +1240,33 @@  kci_test_address_proto()
 	return $ret
 }
 
+kci_test_enslave_bonding()
+{
+	local testns="testns"
+	local bond="bond123"
+	local dummy="dummy123"
+	local ret=0
+
+	run_cmd ip netns add "$testns"
+	if [ $ret -ne 0 ]; then
+		end_test "SKIP bonding tests: cannot add net namespace $testns"
+		return $ksft_skip
+	fi
+
+	run_cmd ip -netns $testns link add dev $bond type bond mode balance-rr
+	run_cmd ip -netns $testns link add dev $dummy type dummy
+	run_cmd ip -netns $testns link set dev $dummy up
+	run_cmd ip -netns $testns link set dev $dummy master $bond down
+	if [ $ret -ne 0 ]; then
+		end_test "FAIL: initially up interface added to a bond and set down"
+		ip netns del "$testns"
+		return 1
+	fi
+
+	end_test "PASS: enslave interface in a bond"
+	ip netns del "$testns"
+}
+
 kci_test_rtnl()
 {
 	local current_test