Add ability to fall back to fulls for all updates.

Currently works around issue till we get a good fix in for 9.x.

Change-Id: I9c7225508fa8f46a5fa5e0b41abc4e373cc80085

BUG=8606
TEST=Tested by sending SEGV to a delta update during update and saw it successfully fall back to a full update and succeed.

Review URL: http://codereview.chromium.org/4258002
This commit is contained in:
Chris Sosa 2010-11-02 18:06:34 -07:00
parent 7333e2b4c4
commit a2a597d18b

View File

@ -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)