From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v7 8/8] selftests: mptcp: print test results with colors
Date: Thu, 29 Feb 2024 14:04:57 +0100 [thread overview]
Message-ID: <409065cf-bab0-413b-8533-0b80b28862d4@kernel.org> (raw)
In-Reply-To: <81fd6204fc60dd90a4410b3435ab4552402b71c0.1709200070.git.tanggeliang@kylinos.cn>
On 29/02/2024 10:51, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> To unify the output formats of all test scripts, this patch adds
> four more helpers:
>
> mptcp_lib_pr_ok()
> mptcp_lib_pr_skip()
> mptcp_lib_pr_fail()
> mptcp_lib_pr_info()
>
> to print out [ OK ], [SKIP], [FAIL] and 'INFO: ' with colors. Use them
> in all scripts to print the "ok/skip/fail/info' using the same 'format'.
>
> Having colors helps to quickly identify issues when looking at a long
> list of output logs and results.
>
> Note that the mptcp_join.sh tests will now print these keywords with
> capital letters, like most of the other tests.
I think it is not just mptcp_join.sh that was using different keywords.
Note that now all print the same keywords, which was not the case
before, but it is good to uniform that.
(...)
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> index 096ff8941c5b..70acbb19f568 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
(...)
> @@ -534,7 +534,6 @@ do_transfer()
> "${expect_ackrx}" "${stat_ackrx_now_l}"
> fi
>
> - echo
Just to be sure: do we still have something good in case of error?
I mean: why were we not printing a new line before? Maybe there was no
reason, or maybe sometimes we print more details? (syn cookies?)
Maybe that's fine with the new output, it is just to know if you checked
that.
> cat "$capout"
> [ $retc -eq 0 ] && [ $rets -eq 0 ]
> }
(...)
> @@ -810,7 +809,7 @@ log_if_error()
> local msg="$1"
>
> if [ ${ret} -ne 0 ]; then
> - echo "FAIL: ${msg}" 1>&2
> + mptcp_lib_pr_fail "${msg}"
Good to mention in the commit message that all errors messages are
printed to 'stdout' now, as part of the uniformation. (or do that in an
dedicated commit)
>
> final_ret=${ret}
> ret=0
> @@ -858,11 +857,11 @@ done
> mptcp_lib_result_code "${ret}" "ping tests"
>
> stop_if_error "Could not even run ping tests"
> -echo "[ OK ]"
> +mptcp_lib_pr_ok
> MPTCP_LIB_TEST_FORMAT="%02u %-50s"
>
> [ -n "$tc_loss" ] && tc -net "$ns2" qdisc add dev ns2eth3 root netem loss random $tc_loss delay ${tc_delay}ms
> -echo -n "INFO: Using loss of $tc_loss "
Here, it was using 'echo -n' ...
> +mptcp_lib_pr_info "Using loss of $tc_loss "
Now a new line will be printed at the end (with a trailing whitespace)
> test "$tc_delay" -gt 0 && echo -n "delay $tc_delay ms "
And this will be printed in a new line, it will look strange I think
Maybe use a variable to store all the info?
tc_info="loss of $tc_loss "
test "$tc_delay" -gt 0 && tc_info+="delay $tc_delay ms "
(...)
mptcp_lib_pr_info "Using ${tc_info}"
>
> reorder_delay=$((tc_delay / 4))
(...)
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> index 358d5b77fc0f..53867f9d212d 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> @@ -48,6 +48,23 @@ mptcp_lib_print_err() {
> mptcp_lib_print_color "${MPTCP_LIB_COLOR_RED}${*}"
> }
>
> +#shellcheck disable=SC2120
Add a space after '#' and add a comment justifying the exception, like
the one I shared in patch 1/9 from v6:
# shellcheck disable=SC2120 # parameters are optional
Out of curiosity, we don't need this for 'skip' and 'fail'?
> +mptcp_lib_pr_ok() {
> + mptcp_lib_print_ok "[ OK ]${1:+ ${*}}"
> +}
> +
> +mptcp_lib_pr_skip() {
> + mptcp_lib_print_warn "[SKIP]${1:+ ${*}}"
> +}
> +
> +mptcp_lib_pr_fail() {
> + mptcp_lib_print_err "[FAIL]${1:+ ${*}}"
> +}
> +
> +mptcp_lib_pr_info() {
> + mptcp_lib_print_info "INFO: ${*}"
> +}
> +
> # SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES env var can be set when validating all
> # features using the last version of the kernel and the selftests to make sure
> # a test is not being skipped by mistake.
(...)
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
> index a797e13d3fe7..d695561fbf46 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh
(...)
> @@ -217,7 +218,7 @@ do_mptcp_sockopt_tests()
> local lret=0
>
> if ! mptcp_lib_kallsyms_has "mptcp_diag_fill_info$"; then
> - echo "INFO: MPTCP sockopt not supported: SKIP"
> + mptcp_lib_pr_skip "MPTCP sockopt not supported"
> mptcp_lib_result_skip "sockopt"
> return
> fi
> @@ -227,12 +228,12 @@ do_mptcp_sockopt_tests()
>
> mptcp_lib_print_title "SOL_MPTCP sockopt v4"
> if [ $lret -ne 0 ]; then
> - echo "FAIL: SOL_MPTCP getsockopt" 1>&2
> + mptcp_lib_pr_fail "SOL_MPTCP getsockopt"
No need to repeat what is already in the title. (I didn't check them
all, but I guess some other subtests here repeat stuff already in the
title, e.g. the same for v6)
> mptcp_lib_result_fail "sockopt v4"
> ret=$lret
> return
> fi
> - echo "[ OK ]"
> + mptcp_lib_pr_ok
> mptcp_lib_result_pass "sockopt v4"
>
> ip netns exec "$ns_sbox" ./mptcp_sockopt -6
(...)
> @@ -288,7 +289,7 @@ do_tcpinq_tests()
> local lret=0
>
> if ! mptcp_lib_kallsyms_has "mptcp_ioctl$"; then
> - echo "INFO: TCP_INQ not supported: SKIP"
> + mptcp_lib_pr_skip "INFO: TCP_INQ not supported"
You can remove 'INFO: ' I suppose.
> mptcp_lib_result_skip "TCP_INQ"
> return
> fi
(...)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2024-02-29 13:05 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 9:51 [PATCH mptcp-next v7 0/8] add helpers and vars in mptcp_lib.sh, part 3 Geliang Tang
2024-02-29 9:51 ` [PATCH mptcp-net v7 1/8] selftests: mptcp: diag: return KSFT_FAIL not test_cnt Geliang Tang
2024-02-29 10:51 ` Matthieu Baerts
2024-02-29 9:51 ` [PATCH mptcp-next v7 2/8] selftests: mptcp: connect: add dedicated port counter Geliang Tang
2024-02-29 11:23 ` Matthieu Baerts
2024-02-29 12:18 ` Geliang Tang
2024-02-29 12:22 ` Matthieu Baerts
2024-03-01 7:01 ` Geliang Tang
2024-02-29 9:51 ` [PATCH mptcp-next v7 3/8] selftests: mptcp: connect: fix misaligned output Geliang Tang
2024-02-29 9:51 ` [PATCH mptcp-next v7 4/8] selftests: mptcp: simult_flows: " Geliang Tang
2024-02-29 10:07 ` Geliang Tang
2024-02-29 10:27 ` Matthieu Baerts
2024-02-29 12:01 ` Geliang Tang
2024-02-29 12:18 ` Matthieu Baerts
2024-02-29 14:35 ` Matthieu Baerts
2024-02-29 9:51 ` [PATCH mptcp-next v7 5/8] selftests: mptcp: sockopt: unify ipv4/ipv6 as v4/v6 Geliang Tang
2024-02-29 11:31 ` Matthieu Baerts
2024-02-29 12:08 ` Geliang Tang
2024-02-29 12:20 ` Matthieu Baerts
2024-02-29 9:51 ` [PATCH mptcp-next v7 6/8] selftests: mptcp: add test counter helpers Geliang Tang
2024-02-29 11:58 ` Matthieu Baerts
2024-02-29 12:03 ` Matthieu Baerts
2024-02-29 12:28 ` Matthieu Baerts
2024-03-01 7:03 ` Geliang Tang
2024-02-29 9:51 ` [PATCH mptcp-next v7 7/8] selftests: mptcp: print test results with counters Geliang Tang
2024-02-29 12:44 ` Matthieu Baerts
2024-02-29 9:51 ` [PATCH mptcp-next v7 8/8] selftests: mptcp: print test results with colors Geliang Tang
2024-02-29 10:43 ` selftests: mptcp: print test results with colors: Tests Results MPTCP CI
2024-02-29 13:04 ` Matthieu Baerts [this message]
2024-03-01 7:16 ` [PATCH mptcp-next v7 8/8] selftests: mptcp: print test results with colors Geliang Tang
2024-03-04 11:12 ` Matthieu Baerts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=409065cf-bab0-413b-8533-0b80b28862d4@kernel.org \
--to=matttbe@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=tanggeliang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.