From: Allison Henderson <allison.henderson@oracle.com>
To: "horms@kernel.org" <horms@kernel.org>
Cc: "rds-devel@oss.oracle.com" <rds-devel@oss.oracle.com>,
Vegard Nossum <vegard.nossum@oracle.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"oberpar@linux.ibm.com" <oberpar@linux.ibm.com>,
Chuck Lever III <chuck.lever@oracle.com>
Subject: Re: [RFC net-next 3/3] selftests: rds: add testing infrastructure
Date: Sun, 9 Jun 2024 18:08:55 +0000 [thread overview]
Message-ID: <a84cdf6d300fac678f3de433e561ec569bc79585.camel@oracle.com> (raw)
In-Reply-To: <20240607202402.GI27689@kernel.org>
On Fri, 2024-06-07 at 21:24 +0100, Simon Horman wrote:
+cc Chuck Lever, Peter Oberparleiter, Vegard Nossum, rds-devel
> On Thu, Jun 06, 2024 at 05:36:31PM -0700,
> allison.henderson@oracle.com wrote:
> > From: Vegard Nossum <vegard.nossum@oracle.com>
> >
> > This adds some basic self-testing infrastructure for RDS.
> >
> > Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> > Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
> > Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>
> Hi Allison,
>
> Some minor nits from my side.
>
> > diff --git a/tools/testing/selftests/net/rds/config.sh
> > b/tools/testing/selftests/net/rds/config.sh
> > new file mode 100755
> > index 000000000000..c2c36756ba1f
> > --- /dev/null
> > +++ b/tools/testing/selftests/net/rds/config.sh
> > @@ -0,0 +1,33 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +#! /bin/bash
>
> #! line needs to be the first line for it to take effect
>
> Flagged by shellcheck.
>
> https://urldefense.com/v3/__https://www.shellcheck.net/wiki/SC1128__;!!ACWV5N9M2RV99hQ!OjLySFP6wNEm6wWK90hVJHa9RXAP8310v8V0uKLQ9KvODoyD8hUHX0CRLZpKBl1jQGwfR-vYcBI5w8wRwAI$
>
>
Ah, alrighty I will go through and fix all the shell check nits
> > +
> > +set -e
> > +set -u
> > +set -x
> > +
> > +unset KBUILD_OUTPUT
> > +
> > +# start with a default config
> > +make defconfig
> > +
> > +# no modules
> > +scripts/config --disable CONFIG_MODULES
> > +
> > +# enable RDS
> > +scripts/config --enable CONFIG_RDS
> > +scripts/config --enable CONFIG_RDS_TCP
> > +
> > +# instrument RDS and only RDS
> > +scripts/config --enable CONFIG_GCOV_KERNEL
> > +scripts/config --disable GCOV_PROFILE_ALL
> > +scripts/config --enable GCOV_PROFILE_RDS
> > +
> > +# need network namespaces to run tests with veth network
> > interfaces
> > +scripts/config --enable CONFIG_NET_NS
> > +scripts/config --enable CONFIG_VETH
> > +
> > +# simulate packet loss
> > +scripts/config --enable CONFIG_NET_SCH_NETEM
> > +
> > +# generate real .config without asking any questions
> > +make olddefconfig
> > diff --git a/tools/testing/selftests/net/rds/init.sh
> > b/tools/testing/selftests/net/rds/init.sh
> > new file mode 100755
> > index 000000000000..a29e3de81ed5
> > --- /dev/null
> > +++ b/tools/testing/selftests/net/rds/init.sh
> > @@ -0,0 +1,49 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +set -e
> > +set -u
> > +
> > +LOG_DIR=/tmp
> > +PY_CMD="/usr/bin/python3"
> > +while getopts "d:p:" opt; do
> > + case ${opt} in
> > + d)
> > + LOG_DIR=${OPTARG}
> > + ;;
> > + p)
> > + PY_CMD=${OPTARG}
> > + ;;
> > + :)
> > + echo "USAGE: init.sh [-d logdir] [-p python_cmd]"
> > + exit 1
> > + ;;
> > + ?)
> > + echo "Invalid option: -${OPTARG}."
> > + exit 1
> > + ;;
> > + esac
> > +done
> > +
> > +LOG_FILE=$LOG_DIR/rds-strace.txt
> > +
> > +mount -t proc none /proc
> > +mount -t sysfs none /sys
> > +mount -t tmpfs none /var/run
> > +mount -t debugfs none /sys/kernel/debug
> > +
> > +echo running RDS tests...
> > +echo Traces will be logged to $LOG_FILE
> > +rm -f $LOG_FILE
> > +strace -T -tt -o "$LOG_FILE" $PY_CMD $(dirname "$0")/test.py -d
> > "$LOG_DIR" || true
>
> Perhaps it can't occur, but I don't think this will behave as
> expected if the out put of dirname includes spaces.
>
> Flagged by shellecheck.
> https://urldefense.com/v3/__https://www.shellcheck.net/wiki/SC2046__;!!ACWV5N9M2RV99hQ!OjLySFP6wNEm6wWK90hVJHa9RXAP8310v8V0uKLQ9KvODoyD8hUHX0CRLZpKBl1jQGwfR-vYcBI5005wM3k$
>
>
> Also, $LOG_DIR is quoted here, but not elsewhere, which seems
> inconsistent.
Noted, yes it should probably be quoted
>
> > +
> > +echo saving coverage data...
> > +(set +x; cd /sys/kernel/debug/gcov; find * -name '*.gcda' | \
>
> shellcheck warns that:
>
> SC2035 (info): Use ./*glob* or -- *glob* so names with dashes won't
> become options.
>
> https://urldefense.com/v3/__https://www.shellcheck.net/wiki/SC2035__;!!ACWV5N9M2RV99hQ!OjLySFP6wNEm6wWK90hVJHa9RXAP8310v8V0uKLQ9KvODoyD8hUHX0CRLZpKBl1jQGwfR-vYcBI5Es_quwA$
>
>
> Although I guess in practice there are no filenames with dashes in
> that directory.
Not at the moment, but its always possible that such a file could be
introduced later. Will fix :-)
>
> > +while read f
> > +do
> > + cat < /sys/kernel/debug/gcov/$f > /$f
>
> Again, I guess it doesn't occur in practice.
> But should $f be quoted in case it includes whitespace?
Yes, I think so. Even if it's not an issue now, it would be nice to
not deal will testcase breakage if file name were to change in the
future. Will fix this too.
Thanks for the review! :-)
Allison
>
> > +done)
> > +
> > +dmesg > $LOG_DIR/dmesg.out
> > +
> > +/usr/sbin/poweroff --no-wtmp --force
>
> ...
next prev parent reply other threads:[~2024-06-09 18:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 0:36 [RFC net-next 0/3] selftests: rds selftest allison.henderson
2024-06-07 0:36 ` [RFC net-next 1/3] .gitignore: add .gcda files allison.henderson
2024-06-09 18:08 ` Allison Henderson
2024-06-07 0:36 ` [RFC net-next 2/3] net: rds: add option for GCOV profiling allison.henderson
2024-06-09 18:08 ` Allison Henderson
2024-06-07 0:36 ` [RFC net-next 3/3] selftests: rds: add testing infrastructure allison.henderson
2024-06-07 20:24 ` Simon Horman
2024-06-09 18:08 ` Allison Henderson [this message]
2024-06-09 18:08 ` [RFC net-next 0/3] selftests: rds selftest Allison Henderson
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=a84cdf6d300fac678f3de433e561ec569bc79585.camel@oracle.com \
--to=allison.henderson@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=horms@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oberpar@linux.ibm.com \
--cc=rds-devel@oss.oracle.com \
--cc=vegard.nossum@oracle.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).