libguestfs/0002-v2v-test-harness-Fix-boot-loop-so-it-detects-disk-in.patch
Richard W.M. Jones 64c7795711 Add virt-v2v-test-harness subpackage.
- Add a couple of upstream patches to fix the virt-v2v test harness.
2015-03-12 13:59:01 +00:00

76 lines
3.1 KiB
Diff

From 0827b006e4943a670dbe193dd8b522d7cc3b4bf5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 11 Mar 2015 15:05:13 +0000
Subject: [PATCH 2/2] v2v: test-harness: Fix boot loop so it detects disk
inactivity properly.
---
v2v/test-harness/v2v_test_harness.ml | 50 +++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 23 deletions(-)
diff --git a/v2v/test-harness/v2v_test_harness.ml b/v2v/test-harness/v2v_test_harness.ml
index 998903a..fe09d6f 100644
--- a/v2v/test-harness/v2v_test_harness.ml
+++ b/v2v/test-harness/v2v_test_harness.ml
@@ -280,30 +280,34 @@ let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () =
if active then (
printf "%s: disk activity detected\n" (timestamp t);
loop start t stats
- ) else if t -. last_activity <= float test_plan.boot_idle_time then (
- let screenshot = take_screenshot t in
- (* Reached the final screenshot? *)
- let done_ =
- match test_plan.boot_plan with
- | Boot_to_screenshot final_screenshot ->
- if display_matches_screenshot screenshot final_screenshot then (
- printf "%s: guest reached final screenshot\n" (timestamp t);
- true
- ) else false
- | _ -> false in
- if not done_ then (
- (* A screenshot matching one of the screenshots in the set
- * resets the timeout.
- *)
- let waiting_in_known_good_state =
- List.exists (display_matches_screenshot screenshot)
- test_plan.boot_known_good_screenshots in
- if waiting_in_known_good_state then (
- printf "%s: guest at known-good screenshot\n" (timestamp t);
- loop t last_activity stats
- ) else
- loop start last_activity stats
+ ) else (
+ if t -. last_activity <= float test_plan.boot_idle_time then (
+ let screenshot = take_screenshot t in
+ (* Reached the final screenshot? *)
+ let done_ =
+ match test_plan.boot_plan with
+ | Boot_to_screenshot final_screenshot ->
+ if display_matches_screenshot screenshot final_screenshot then (
+ printf "%s: guest reached final screenshot\n" (timestamp t);
+ true
+ ) else false
+ | _ -> false in
+ if not done_ then (
+ (* A screenshot matching one of the screenshots in the set
+ * resets the timeouts.
+ *)
+ let waiting_in_known_good_state =
+ List.exists (display_matches_screenshot screenshot)
+ test_plan.boot_known_good_screenshots in
+ if waiting_in_known_good_state then (
+ printf "%s: guest at known-good screenshot\n" (timestamp t);
+ loop t t stats
+ ) else
+ loop start last_activity stats
+ )
)
+ else
+ bootfail t "guest timed out with no disk activity before reaching final state"
)
in
loop start last_activity stats;
--
2.3.1