From nobody Mon Oct 6 17:02:10 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE49D21A92F for ; Fri, 18 Jul 2025 20:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752870029; cv=none; b=R74eBz+QfHcjcatiNN9MpvuHhLkvL5wMpZoVA2hKzZlUmO6Pby86kz23WatIPBqcxEUNg6IHq59x//XGsFjUrTBaO+SAmmf3cwf2r7s1/FHLHIxYGTTUZZflpJ0J3cU2zeekryCnPrWc5wrk+ayD9t/fxdBespcOv23PAeNYcwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752870029; c=relaxed/simple; bh=rRg0o+hItQud96owWCmMg3FvtAzGw1eqcD4S/uWJRss=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=a1eLLWxHP/eZ6NGgACj/EKC7bIHHg8pAuyZUw98gQNjTiTYMHVlP6W7qYKz7GhSs87Js0ZA9e/rsVJZXeiqdqxJoainxams5e94BylrjfcjYdN7xs0NnOVXb6v1GknZ1vWP+w9VHcYyA11hCbNEbF8Bhd4Xk1AJNpau9ADM5cuY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lw9fJl3N; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lw9fJl3N" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35999C4CEF6; Fri, 18 Jul 2025 20:20:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752870029; bh=rRg0o+hItQud96owWCmMg3FvtAzGw1eqcD4S/uWJRss=; h=Date:From:To:Cc:Subject:References:From; b=lw9fJl3Nu/ci5avNIubJzOTo0Plk3taRi+X7Go0041EdppoORSIthviROERD7Dvu6 lv0uYYJNJr8BLStDf8e6EMDB6iok2N2iEVFj1wTge+rLKUXZmXyNxmrxBSaSZHZRzD St7po6YrlwCFgUAmhYE9L5vrkkvFW77r09Jly33EXTT3KQ1zisOUkIAJldeTd/kLq/ YVEdwAvAF7q7PmPAt4yM0P8fzLJ30sMKhIR7MI/MLEy6ew94DwpDgjJH9hiUl1NqI8 n04bKxIRy28umCSp9ORaTJCXBBCE0tj2ubOvmjNZCQGEcwZr7mk+MAfZ8KcHUNT5fm HNn6yWnD5ZujA== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1ucrZd-00000007Qd6-2I7F; Fri, 18 Jul 2025 16:20:53 -0400 Message-ID: <20250718202053.399653933@kernel.org> User-Agent: quilt/0.68 Date: Fri, 18 Jul 2025 16:18:42 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: "John Warthog9 Hawley" , Dhaval Giani , Greg KH Subject: [PATCH 2/5] ktest.pl: Allow command option -D to override temp variables References: <20250718201840.714067501@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Steven Rostedt Currently -D only updates the persistent options that are defined with "=3D". Allow it to also override all temp variables that are defined with ":=3D". ktest.pl -D 'USE_TEMP_DIR:=3D1' -D 'TEST_TYPE[2]=3Dbuild' config Signed-off-by: Steven Rostedt --- tools/testing/ktest/ktest.pl | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 8fcc09893986..c441934f1def 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -22,6 +22,7 @@ my %repeat_tests; my %repeats; my %evals; my @command_vars; +my %command_tmp_vars; =20 #default opts my %default =3D ( @@ -901,14 +902,22 @@ sub set_eval { } =20 sub set_variable { - my ($lvalue, $rvalue) =3D @_; + my ($lvalue, $rvalue, $command) =3D @_; =20 + # Command line variables override all others + if (defined($command_tmp_vars{$lvalue})) { + return; + } if ($rvalue =3D~ /^\s*$/) { delete $variable{$lvalue}; } else { $rvalue =3D process_variables($rvalue); $variable{$lvalue} =3D $rvalue; } + + if (defined($command)) { + $command_tmp_vars{$lvalue} =3D 1; + } } =20 sub process_compare { @@ -4267,6 +4276,11 @@ ktest.pl version: $VERSION -D TEST_TYPE[2]=3Dbuild Sets TEST_TYPE of test 2 to "build" =20 + It can also override all temp variables. + -D USE_TEMP_DIR:=3D1 + Will override all variables that use + "USE_TEMP_DIR=3D" + EOF ; } @@ -4277,7 +4291,11 @@ while ( $#ARGV >=3D 0 ) { die_usage if ($#ARGV < 1); my $val =3D shift; =20 - $command_vars[$#command_vars + 1] =3D $val; + if ($val =3D~ m/(.*?):=3D(.*)$/) { + set_variable($1, $2, 1); + } else { + $command_vars[$#command_vars + 1] =3D $val; + } =20 } elsif ( $ARGV[0] eq "-h" ) { die_usage; --=20 2.47.2