From: Ido Schimmel <idosch@idosch.org>
To: Anna Emese Nyiri <annaemesenyiri@gmail.com>
Cc: netdev@vger.kernel.org, fejes@inf.elte.hu, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, willemb@google.com,
davem@davemloft.net, horms@kernel.org, shuah@kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next 1/1] selftests: net: Add support for testing SO_RCVMARK and SO_RCVPRIORITY
Date: Sun, 2 Feb 2025 18:00:37 +0200 [thread overview]
Message-ID: <Z5-WpRAnP40UsMOS@shredder> (raw)
In-Reply-To: <20250129143601.16035-2-annaemesenyiri@gmail.com>
On Wed, Jan 29, 2025 at 03:36:01PM +0100, Anna Emese Nyiri wrote:
> diff --git a/tools/testing/selftests/net/test_so_rcv.sh b/tools/testing/selftests/net/test_so_rcv.sh
> new file mode 100755
> index 000000000000..12d37f9ab905
> --- /dev/null
> +++ b/tools/testing/selftests/net/test_so_rcv.sh
> @@ -0,0 +1,56 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +HOST=127.0.0.1
> +PORT=1234
> +TOTAL_TESTS=0
> +FAILED_TESTS=0
> +
> +declare -A TESTS=(
> + ["SO_RCVPRIORITY"]="-P 2"
> + ["SO_RCVMARK"]="-M 3"
> +)
> +
> +check_result() {
> + ((TOTAL_TESTS++))
> + if [ "$1" -ne 0 ]; then
> + ((FAILED_TESTS++))
> + fi
> +}
> +
> +for test_name in "${!TESTS[@]}"; do
> + echo "Running $test_name test"
> + arg=${TESTS[$test_name]}
> +
> + ./so_rcv_listener $arg $HOST $PORT &
> + LISTENER_PID=$!
> +
> + if ./cmsg_sender $arg $HOST $PORT; then
In addition to the other comments, please run both binaries in a
namespace that the test creates at the beginning via setup_ns() (from
lib.sh) and deletes at the end via cleanup_ns().
Thanks for adding the test.
> + echo "Sender succeeded for $test_name"
> + else
> + echo "Sender failed for $test_name"
> + kill "$LISTENER_PID" 2>/dev/null
> + wait "$LISTENER_PID"
> + check_result 1
> + continue
> + fi
> +
> + wait "$LISTENER_PID"
> + LISTENER_EXIT_CODE=$?
> +
> + if [ "$LISTENER_EXIT_CODE" -eq 0 ]; then
> + echo "Rcv test OK for $test_name"
> + check_result 0
> + else
> + echo "Rcv test FAILED for $test_name"
> + check_result 1
> + fi
> +done
> +
> +if [ "$FAILED_TESTS" -ne 0 ]; then
> + echo "FAIL - $FAILED_TESTS/$TOTAL_TESTS tests failed"
> + exit 1
> +else
> + echo "OK - All $TOTAL_TESTS tests passed"
> + exit 0
> +fi
> --
> 2.43.0
>
prev parent reply other threads:[~2025-02-02 16:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-29 14:36 [PATCH net-next 0/1] selftests: net: Add support for testing SO_RCVMARK and SO_RCVPRIORITY Anna Emese Nyiri
2025-01-29 14:36 ` [PATCH net-next 1/1] " Anna Emese Nyiri
2025-01-29 20:05 ` Jakub Kicinski
2025-01-30 13:27 ` Anna Nyiri
2025-01-30 15:06 ` Willem de Bruijn
2025-01-30 15:15 ` Willem de Bruijn
2025-02-02 16:00 ` Ido Schimmel [this message]
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=Z5-WpRAnP40UsMOS@shredder \
--to=idosch@idosch.org \
--cc=annaemesenyiri@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fejes@inf.elte.hu \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=willemb@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).