lkml.org 
[lkml]   [2021]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] selftests/kselftest/runner.sh: Add optional command parameters in settings
Date
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"
---
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"
+ cmd="./$BASENAME_TEST $kselftest_cmd_args $kselftest_args"
if [ ! -x "$TEST" ]; then
echo "# Warning: file $TEST is not executable"

--
2.17.1
\
 
 \ /
  Last update: 2021-12-02 15:22    [W:1.435 / U:25.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site