Commit 96b84195 authored by Matthieu Baerts's avatar Matthieu Baerts Committed by Jakub Kicinski

selftests: mptcp: join: uniform listener tests

The alignment was different from the other tests because tabs were used
instead of spaces.

While at it, also use 'echo' instead of 'printf' to print the result to
keep the same style as done in the other sub-tests. And, even if it
should be better with, also remove 'stdbuf' and sed's '--unbuffered'
option because they are not used in the other subtests and they are not
available when using a minimal environment with busybox.

Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
Fixes: 178d0232 ("selftests: mptcp: listener test for in-kernel PM")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 0471bb47
......@@ -2765,43 +2765,41 @@ verify_listener_events()
local family
local saddr
local sport
local name
if [ $e_type = $LISTENER_CREATED ]; then
stdbuf -o0 -e0 printf "\t\t\t\t\t CREATE_LISTENER %s:%s"\
$e_saddr $e_sport
name="LISTENER_CREATED"
elif [ $e_type = $LISTENER_CLOSED ]; then
stdbuf -o0 -e0 printf "\t\t\t\t\t CLOSE_LISTENER %s:%s "\
$e_saddr $e_sport
name="LISTENER_CLOSED"
else
name="$e_type"
fi
printf "%-${nr_blank}s %s %s:%s " " " "$name" "$e_saddr" "$e_sport"
if ! mptcp_lib_kallsyms_has "mptcp_event_pm_listener$"; then
printf "[skip]: event not supported\n"
return
fi
type=$(grep "type:$e_type," $evt |
sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q')
family=$(grep "type:$e_type," $evt |
sed --unbuffered -n 's/.*\(family:\)\([[:digit:]]*\).*$/\2/p;q')
sport=$(grep "type:$e_type," $evt |
sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
type=$(grep "type:$e_type," $evt | sed -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q')
family=$(grep "type:$e_type," $evt | sed -n 's/.*\(family:\)\([[:digit:]]*\).*$/\2/p;q')
sport=$(grep "type:$e_type," $evt | sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
if [ $family ] && [ $family = $AF_INET6 ]; then
saddr=$(grep "type:$e_type," $evt |
sed --unbuffered -n 's/.*\(saddr6:\)\([0-9a-f:.]*\).*$/\2/p;q')
saddr=$(grep "type:$e_type," $evt | sed -n 's/.*\(saddr6:\)\([0-9a-f:.]*\).*$/\2/p;q')
else
saddr=$(grep "type:$e_type," $evt |
sed --unbuffered -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q')
saddr=$(grep "type:$e_type," $evt | sed -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q')
fi
if [ $type ] && [ $type = $e_type ] &&
[ $family ] && [ $family = $e_family ] &&
[ $saddr ] && [ $saddr = $e_saddr ] &&
[ $sport ] && [ $sport = $e_sport ]; then
stdbuf -o0 -e0 printf "[ ok ]\n"
echo "[ ok ]"
return 0
fi
fail_test
stdbuf -o0 -e0 printf "[fail]\n"
echo "[fail]"
}
add_addr_ports_tests()
......
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