diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 89c2257bed98..ea43dd2f2fd5 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -684,11 +684,8 @@ sub set_value { } ${$overrides}{$lvalue} = $prvalue; } - if ($rvalue =~ /^\s*$/) { - delete $opt{$lvalue}; - } else { - $opt{$lvalue} = $prvalue; - } + + $opt{$lvalue} = $prvalue; } sub set_eval { @@ -3947,12 +3944,22 @@ for (my $i = 0, my $repeat = 1; $i <= $opt{"NUM_TESTS"}; $i += $repeat) { } } +sub option_defined { + my ($option) = @_; + + if (defined($opt{$option}) && $opt{$option} !~ /^\s*$/) { + return 1; + } + + return 0; +} + sub __set_test_option { my ($name, $i) = @_; my $option = "$name\[$i\]"; - if (defined($opt{$option})) { + if (option_defined($option)) { return $opt{$option}; } @@ -3960,13 +3967,13 @@ sub __set_test_option { if ($i >= $test && $i < $test + $repeat_tests{$test}) { $option = "$name\[$test\]"; - if (defined($opt{$option})) { + if (option_defined($option)) { return $opt{$option}; } } } - if (defined($opt{$name})) { + if (option_defined($name)) { return $opt{$name}; }