From a2a597d18bd49f4cd734be10f8ee97d9658e735c Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Tue, 2 Nov 2010 18:06:34 -0700 Subject: [PATCH] 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 --- bin/cros_au_test_harness.py | 51 ++++++++++++++----------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/bin/cros_au_test_harness.py b/bin/cros_au_test_harness.py index b9640b4c3f..7342310ce7 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)