Skip to content

Commit 65b6424

Browse files
committed
Merge tag 'ktest-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest
Pull ktest updates from Steven Rostedt: - 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. * tag 'ktest-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest: ktest: force $buildonly = 1 for 'make_warnings_file' test type ktest.pl: Process variables within variables
2 parents ad584d7 + 07283c1 commit 65b6424

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tools/testing/ktest/ktest.pl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -792,13 +792,13 @@ sub process_variables {
792792
my $retval = "";
793793

794794
# We want to check for '\', and it is just easier
795-
# to check the previous characet of '$' and not need
795+
# to check the previous character of '$' and not need
796796
# to worry if '$' is the first character. By adding
797797
# a space to $value, we can just check [^\\]\$ and
798798
# it will still work.
799799
$value = " $value";
800800

801-
while ($value =~ /(.*?[^\\])\$\{(.*?)\}(.*)/) {
801+
while ($value =~ /(.*?[^\\])\$\{([^\{]*?)\}(.*)/) {
802802
my $begin = $1;
803803
my $var = $2;
804804
my $end = $3;
@@ -818,16 +818,20 @@ sub process_variables {
818818
# we simple convert to 0
819819
$retval = "${retval}0";
820820
} else {
821-
# put back the origin piece.
822-
$retval = "$retval\$\{$var\}";
821+
# put back the origin piece, but with $#### to not reprocess it
822+
$retval = "$retval\$####\{$var\}";
823823
# This could be an option that is used later, save
824824
# it so we don't warn if this option is not one of
825825
# ktests options.
826826
$used_options{$var} = 1;
827827
}
828-
$value = $end;
828+
$value = "$retval$end";
829+
$retval = "";
829830
}
830-
$retval = "$retval$value";
831+
$retval = $value;
832+
833+
# Convert the saved variables with $####{var} back to ${var}
834+
$retval =~ s/\$####/\$/g;
831835

832836
# remove the space added in the beginning
833837
$retval =~ s/ //;
@@ -843,6 +847,7 @@ sub set_value {
843847
if ($lvalue =~ /^(TEST|BISECT|CONFIG_BISECT)_TYPE(\[.*\])?$/ &&
844848
$prvalue !~ /^(config_|)bisect$/ &&
845849
$prvalue !~ /^build$/ &&
850+
$prvalue !~ /^make_warnings_file$/ &&
846851
$buildonly) {
847852

848853
# Note if a test is something other than build, then we

0 commit comments

Comments
 (0)