Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48F11C433EF for ; Thu, 2 Dec 2021 14:21:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347179AbhLBOYt (ORCPT ); Thu, 2 Dec 2021 09:24:49 -0500 Received: from foss.arm.com ([217.140.110.172]:35902 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240661AbhLBOYs (ORCPT ); Thu, 2 Dec 2021 09:24:48 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4841213D5; Thu, 2 Dec 2021 06:21:25 -0800 (PST) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 56EC93F766; Thu, 2 Dec 2021 06:21:24 -0800 (PST) From: Cristian Marussi To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: sjpark@amazon.de, keescook@chromium.org, shuah@kernel.org, Cristian Marussi Subject: [PATCH] selftests/kselftest/runner.sh: Add optional command parameters in settings Date: Thu, 2 Dec 2021 14:20:56 +0000 Message-Id: <20211202142056.17386-1-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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="": general arguments common to all testcase commands in the test directory - _args="": custom arguments specific to only one specific testcase command Signed-off-by: Cristian Marussi --- 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="" + kselftest_args="" + + # Optional arguments for this command, possibly defined in settings + # as <$BASENAME_TEST>_args="" + 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