Use mptcp_lib_print_ok(), _warn() and _err() to instead print_results()
in test_pass(), _skip() and _fail() in userspace_pm.sh to print test
results with colors.
Having colors helps to quickly identify issues when looking at a long
list of output logs and results.
Reviewed-by: Matthieu Baerts <matttbe@kernel.org>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
tools/testing/selftests/net/mptcp/userspace_pm.sh | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
index bba42f165340..27ddbd8cf03f 100755
--- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
+++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
@@ -74,27 +74,22 @@ print_test()
_printf "%-63s" "${test_name}"
}
-print_results()
-{
- _printf "[%s]\n" "${1}"
-}
-
test_pass()
{
- print_results " OK "
+ mptcp_lib_print_ok "[ ok ]${1:+ ${*}}"
mptcp_lib_result_pass "${test_name}"
}
test_skip()
{
- print_results "SKIP"
+ mptcp_lib_print_warn "[skip]${1:+ ${*}}"
mptcp_lib_result_skip "${test_name}"
}
# $1: msg
test_fail()
{
- print_results "FAIL"
+ mptcp_lib_print_err "[fail]${1:+ ${*}}"
ret=1
if [ -n "${1}" ]; then
--
2.35.3