diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-12-22 21:33:55 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-12-22 22:00:52 -0500 |
commit | b5f4aea687797bf9ab24f59643f88f82443b01fa (patch) | |
tree | 2f131628e273d7be4ac84a6e788db8667ac20119 /tools/testing/ktest/ktest.pl | |
parent | 4f43e0dcafe89205d3c266fed196fd417a9fe3de (diff) |
ktest: Have all values be set by defaults
Currently the patchcheck, bisect, and config_bisect variables
are only able to be set per test. You can not set a default
value for them.
By letting default values be set, it makes some config files
a bit easier, and also makes it easier to find typos in the
option names.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing/ktest/ktest.pl')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 86 |
1 files changed, 59 insertions, 27 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 85c5d943c6db..5ba9ad4248d7 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -103,7 +103,7 @@ my $output_minconfig; | |||
103 | my $ignore_config; | 103 | my $ignore_config; |
104 | my $addconfig; | 104 | my $addconfig; |
105 | my $in_bisect = 0; | 105 | my $in_bisect = 0; |
106 | my $bisect_bad = ""; | 106 | my $bisect_bad_commit = ""; |
107 | my $reverse_bisect; | 107 | my $reverse_bisect; |
108 | my $bisect_manual; | 108 | my $bisect_manual; |
109 | my $bisect_skip; | 109 | my $bisect_skip; |
@@ -140,10 +140,27 @@ my $stop_after_failure; | |||
140 | my $stop_test_after; | 140 | my $stop_test_after; |
141 | my $build_target; | 141 | my $build_target; |
142 | my $target_image; | 142 | my $target_image; |
143 | my $checkout; | ||
143 | my $localversion; | 144 | my $localversion; |
144 | my $iteration = 0; | 145 | my $iteration = 0; |
145 | my $successes = 0; | 146 | my $successes = 0; |
146 | 147 | ||
148 | my $bisect_good; | ||
149 | my $bisect_bad; | ||
150 | my $bisect_type; | ||
151 | my $bisect_start; | ||
152 | my $bisect_replay; | ||
153 | my $bisect_files; | ||
154 | my $bisect_reverse; | ||
155 | my $bisect_check; | ||
156 | |||
157 | my $config_bisect; | ||
158 | my $config_bisect_type; | ||
159 | |||
160 | my $patchcheck_type; | ||
161 | my $patchcheck_start; | ||
162 | my $patchcheck_end; | ||
163 | |||
147 | # set when a test is something other that just building or install | 164 | # set when a test is something other that just building or install |
148 | # which would require more options. | 165 | # which would require more options. |
149 | my $buildonly = 1; | 166 | my $buildonly = 1; |
@@ -1940,7 +1957,7 @@ sub run_git_bisect { | |||
1940 | if ($output =~ m/^(Bisecting: .*\(roughly \d+ steps?\))\s+\[([[:xdigit:]]+)\]/) { | 1957 | if ($output =~ m/^(Bisecting: .*\(roughly \d+ steps?\))\s+\[([[:xdigit:]]+)\]/) { |
1941 | doprint "$1 [$2]\n"; | 1958 | doprint "$1 [$2]\n"; |
1942 | } elsif ($output =~ m/^([[:xdigit:]]+) is the first bad commit/) { | 1959 | } elsif ($output =~ m/^([[:xdigit:]]+) is the first bad commit/) { |
1943 | $bisect_bad = $1; | 1960 | $bisect_bad_commit = $1; |
1944 | doprint "Found bad commit... $1\n"; | 1961 | doprint "Found bad commit... $1\n"; |
1945 | return 0; | 1962 | return 0; |
1946 | } else { | 1963 | } else { |
@@ -2050,16 +2067,16 @@ sub bisect { | |||
2050 | 2067 | ||
2051 | my $result; | 2068 | my $result; |
2052 | 2069 | ||
2053 | die "BISECT_GOOD[$i] not defined\n" if (!defined($opt{"BISECT_GOOD[$i]"})); | 2070 | die "BISECT_GOOD[$i] not defined\n" if (!defined($bisect_good)); |
2054 | die "BISECT_BAD[$i] not defined\n" if (!defined($opt{"BISECT_BAD[$i]"})); | 2071 | die "BISECT_BAD[$i] not defined\n" if (!defined($bisect_bad)); |
2055 | die "BISECT_TYPE[$i] not defined\n" if (!defined($opt{"BISECT_TYPE[$i]"})); | 2072 | die "BISECT_TYPE[$i] not defined\n" if (!defined($bisect_type)); |
2056 | 2073 | ||
2057 | my $good = $opt{"BISECT_GOOD[$i]"}; | 2074 | my $good = $bisect_good; |
2058 | my $bad = $opt{"BISECT_BAD[$i]"}; | 2075 | my $bad = $bisect_bad; |
2059 | my $type = $opt{"BISECT_TYPE[$i]"}; | 2076 | my $type = $bisect_type; |
2060 | my $start = $opt{"BISECT_START[$i]"}; | 2077 | my $start = $bisect_start; |
2061 | my $replay = $opt{"BISECT_REPLAY[$i]"}; | 2078 | my $replay = $bisect_replay; |
2062 | my $start_files = $opt{"BISECT_FILES[$i]"}; | 2079 | my $start_files = $bisect_files; |
2063 | 2080 | ||
2064 | if (defined($start_files)) { | 2081 | if (defined($start_files)) { |
2065 | $start_files = " -- " . $start_files; | 2082 | $start_files = " -- " . $start_files; |
@@ -2071,8 +2088,7 @@ sub bisect { | |||
2071 | $good = get_sha1($good); | 2088 | $good = get_sha1($good); |
2072 | $bad = get_sha1($bad); | 2089 | $bad = get_sha1($bad); |
2073 | 2090 | ||
2074 | if (defined($opt{"BISECT_REVERSE[$i]"}) && | 2091 | if (defined($bisect_reverse) && $bisect_reverse == 1) { |
2075 | $opt{"BISECT_REVERSE[$i]"} == 1) { | ||
2076 | doprint "Performing a reverse bisect (bad is good, good is bad!)\n"; | 2092 | doprint "Performing a reverse bisect (bad is good, good is bad!)\n"; |
2077 | $reverse_bisect = 1; | 2093 | $reverse_bisect = 1; |
2078 | } else { | 2094 | } else { |
@@ -2087,7 +2103,7 @@ sub bisect { | |||
2087 | # Check if a bisect was running | 2103 | # Check if a bisect was running |
2088 | my $bisect_start_file = "$builddir/.git/BISECT_START"; | 2104 | my $bisect_start_file = "$builddir/.git/BISECT_START"; |
2089 | 2105 | ||
2090 | my $check = $opt{"BISECT_CHECK[$i]"}; | 2106 | my $check = $bisect_check; |
2091 | my $do_check = defined($check) && $check ne "0"; | 2107 | my $do_check = defined($check) && $check ne "0"; |
2092 | 2108 | ||
2093 | if ( -f $bisect_start_file ) { | 2109 | if ( -f $bisect_start_file ) { |
@@ -2173,7 +2189,7 @@ sub bisect { | |||
2173 | run_command "git bisect reset" or | 2189 | run_command "git bisect reset" or |
2174 | dodie "could not reset git bisect"; | 2190 | dodie "could not reset git bisect"; |
2175 | 2191 | ||
2176 | doprint "Bad commit was [$bisect_bad]\n"; | 2192 | doprint "Bad commit was [$bisect_bad_commit]\n"; |
2177 | 2193 | ||
2178 | success $i; | 2194 | success $i; |
2179 | } | 2195 | } |
@@ -2329,7 +2345,7 @@ sub run_config_bisect { | |||
2329 | } | 2345 | } |
2330 | 2346 | ||
2331 | doprint "***** RUN TEST ***\n"; | 2347 | doprint "***** RUN TEST ***\n"; |
2332 | my $type = $opt{"CONFIG_BISECT_TYPE[$iteration]"}; | 2348 | my $type = $config_bisect_type; |
2333 | my $ret; | 2349 | my $ret; |
2334 | my %current_config; | 2350 | my %current_config; |
2335 | 2351 | ||
@@ -2433,7 +2449,7 @@ sub run_config_bisect { | |||
2433 | sub config_bisect { | 2449 | sub config_bisect { |
2434 | my ($i) = @_; | 2450 | my ($i) = @_; |
2435 | 2451 | ||
2436 | my $start_config = $opt{"CONFIG_BISECT[$i]"}; | 2452 | my $start_config = $config_bisect; |
2437 | 2453 | ||
2438 | my $tmpconfig = "$tmpdir/use_config"; | 2454 | my $tmpconfig = "$tmpdir/use_config"; |
2439 | 2455 | ||
@@ -2553,22 +2569,22 @@ sub patchcheck { | |||
2553 | my ($i) = @_; | 2569 | my ($i) = @_; |
2554 | 2570 | ||
2555 | die "PATCHCHECK_START[$i] not defined\n" | 2571 | die "PATCHCHECK_START[$i] not defined\n" |
2556 | if (!defined($opt{"PATCHCHECK_START[$i]"})); | 2572 | if (!defined($patchcheck_start)); |
2557 | die "PATCHCHECK_TYPE[$i] not defined\n" | 2573 | die "PATCHCHECK_TYPE[$i] not defined\n" |
2558 | if (!defined($opt{"PATCHCHECK_TYPE[$i]"})); | 2574 | if (!defined($patchcheck_type)); |
2559 | 2575 | ||
2560 | my $start = $opt{"PATCHCHECK_START[$i]"}; | 2576 | my $start = $patchcheck_start; |
2561 | 2577 | ||
2562 | my $end = "HEAD"; | 2578 | my $end = "HEAD"; |
2563 | if (defined($opt{"PATCHCHECK_END[$i]"})) { | 2579 | if (defined($patchcheck_end)) { |
2564 | $end = $opt{"PATCHCHECK_END[$i]"}; | 2580 | $end = $patchcheck_end; |
2565 | } | 2581 | } |
2566 | 2582 | ||
2567 | # Get the true sha1's since we can use things like HEAD~3 | 2583 | # Get the true sha1's since we can use things like HEAD~3 |
2568 | $start = get_sha1($start); | 2584 | $start = get_sha1($start); |
2569 | $end = get_sha1($end); | 2585 | $end = get_sha1($end); |
2570 | 2586 | ||
2571 | my $type = $opt{"PATCHCHECK_TYPE[$i]"}; | 2587 | my $type = $patchcheck_type; |
2572 | 2588 | ||
2573 | # Can't have a test without having a test to run | 2589 | # Can't have a test without having a test to run |
2574 | if ($type eq "test" && !defined($run_test)) { | 2590 | if ($type eq "test" && !defined($run_test)) { |
@@ -3366,9 +3382,26 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
3366 | $build_target = set_test_option("BUILD_TARGET", $i); | 3382 | $build_target = set_test_option("BUILD_TARGET", $i); |
3367 | $ssh_exec = set_test_option("SSH_EXEC", $i); | 3383 | $ssh_exec = set_test_option("SSH_EXEC", $i); |
3368 | $scp_to_target = set_test_option("SCP_TO_TARGET", $i); | 3384 | $scp_to_target = set_test_option("SCP_TO_TARGET", $i); |
3385 | $checkout = set_test_option("CHECKOUT", $i); | ||
3369 | $target_image = set_test_option("TARGET_IMAGE", $i); | 3386 | $target_image = set_test_option("TARGET_IMAGE", $i); |
3370 | $localversion = set_test_option("LOCALVERSION", $i); | 3387 | $localversion = set_test_option("LOCALVERSION", $i); |
3371 | 3388 | ||
3389 | $bisect_good = set_test_option("BISECT_GOOD", $i); | ||
3390 | $bisect_bad = set_test_option("BISECT_BAD", $i); | ||
3391 | $bisect_type = set_test_option("BISECT_TYPE", $i); | ||
3392 | $bisect_start = set_test_option("BISECT_START", $i); | ||
3393 | $bisect_replay = set_test_option("BISECT_REPLAY", $i); | ||
3394 | $bisect_files = set_test_option("BISECT_FILES", $i); | ||
3395 | $bisect_reverse = set_test_option("BISECT_REVERSE", $i); | ||
3396 | $bisect_check = set_test_option("BISECT_CHECK", $i); | ||
3397 | |||
3398 | $config_bisect = set_test_option("CONFIG_BISECT", $i); | ||
3399 | $config_bisect_type = set_test_option("CONFIG_BISECT_TYPE", $i); | ||
3400 | |||
3401 | $patchcheck_type = set_test_option("PATCHCHECK_TYPE", $i); | ||
3402 | $patchcheck_start = set_test_option("PATCHCHECK_START", $i); | ||
3403 | $patchcheck_end = set_test_option("PATCHCHECK_END", $i); | ||
3404 | |||
3372 | $start_minconfig_defined = 1; | 3405 | $start_minconfig_defined = 1; |
3373 | 3406 | ||
3374 | if (!defined($start_minconfig)) { | 3407 | if (!defined($start_minconfig)) { |
@@ -3405,11 +3438,11 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
3405 | 3438 | ||
3406 | my $run_type = $build_type; | 3439 | my $run_type = $build_type; |
3407 | if ($test_type eq "patchcheck") { | 3440 | if ($test_type eq "patchcheck") { |
3408 | $run_type = $opt{"PATCHCHECK_TYPE[$i]"}; | 3441 | $run_type = $patchcheck_type; |
3409 | } elsif ($test_type eq "bisect") { | 3442 | } elsif ($test_type eq "bisect") { |
3410 | $run_type = $opt{"BISECT_TYPE[$i]"}; | 3443 | $run_type = $bisect_type; |
3411 | } elsif ($test_type eq "config_bisect") { | 3444 | } elsif ($test_type eq "config_bisect") { |
3412 | $run_type = $opt{"CONFIG_BISECT_TYPE[$i]"}; | 3445 | $run_type = $config_bisect_type; |
3413 | } | 3446 | } |
3414 | 3447 | ||
3415 | if ($test_type eq "make_min_config") { | 3448 | if ($test_type eq "make_min_config") { |
@@ -3441,7 +3474,6 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
3441 | $minconfig = "$tmpdir/add_config"; | 3474 | $minconfig = "$tmpdir/add_config"; |
3442 | } | 3475 | } |
3443 | 3476 | ||
3444 | my $checkout = $opt{"CHECKOUT[$i]"}; | ||
3445 | if (defined($checkout)) { | 3477 | if (defined($checkout)) { |
3446 | run_command "git checkout $checkout" or | 3478 | run_command "git checkout $checkout" or |
3447 | die "failed to checkout $checkout"; | 3479 | die "failed to checkout $checkout"; |