File tree Expand file tree Collapse file tree 3 files changed +30
-38
lines changed
tools/testing/selftests/net/mptcp Expand file tree Collapse file tree 3 files changed +30
-38
lines changed Original file line number Diff line number Diff line change @@ -2794,15 +2794,9 @@ AF_INET6=10
2794
2794
2795
2795
verify_listener_events ()
2796
2796
{
2797
- local evt=$1
2798
2797
local e_type=$2
2799
- local e_family=$3
2800
2798
local e_saddr=$4
2801
2799
local e_sport=$5
2802
- local type
2803
- local family
2804
- local saddr
2805
- local sport
2806
2800
local name
2807
2801
2808
2802
if [ $e_type = $LISTENER_CREATED ]; then
@@ -2820,23 +2814,10 @@ verify_listener_events()
2820
2814
return
2821
2815
fi
2822
2816
2823
- type=$( mptcp_lib_evts_get_info type " $evt " " $e_type " )
2824
- family=$( mptcp_lib_evts_get_info family " $evt " " $e_type " )
2825
- sport=$( mptcp_lib_evts_get_info sport " $evt " " $e_type " )
2826
- if [ $family ] && [ $family = $AF_INET6 ]; then
2827
- saddr=$( mptcp_lib_evts_get_info saddr6 " $evt " " $e_type " )
2828
- else
2829
- saddr=$( mptcp_lib_evts_get_info saddr4 " $evt " " $e_type " )
2830
- fi
2831
-
2832
- if [ $type ] && [ $type = $e_type ] &&
2833
- [ $family ] && [ $family = $e_family ] &&
2834
- [ $saddr ] && [ $saddr = $e_saddr ] &&
2835
- [ $sport ] && [ $sport = $e_sport ]; then
2817
+ if mptcp_lib_verify_listener_events " ${@ } " ; then
2836
2818
print_ok
2837
2819
return 0
2838
2820
fi
2839
- print_fail " $e_type :$type $e_family :$family $e_saddr :$saddr $e_sport :$sport "
2840
2821
fail_test
2841
2822
}
2842
2823
Original file line number Diff line number Diff line change @@ -468,3 +468,29 @@ mptcp_lib_check_expected() {
468
468
469
469
return " ${rc} "
470
470
}
471
+
472
+ # shellcheck disable=SC2034 # Some variables are used below but indirectly
473
+ mptcp_lib_verify_listener_events () {
474
+ local evt=${1}
475
+ local e_type=${2}
476
+ local e_family=${3}
477
+ local e_saddr=${4}
478
+ local e_sport=${5}
479
+ local type
480
+ local family
481
+ local saddr
482
+ local sport
483
+ local rc=0
484
+
485
+ type=$( mptcp_lib_evts_get_info type " ${evt} " " ${e_type} " )
486
+ family=$( mptcp_lib_evts_get_info family " ${evt} " " ${e_type} " )
487
+ if [ " ${family} " ] && [ " ${family} " = " ${AF_INET6} " ]; then
488
+ saddr=$( mptcp_lib_evts_get_info saddr6 " ${evt} " " ${e_type} " )
489
+ else
490
+ saddr=$( mptcp_lib_evts_get_info saddr4 " ${evt} " " ${e_type} " )
491
+ fi
492
+ sport=$( mptcp_lib_evts_get_info sport " ${evt} " " ${e_type} " )
493
+
494
+ mptcp_lib_check_expected " type" " family" " saddr" " sport" || rc=" ${?} "
495
+ return " ${rc} "
496
+ }
Original file line number Diff line number Diff line change @@ -835,26 +835,11 @@ test_prio()
835
835
836
836
verify_listener_events ()
837
837
{
838
- local evt=$1
839
- local e_type=$2
840
- local e_family=$3
841
- local e_saddr=$4
842
- local e_sport=$5
843
- local type
844
- local family
845
- local saddr
846
- local sport
847
-
848
- type=$( mptcp_lib_evts_get_info type $evt $e_type )
849
- family=$( mptcp_lib_evts_get_info family $evt $e_type )
850
- sport=$( mptcp_lib_evts_get_info sport $evt $e_type )
851
- if [ $family ] && [ $family = $AF_INET6 ]; then
852
- saddr=$( mptcp_lib_evts_get_info saddr6 $evt $e_type )
838
+ if mptcp_lib_verify_listener_events " ${@ } " ; then
839
+ test_pass
853
840
else
854
- saddr= $( mptcp_lib_evts_get_info saddr4 $evt $e_type )
841
+ test_fail
855
842
fi
856
-
857
- check_expected " type" " family" " saddr" " sport"
858
843
}
859
844
860
845
test_listener ()
You can’t perform that action at this time.
0 commit comments