From: Kees Cook <keescook@chromium.org>
To: Cristian Marussi <cristian.marussi@arm.com>
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
sjpark@amazon.de, shuah@kernel.org
Subject: Re: [PATCH] selftests/kselftest/runner.sh: Add optional command parameters in settings
Date: Thu, 2 Dec 2021 13:18:35 -0800 [thread overview]
Message-ID: <202112021310.E1B3208@keescook> (raw)
In-Reply-To: <20211202142056.17386-1-cristian.marussi@arm.com>
On Thu, Dec 02, 2021 at 02:20:56PM +0000, Cristian Marussi wrote:
> Some testcases allow for optional commandline parameters but as of now
> there is now way to provide such arguments to the runner script.
>
> Add support to the per-test-directory "settings" file to provide such
> optional arguments; two new optional fields can now be defined in
> "settings":
>
> - args="<options>": general arguments common to all testcase commands in
> the test directory
>
> - <BASENAME_TEST>_args="<options>": custom arguments specific to only one
> specific testcase command
>
> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> ---
> Used to configure the use of a specific rtc device on CI systems with:
> tools/testing/selftests/rtc/settings:
> timeout=90
> rtctest_args="/dev/rtc1"
I like this idea generally, but I have some concern that this is
muddling the test's settings ("do not expect me to finish before
timeout=90") vs the local system's settings ("here is where to find the
rtc to test"). I can't, however, think of a better way to handle this
currently. :P
Is this case common enough that a given test shouldn't, instead, just
take config from environment variables set by the CI?
(Also, will we need to worry in the future about running the same test
multiple times with different system settings? ("try each of these /dev
nodes...")
Is there a patch for the changes to the RTC test?
> ---
> tools/testing/selftests/kselftest/runner.sh | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
> index a9ba782d8ca0..f877a8571927 100644
> --- a/tools/testing/selftests/kselftest/runner.sh
> +++ b/tools/testing/selftests/kselftest/runner.sh
> @@ -49,6 +49,15 @@ run_one()
>
> # Reset any "settings"-file variables.
> export kselftest_timeout="$kselftest_default_timeout"
> +
> + # Optional arguments for any command, possibly defined in settings
> + # as args="<options>"
> + kselftest_args=""
> +
> + # Optional arguments for this command, possibly defined in settings
> + # as <$BASENAME_TEST>_args="<options>"
> + kselftest_cmd_args_ref="kselftest_${BASENAME_TEST}_args"
> +
> # Load per-test-directory kselftest "settings" file.
> settings="$BASE_DIR/$DIR/settings"
> if [ -r "$settings" ] ; then
> @@ -69,7 +78,8 @@ run_one()
> echo "# Warning: file $TEST is missing!"
> echo "not ok $test_num $TEST_HDR_MSG"
> else
> - cmd="./$BASENAME_TEST"
> + eval kselftest_cmd_args="\$$kselftest_cmd_args_ref"
nitpit: Just to avoid tripping any future work to gracefully handle
unset variables, maybe this could specify an empty-string default:
eval kselftest_cmd_args="\${$kselftest_cmd_args_ref:-}"
> + cmd="./$BASENAME_TEST $kselftest_cmd_args $kselftest_args"
> if [ ! -x "$TEST" ]; then
> echo "# Warning: file $TEST is not executable"
>
> --
> 2.17.1
>
--
Kees Cook
next prev parent reply other threads:[~2021-12-02 21:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-02 14:20 Cristian Marussi
2021-12-02 21:18 ` Kees Cook [this message]
2021-12-03 19:12 ` Cristian Marussi
2021-12-13 5:20 ` [selftests/kselftest/runner.sh] 3226b4a464: kernel-selftests.cpu-hotplug.cpu-on-off-test.sh.fail kernel test robot
2021-12-15 9:59 ` Cristian Marussi
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=202112021310.E1B3208@keescook \
--to=keescook@chromium.org \
--cc=cristian.marussi@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=sjpark@amazon.de \
/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
all inboxes | Powered by JetHome®