[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2ujds4l5ji7pdm7lczttukisjdoo5z5ufufw4kd3qyls26o64o@43yt3nkohsm6>
Date: Wed, 12 Nov 2025 12:24:51 +0100
From: Stefano Garzarella <sgarzare@...hat.com>
To: Bobby Eshleman <bobbyeshleman@...il.com>
Cc: Shuah Khan <shuah@...nel.org>, virtualization@...ts.linux.dev,
netdev@...r.kernel.org, linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
Simon Horman <horms@...nel.org>, Bobby Eshleman <bobbyeshleman@...a.com>
Subject: Re: [PATCH net-next v4 07/12] selftests/vsock: add check_result()
for pass/fail counting
On Sat, Nov 08, 2025 at 08:00:58AM -0800, Bobby Eshleman wrote:
>From: Bobby Eshleman <bobbyeshleman@...a.com>
>
>Add check_result() function to reuse logic for incrementing the
>pass/fail counters. This function will get used by different callers as
>we add different types of tests in future patches (namely, namespace and
>non-namespace tests will be called at different places, and re-use this
>function).
>
>Reviewed-by: Simon Horman <horms@...nel.org>
>Signed-off-by: Bobby Eshleman <bobbyeshleman@...a.com>
>---
>Changes in v4:
>- fix botched rebase
>- use more consistent ${VAR} style
>
>Changes in v3:
>- increment cnt_total directly (no intermediary var) (Stefano)
>- pass arg to check_result() from caller, dont incidentally rely on
> global (Stefano)
>- use new create_pidfile() introduce in v3 of earlier patch
>- continue with more disciplined variable quoting style
>---
> tools/testing/selftests/vsock/vmtest.sh | 32 +++++++++++++++++++++-----------
> 1 file changed, 21 insertions(+), 11 deletions(-)
Reviewed-by: Stefano Garzarella <sgarzare@...hat.com>
>
>diff --git a/tools/testing/selftests/vsock/vmtest.sh b/tools/testing/selftests/vsock/vmtest.sh
>index bd231467c66b..2dd9bbb8c4a9 100755
>--- a/tools/testing/selftests/vsock/vmtest.sh
>+++ b/tools/testing/selftests/vsock/vmtest.sh
>@@ -79,6 +79,26 @@ die() {
> exit "${KSFT_FAIL}"
> }
>
>+check_result() {
>+ local rc arg
>+
>+ rc=$1
>+ arg=$2
>+
>+ cnt_total=$(( cnt_total + 1 ))
>+
>+ if [[ ${rc} -eq ${KSFT_PASS} ]]; then
>+ cnt_pass=$(( cnt_pass + 1 ))
>+ echo "ok ${cnt_total} ${arg}"
>+ elif [[ ${rc} -eq ${KSFT_SKIP} ]]; then
>+ cnt_skip=$(( cnt_skip + 1 ))
>+ echo "ok ${cnt_total} ${arg} # SKIP"
>+ elif [[ ${rc} -eq ${KSFT_FAIL} ]]; then
>+ cnt_fail=$(( cnt_fail + 1 ))
>+ echo "not ok ${cnt_total} ${arg} # exit=${rc}"
>+ fi
>+}
>+
> vm_ssh() {
> ssh -q -o UserKnownHostsFile=/dev/null -p ${SSH_HOST_PORT} localhost "$@"
> return $?
>@@ -530,17 +550,7 @@ cnt_total=0
> for arg in "${ARGS[@]}"; do
> run_test "${arg}"
> rc=$?
>- if [[ ${rc} -eq $KSFT_PASS ]]; then
>- cnt_pass=$(( cnt_pass + 1 ))
>- echo "ok ${cnt_total} ${arg}"
>- elif [[ ${rc} -eq $KSFT_SKIP ]]; then
>- cnt_skip=$(( cnt_skip + 1 ))
>- echo "ok ${cnt_total} ${arg} # SKIP"
>- elif [[ ${rc} -eq $KSFT_FAIL ]]; then
>- cnt_fail=$(( cnt_fail + 1 ))
>- echo "not ok ${cnt_total} ${arg} # exit=$rc"
>- fi
>- cnt_total=$(( cnt_total + 1 ))
>+ check_result "${rc}" "${arg}"
> done
>
> terminate_pidfiles "${pidfile}"
>
>--
>2.47.3
>
Powered by blists - more mailing lists