lkml.org 
[lkml]   [2011]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 05/10] ktest: refactor monitor/boot/test code
Date
The monitor/boot code was already refactored, but we need to pull the
test part of the monitor/boot/test code sequences in as well to prepare for
the next patch.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
tools/testing/ktest/ktest.pl | 60 +++++++++++++++++------------------------
1 files changed, 25 insertions(+), 35 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index d954564..a42f8bf 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1490,6 +1490,24 @@ sub do_run_test {
return 1;
}

+sub do_test {
+ my ($type) = @_;
+ my $failed = 0;
+
+ start_monitor_and_boot or $failed = 1;
+
+ if ($failed && $in_bisect && $type ne "boot") {
+ end_monitor;
+ return -1;
+ }
+
+ if (!$failed && $type ne "boot" && defined($run_test)) {
+ do_run_test or $failed = 1;
+ }
+ end_monitor;
+ return !$failed;
+}
+
sub run_git_bisect {
my ($command) = @_;

@@ -1531,8 +1549,6 @@ sub run_bisect_test {

my $failed = 0;
my $result;
- my $output;
- my $ret;

$in_bisect = 1;

@@ -1545,27 +1561,17 @@ sub run_bisect_test {
}
dodie "Failed on build" if $failed;

- # Now boot the box
- start_monitor_and_boot or $failed = 1;
+ # Now boot the box and test
+ $result = do_test($type);

- if ($type ne "boot") {
- if ($failed && $bisect_skip) {
- end_monitor;
+ if ($result == -1) {
+ if ($bisect_skip) {
bisect_reboot;
$in_bisect = 0;
return -1;
}
- dodie "Failed on boot" if $failed;
-
- do_run_test or $failed = 1;
+ dodie "Failed on boot";
}
- end_monitor;
- }
-
- if ($failed) {
- $result = 0;
- } else {
- $result = 1;
}

# reboot the box to a kernel we can ssh to
@@ -2174,18 +2180,9 @@ sub patchcheck {

next if ($type eq "build");

- my $failed = 0;
-
- start_monitor_and_boot or $failed = 1;
-
- if (!$failed && $type ne "boot"){
- do_run_test or $failed = 1;
- }
- end_monitor;
- return 0 if ($failed);
+ do_test($type) or return 0;

patchcheck_reboot;
-
}
$in_patchcheck = 0;
success $i;
@@ -2946,14 +2943,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
}

if ($test_type ne "build") {
- my $failed = 0;
- start_monitor_and_boot or $failed = 1;
-
- if (!$failed && $test_type ne "boot" && defined($run_test)) {
- do_run_test or $failed = 1;
- }
- end_monitor;
- next if ($failed);
+ do_test($test_type) or next;
}

success $i;
--
1.7.4.1


\
 
 \ /
  Last update: 2011-08-12 15:37    [W:0.151 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site