lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 12 Aug 2011 15:32:07 +0200
From:	Andrew Jones <drjones@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	drjones@...hat.com, rostedt@...dmis.org
Subject: [PATCH 05/10] ktest: refactor monitor/boot/test code

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@...hat.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ