Skip to content

Commit 07105a2

Browse files
matttbeintel-lab-lkp
authored andcommitted
selftests: mptcp: join: do_transfer: reduce code dup
The same extra long command is present twice, with one small different: the var for the stdin file is different. Use a new dedicated var in one command to avoid this code duplication. Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent 3afc295 commit 07105a2

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,7 @@ do_transfer()
951951
local FAILING_LINKS=${FAILING_LINKS:-""}
952952
local fastclose=${fastclose:-""}
953953
local speed=${speed:-"fast"}
954+
local in="${sin}"
954955
port=$(get_port)
955956

956957
:> "$cout"
@@ -999,16 +1000,12 @@ do_transfer()
9991000

10001001
extra_srv_args="$extra_args $extra_srv_args"
10011002
if [ "$test_linkfail" -gt 1 ];then
1002-
timeout ${timeout_test} \
1003-
ip netns exec ${listener_ns} \
1004-
./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
1005-
$extra_srv_args "::" < "$sinfail" > "$sout" &
1006-
else
1007-
timeout ${timeout_test} \
1008-
ip netns exec ${listener_ns} \
1009-
./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
1010-
$extra_srv_args "::" < "$sin" > "$sout" &
1003+
in="${sinfail}"
10111004
fi
1005+
timeout ${timeout_test} \
1006+
ip netns exec ${listener_ns} \
1007+
./mptcp_connect -t ${timeout_poll} -l -p ${port} -s ${srv_proto} \
1008+
${extra_srv_args} "::" < "${in}" > "${sout}" &
10121009
local spid=$!
10131010

10141011
mptcp_lib_wait_local_port_listen "${listener_ns}" "${port}"

0 commit comments

Comments
 (0)