aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-06-14 20:49:13 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-06-14 20:49:13 -0400
commitddf607e5f853ae172e81e6051e1e12e24ea8a3c6 (patch)
tree15936c96b598c0c4ed5d8411489adcb7bfc95aa0 /tools
parent1990207d538885e678f374e3e79f454c2e6c7383 (diff)
ktest: Add helper function to avoid duplicate code
Several places had the following code: get_grub_index; get_version; install; start_monitor; return monitor; Creating a function "start_monitor_and_boot()" replaces these mulitple uses with a single call. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/ktest/ktest.pl46
1 files changed, 20 insertions, 26 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 5924f14ba418..099ceeed4144 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1096,6 +1096,23 @@ sub install {
1096 do_post_install; 1096 do_post_install;
1097} 1097}
1098 1098
1099sub get_version {
1100 # get the release name
1101 doprint "$make kernelrelease ... ";
1102 $version = `$make kernelrelease | tail -1`;
1103 chomp($version);
1104 doprint "$version\n";
1105}
1106
1107sub start_monitor_and_boot {
1108 get_grub_index;
1109 get_version;
1110 install;
1111
1112 start_monitor;
1113 return monitor;
1114}
1115
1099sub check_buildlog { 1116sub check_buildlog {
1100 my ($patch) = @_; 1117 my ($patch) = @_;
1101 1118
@@ -1307,14 +1324,6 @@ sub success {
1307 } 1324 }
1308} 1325}
1309 1326
1310sub get_version {
1311 # get the release name
1312 doprint "$make kernelrelease ... ";
1313 $version = `$make kernelrelease | tail -1`;
1314 chomp($version);
1315 doprint "$version\n";
1316}
1317
1318sub answer_bisect { 1327sub answer_bisect {
1319 for (;;) { 1328 for (;;) {
1320 doprint "Pass or fail? [p/f]"; 1329 doprint "Pass or fail? [p/f]";
@@ -1479,12 +1488,7 @@ sub run_bisect_test {
1479 dodie "Failed on build" if $failed; 1488 dodie "Failed on build" if $failed;
1480 1489
1481 # Now boot the box 1490 # Now boot the box
1482 get_grub_index; 1491 start_monitor_and_boot or $failed = 1;
1483 get_version;
1484 install;
1485
1486 start_monitor;
1487 monitor or $failed = 1;
1488 1492
1489 if ($type ne "boot") { 1493 if ($type ne "boot") {
1490 if ($failed && $bisect_skip) { 1494 if ($failed && $bisect_skip) {
@@ -2115,14 +2119,9 @@ sub patchcheck {
2115 2119
2116 next if ($type eq "build"); 2120 next if ($type eq "build");
2117 2121
2118 get_grub_index;
2119 get_version;
2120 install;
2121
2122 my $failed = 0; 2122 my $failed = 0;
2123 2123
2124 start_monitor; 2124 start_monitor_and_boot or $failed = 1;
2125 monitor or $failed = 1;
2126 2125
2127 if (!$failed && $type ne "boot"){ 2126 if (!$failed && $type ne "boot"){
2128 do_run_test or $failed = 1; 2127 do_run_test or $failed = 1;
@@ -2393,13 +2392,8 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
2393 } 2392 }
2394 2393
2395 if ($test_type ne "build") { 2394 if ($test_type ne "build") {
2396 get_grub_index;
2397 get_version;
2398 install;
2399
2400 my $failed = 0; 2395 my $failed = 0;
2401 start_monitor; 2396 start_monitor_and_boot or $failed = 1;
2402 monitor or $failed = 1;;
2403 2397
2404 if (!$failed && $test_type ne "boot" && defined($run_test)) { 2398 if (!$failed && $test_type ne "boot" && defined($run_test)) {
2405 do_run_test or $failed = 1; 2399 do_run_test or $failed = 1;