Skip to content

Commit f9dfb65

Browse files
vitkyrkarostedt
authored andcommitted
ktest: Check parent options for iterated tests
Let's say we have "OUTPUT_DIR = build/${TEST_NAME}", and we're iterating a test. In the second iteration of a test, the TEST_NAME of the test we're repeating is not used. Instead, ${TEST_NAME} appears literally: touch /home/rabin/kernel/test/build/${TEST_NAME}/.config ... SUCCESS Fix this by making __eval_option() check the parent test options for a repeated test. Link: http://lkml.kernel.org/r/1321616131-21352-2-git-send-email-rabin@rab.in Signed-off-by: Rabin Vincent <rabin@rab.in> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent cfcfc9e commit f9dfb65

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎tools/testing/ktest/ktest.pl‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,18 @@ sub __eval_option {
747747
# Add space to evaluate the character before $
748748
$option = " $option";
749749
my $retval = "";
750+
my $repeated = 0;
751+
my $parent = 0;
752+
753+
foreach my $test (keys %repeat_tests) {
754+
if ($i >= $test &&
755+
$i < $test + $repeat_tests{$test}) {
756+
757+
$repeated = 1;
758+
$parent = $test;
759+
last;
760+
}
761+
}
750762

751763
while ($option =~ /(.*?[^\\])\$\{(.*?)\}(.*)/) {
752764
my $start = $1;
@@ -760,10 +772,14 @@ sub __eval_option {
760772
# otherwise see if the default OPT (without [$i]) exists.
761773

762774
my $o = "$var\[$i\]";
775+
my $parento = "$var\[$parent\]";
763776

764777
if (defined($opt{$o})) {
765778
$o = $opt{$o};
766779
$retval = "$retval$o";
780+
} elsif ($repeated && defined($opt{$parento})) {
781+
$o = $opt{$parento};
782+
$retval = "$retval$o";
767783
} elsif (defined($opt{$var})) {
768784
$o = $opt{$var};
769785
$retval = "$retval$o";

0 commit comments

Comments
 (0)