public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [for-next][PATCH 0/2] ktest: Updates for v6.9
@ 2024-03-15 16:46 Steven Rostedt
  2024-03-15 16:46 ` [for-next][PATCH 1/2] ktest.pl: Process variables within variables Steven Rostedt
  2024-03-15 16:46 ` [for-next][PATCH 2/2] ktest: force $buildonly = 1 for make_warnings_file test type Steven Rostedt
  0 siblings, 2 replies; 3+ messages in thread
From: Steven Rostedt @ 2024-03-15 16:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Warthog9 Hawley


ktest updates for v6.9:

- Allow variables to contain variables. This makes the shell commands
  have a bit more flexibility to reuse existing variables.

- Have make_warnings_file in build-only mode require limited variables

  The make_warnings_file test will create a file with all existing
  warnings (which can be used to compare against in builds with
  new commits). Add it to the build-only list that doesn't require
  other variables (like how to reset a machine), as the make_warnings_file
  makes the most sense on build only tests.

Ricardo B. Marliere (1):
      ktest: force $buildonly = 1 for 'make_warnings_file' test type

Steven Rostedt (1):
      ktest.pl: Process variables within variables

----
 tools/testing/ktest/ktest.pl | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [for-next][PATCH 1/2] ktest.pl: Process variables within variables
  2024-03-15 16:46 [for-next][PATCH 0/2] ktest: Updates for v6.9 Steven Rostedt
@ 2024-03-15 16:46 ` Steven Rostedt
  2024-03-15 16:46 ` [for-next][PATCH 2/2] ktest: force $buildonly = 1 for make_warnings_file test type Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2024-03-15 16:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Warthog9 Hawley

From: Steven Rostedt <rostedt@goodmis.org>

Allow a variable to contain another variable. This will allow the
${shell <command>} to have its command include variables.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 tools/testing/ktest/ktest.pl | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 829f5bdfd2e4..4383729e0fc2 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -792,13 +792,13 @@ sub process_variables {
     my $retval = "";
 
     # We want to check for '\', and it is just easier
-    # to check the previous characet of '$' and not need
+    # to check the previous character of '$' and not need
     # to worry if '$' is the first character. By adding
     # a space to $value, we can just check [^\\]\$ and
     # it will still work.
     $value = " $value";
 
-    while ($value =~ /(.*?[^\\])\$\{(.*?)\}(.*)/) {
+    while ($value =~ /(.*?[^\\])\$\{([^\{]*?)\}(.*)/) {
 	my $begin = $1;
 	my $var = $2;
 	my $end = $3;
@@ -818,16 +818,20 @@ sub process_variables {
 	    # we simple convert to 0
 	    $retval = "${retval}0";
 	} else {
-	    # put back the origin piece.
-	    $retval = "$retval\$\{$var\}";
+	    # put back the origin piece, but with $#### to not reprocess it
+	    $retval = "$retval\$####\{$var\}";
 	    # This could be an option that is used later, save
 	    # it so we don't warn if this option is not one of
 	    # ktests options.
 	    $used_options{$var} = 1;
 	}
-	$value = $end;
+	$value = "$retval$end";
+	$retval = "";
     }
-    $retval = "$retval$value";
+    $retval = $value;
+
+    # Convert the saved variables with $####{var} back to ${var}
+    $retval =~ s/\$####/\$/g;
 
     # remove the space added in the beginning
     $retval =~ s/ //;
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [for-next][PATCH 2/2] ktest: force $buildonly = 1 for make_warnings_file test type
  2024-03-15 16:46 [for-next][PATCH 0/2] ktest: Updates for v6.9 Steven Rostedt
  2024-03-15 16:46 ` [for-next][PATCH 1/2] ktest.pl: Process variables within variables Steven Rostedt
@ 2024-03-15 16:46 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2024-03-15 16:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Warthog9 Hawley, John Hawley, Ricardo B. Marliere

From: "Ricardo B. Marliere" <ricardo@marliere.net>

The test type "make_warnings_file" should have no mandatory configuration
parameters other than the ones required by the "build" test type, because
its purpose is to create a file with build warnings that may or may not be
used by other subsequent tests. Currently, the only way to use it as a
stand-alone test is by setting POWER_CYCLE, CONSOLE, SSH_USER,
BUILD_TARGET, TARGET_IMAGE, REBOOT_TYPE and GRUB_MENU.

Link: https://lkml.kernel.org/r/20240315-ktest-v2-1-c5c20a75f6a3@marliere.net

Cc: John Hawley <warthog9@eaglescrag.net>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 tools/testing/ktest/ktest.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 4383729e0fc2..eb31cd9c977b 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -847,6 +847,7 @@ sub set_value {
     if ($lvalue =~ /^(TEST|BISECT|CONFIG_BISECT)_TYPE(\[.*\])?$/ &&
 	$prvalue !~ /^(config_|)bisect$/ &&
 	$prvalue !~ /^build$/ &&
+	$prvalue !~ /^make_warnings_file$/ &&
 	$buildonly) {
 
 	# Note if a test is something other than build, then we
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-15 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-15 16:46 [for-next][PATCH 0/2] ktest: Updates for v6.9 Steven Rostedt
2024-03-15 16:46 ` [for-next][PATCH 1/2] ktest.pl: Process variables within variables Steven Rostedt
2024-03-15 16:46 ` [for-next][PATCH 2/2] ktest: force $buildonly = 1 for make_warnings_file test type Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox