Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Unified Diff: bin/cros_au_test_harness.py

Issue 4258002: Add ability to fall back to fulls for all updates. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: TODO Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/cros_au_test_harness.py
diff --git a/bin/cros_au_test_harness.py b/bin/cros_au_test_harness.py
index b9640b4c3fcc1be3365efdb5bd2b99b1b2967a63..7342310ce7f7b913a8e92d29c6e7f932db1847d7 100755
--- a/bin/cros_au_test_harness.py
+++ b/bin/cros_au_test_harness.py
@@ -63,6 +63,21 @@ class AUTest(object):
return int(percent_passed)
+ # TODO(sosa) - Remove try and convert function to DeltaUpdateImage().
+ def TryDeltaAndFallbackToFull(self, src_image, image, stateful_change='old'):
+ """Tries the delta update first if set and falls back to full update."""
+ if self.use_delta_updates:
+ try:
+ self.source_image = src_image
+ self.UpdateImage(image)
+ except:
+ Warning('Delta update failed, disabling delta updates and retrying.')
+ self.use_delta_updates = False
+ self.source_image = ''
+ self.UpdateImage(image)
+ else:
+ self.UpdateImage(image)
+
def PrepareBase(self):
"""Prepares target with base_image_path."""
pass
@@ -130,28 +145,14 @@ class AUTest(object):
# with the dev channel.
percent_passed = self.VerifyImage(10)
- if self.use_delta_updates: self.source_image = base_image_path
-
# Update to - all tests should pass on new image.
Info('Updating from base image on vm to target image.')
- try:
- self.UpdateImage(target_image_path)
- except:
- if self.use_delta_updates:
- Warning('Delta update failed, disabling delta updates and retrying.')
- self.use_delta_updates = False
- self.source_image = ''
- self.UpdateImage(target_image_path)
- else:
- raise
-
+ self.TryDeltaAndFallbackToFull(base_image_path, target_image_path)
self.VerifyImage(100)
- if self.use_delta_updates: self.source_image = target_image_path
-
# Update from - same percentage should pass that originally passed.
Info('Updating from updated image on vm back to base image.')
- self.UpdateImage(base_image_path)
+ self.TryDeltaAndFallbackToFull(target_image_path, base_image_path)
self.VerifyImage(percent_passed)
def testFullUpdateWipeStateful(self):
@@ -167,28 +168,14 @@ class AUTest(object):
# with the dev channel.
percent_passed = self.VerifyImage(10)
- if self.use_delta_updates: self.source_image = base_image_path
-
# Update to - all tests should pass on new image.
Info('Updating from base image on vm to target image and wiping stateful.')
- try:
- self.UpdateImage(target_image_path, 'clean')
- except:
- if self.use_delta_updates:
- Warning('Delta update failed, disabling delta updates and retrying.')
- self.use_delta_updates = False
- self.source_image = ''
- self.UpdateImage(target_image_path)
- else:
- raise
-
+ self.TryDeltaAndFallbackToFull(base_image_path, target_image_path, 'clean')
self.VerifyImage(100)
- if self.use_delta_updates: self.source_image = target_image_path
-
# Update from - same percentage should pass that originally passed.
Info('Updating from updated image back to base image and wiping stateful.')
- self.UpdateImage(base_image_path, 'clean')
+ self.TryDeltaAndFallbackToFull(target_image_path, base_image_path, 'clean')
self.VerifyImage(percent_passed)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698