Commit 34b572b7 authored by Geliang Tang's avatar Geliang Tang Committed by Jakub Kicinski

selftests: mptcp: reuse linkfail to make given size files

This patch reused the test_linkfail values above 2 to make test files with
the given sizes (KB) for both the client side and the server side. It's
useful for the test cases using different file sizes.
Signed-off-by: default avatarGeliang Tang <geliang.tang@suse.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent cbfafac4
...@@ -459,7 +459,7 @@ do_transfer() ...@@ -459,7 +459,7 @@ do_transfer()
local_addr="0.0.0.0" local_addr="0.0.0.0"
fi fi
if [ "$test_link_fail" -eq 2 ];then if [ "$test_link_fail" -gt 1 ];then
timeout ${timeout_test} \ timeout ${timeout_test} \
ip netns exec ${listener_ns} \ ip netns exec ${listener_ns} \
./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ ./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \
...@@ -479,13 +479,19 @@ do_transfer() ...@@ -479,13 +479,19 @@ do_transfer()
ip netns exec ${connector_ns} \ ip netns exec ${connector_ns} \
./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \ ./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
$extra_args $connect_addr < "$cin" > "$cout" & $extra_args $connect_addr < "$cin" > "$cout" &
else elif [ "$test_link_fail" -eq 1 ] || [ "$test_link_fail" -eq 2 ];then
( cat "$cinfail" ; sleep 2; link_failure $listener_ns ; cat "$cinfail" ) | \ ( cat "$cinfail" ; sleep 2; link_failure $listener_ns ; cat "$cinfail" ) | \
tee "$cinsent" | \ tee "$cinsent" | \
timeout ${timeout_test} \ timeout ${timeout_test} \
ip netns exec ${connector_ns} \ ip netns exec ${connector_ns} \
./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \ ./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
$extra_args $connect_addr > "$cout" & $extra_args $connect_addr > "$cout" &
else
cat "$cinfail" | tee "$cinsent" | \
timeout ${timeout_test} \
ip netns exec ${connector_ns} \
./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \
$extra_args $connect_addr > "$cout" &
fi fi
cpid=$! cpid=$!
...@@ -645,7 +651,7 @@ do_transfer() ...@@ -645,7 +651,7 @@ do_transfer()
return 1 return 1
fi fi
if [ "$test_link_fail" -eq 2 ];then if [ "$test_link_fail" -gt 1 ];then
check_transfer $sinfail $cout "file received by client" check_transfer $sinfail $cout "file received by client"
else else
check_transfer $sin $cout "file received by client" check_transfer $sin $cout "file received by client"
...@@ -690,9 +696,18 @@ run_tests() ...@@ -690,9 +696,18 @@ run_tests()
speed="${7:-fast}" speed="${7:-fast}"
sflags="${8:-""}" sflags="${8:-""}"
# The values above 2 are reused to make test files
# with the given sizes (KB)
if [ "$test_linkfail" -gt 2 ]; then
size=$test_linkfail
if [ -z "$cinfail" ]; then
cinfail=$(mktemp)
fi
make_file "$cinfail" "client" $size
# create the input file for the failure test when # create the input file for the failure test when
# the first failure test run # the first failure test run
if [ "$test_linkfail" -ne 0 -a -z "$cinfail" ]; then elif [ "$test_linkfail" -ne 0 -a -z "$cinfail" ]; then
# the client file must be considerably larger # the client file must be considerably larger
# of the maximum expected cwin value, or the # of the maximum expected cwin value, or the
# link utilization will be not predicable # link utilization will be not predicable
...@@ -705,7 +720,14 @@ run_tests() ...@@ -705,7 +720,14 @@ run_tests()
make_file "$cinfail" "client" $size make_file "$cinfail" "client" $size
fi fi
if [ "$test_linkfail" -eq 2 -a -z "$sinfail" ]; then if [ "$test_linkfail" -gt 2 ]; then
size=$test_linkfail
if [ -z "$sinfail" ]; then
sinfail=$(mktemp)
fi
make_file "$sinfail" "server" $size
elif [ "$test_linkfail" -eq 2 -a -z "$sinfail" ]; then
size=$((RANDOM%16)) size=$((RANDOM%16))
size=$((size+1)) size=$((size+1))
size=$((size*2048)) size=$((size*2048))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment