Skip to content

Commit

Permalink
tgupdate: merge t/upstream base into t/upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
matttbe committed Jun 20, 2022
2 parents f267d3b + 77c5def commit 1445c5f
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions tools/testing/selftests/net/mptcp/diag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,39 @@ chk_msk_nr()
__chk_nr "grep -c token:" $*
}

wait_msk_nr()
{
local condition="grep -c token:"
local expected=$1
local timeout=20
local msg nr
local max=0
local i=0

shift 1
msg=$*

while [ $i -lt $timeout ]; do
nr=$(ss -inmHMN $ns | $condition)
[ $nr == $expected ] && break;
[ $nr -gt $max ] && max=$nr
i=$((i + 1))
sleep 1
done

printf "%-50s" "$msg"
if [ $i -ge $timeout ]; then
echo "[ fail ] timeout while expecting $expected max $max last $nr"
ret=$test_cnt
elif [ $nr != $expected ]; then
echo "[ fail ] expected $expected found $nr"
ret=$test_cnt
else
echo "[ ok ]"
fi
test_cnt=$((test_cnt+1))
}

chk_msk_fallback_nr()
{
__chk_nr "grep -c fallback" $*
Expand Down Expand Up @@ -184,7 +217,7 @@ for I in `seq 1 $NR_CLIENTS`; do
echo "a" | \
timeout ${timeout_test} \
ip netns exec $ns \
./mptcp_connect -p $((I+10001)) -l -w 10 \
./mptcp_connect -p $((I+10001)) -l -w 20 \
-t ${timeout_poll} 0.0.0.0 >/dev/null &
done
wait_local_port_listen $ns $((NR_CLIENTS + 10001))
Expand All @@ -193,12 +226,11 @@ for I in `seq 1 $NR_CLIENTS`; do
echo "b" | \
timeout ${timeout_test} \
ip netns exec $ns \
./mptcp_connect -p $((I+10001)) -w 10 \
./mptcp_connect -p $((I+10001)) -w 20 \
-t ${timeout_poll} 127.0.0.1 >/dev/null &
done
sleep 1.5

chk_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present"
flush_pids

exit $ret

0 comments on commit 1445c5f

Please sign in to comment.