Hi Geliang,
On 06/11/2023 13:55, Geliang Tang wrote:
> Please add this line into the commit log:
>
> '''
> Use this helper in test_prio() in userspace_pm.sh too instead of
> open-coding.
> '''
Good idea!
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> tools/testing/selftests/net/mptcp/userspace_pm.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> index f9156f544ebf..8d95ea94c019 100755
> --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
> +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> @@ -874,7 +874,7 @@ test_prio()
>
> # Check TX
> print_test "MP_PRIO TX"
> - count=$(ip netns exec "$ns2" nstat -as | grep MPTcpExtMPPrioTx | awk '{print $2}')
> + count=$(mptcp_lib_get_counter "$ns2" "MPTcpExtMPPrioTx")
> [ -z "$count" ] && count=0
mptcp_lib_get_counter() should only return an empty string if the
counter doesn't exist on the tested kernel. So if you use this helper,
it doesn't really make sense to have this check. Or keep it and skip the
test.
> if [ $count != 1 ]; then
So I think it would be better to follow the same style as in mptcp_join.sh:
count=$(mptcp_lib_get_counter ...)
if [ -z "$count" ]; then
print_skip
elif [ "$count" != (...) ]; then
(...)
WDYT?
> test_fail "Count != 1: ${count}"
> @@ -884,7 +884,7 @@ test_prio()
>
> # Check RX
> print_test "MP_PRIO RX"
> - count=$(ip netns exec "$ns1" nstat -as | grep MPTcpExtMPPrioRx | awk '{print $2}')
> + count=$(mptcp_lib_get_counter "$ns1" "MPTcpExtMPPrioRx")
> [ -z "$count" ] && count=0
> if [ $count != 1 ]; then
Same here.
> test_fail "Count != 1: ${count}"
Cheers,
Matt