OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import optparse | 7 import optparse |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import unittest | 10 import unittest |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 # don't pass many tests. | 128 # don't pass many tests. |
129 self.PrepareBase() | 129 self.PrepareBase() |
130 # TODO(sosa): move to 100% once we start testing using the autotest paired | 130 # TODO(sosa): move to 100% once we start testing using the autotest paired |
131 # with the dev channel. | 131 # with the dev channel. |
132 percent_passed = self.VerifyImage(10) | 132 percent_passed = self.VerifyImage(10) |
133 | 133 |
134 if self.use_delta_updates: self.source_image = base_image_path | 134 if self.use_delta_updates: self.source_image = base_image_path |
135 | 135 |
136 # Update to - all tests should pass on new image. | 136 # Update to - all tests should pass on new image. |
137 Info('Updating from base image on vm to target image.') | 137 Info('Updating from base image on vm to target image.') |
138 self.UpdateImage(target_image_path) | 138 try: |
| 139 self.UpdateImage(target_image_path) |
| 140 except: |
| 141 if self.use_delta_updates: |
| 142 Warning('Delta update failed, disabling delta updates and retrying.') |
| 143 self.use_delta_updates = False |
| 144 self.source_image = '' |
| 145 self.UpdateImage(target_image_path) |
| 146 else: |
| 147 raise |
| 148 |
139 self.VerifyImage(100) | 149 self.VerifyImage(100) |
140 | 150 |
141 if self.use_delta_updates: self.source_image = target_image_path | 151 if self.use_delta_updates: self.source_image = target_image_path |
142 | 152 |
143 # Update from - same percentage should pass that originally passed. | 153 # Update from - same percentage should pass that originally passed. |
144 Info('Updating from updated image on vm back to base image.') | 154 Info('Updating from updated image on vm back to base image.') |
145 self.UpdateImage(base_image_path) | 155 self.UpdateImage(base_image_path) |
146 self.VerifyImage(percent_passed) | 156 self.VerifyImage(percent_passed) |
147 | 157 |
148 # TODO(sosa): Re-enable once we have a good way of checking for version | |
149 # compatibility. | |
150 def testFullUpdateWipeStateful(self): | 158 def testFullUpdateWipeStateful(self): |
151 """Tests if we can update after cleaning the stateful partition. | 159 """Tests if we can update after cleaning the stateful partition. |
152 | 160 |
153 This test checks that we can update successfully after wiping the | 161 This test checks that we can update successfully after wiping the |
154 stateful partition. | 162 stateful partition. |
155 """ | 163 """ |
156 # Just make sure some tests pass on original image. Some old images | 164 # Just make sure some tests pass on original image. Some old images |
157 # don't pass many tests. | 165 # don't pass many tests. |
158 self.PrepareBase() | 166 self.PrepareBase() |
159 # TODO(sosa): move to 100% once we start testing using the autotest paired | 167 # TODO(sosa): move to 100% once we start testing using the autotest paired |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 else: | 345 else: |
338 remote = options.remote | 346 remote = options.remote |
339 | 347 |
340 suite = unittest.TestLoader().loadTestsFromTestCase(RealAUTest) | 348 suite = unittest.TestLoader().loadTestsFromTestCase(RealAUTest) |
341 test_result = unittest.TextTestRunner(verbosity=2).run(suite) | 349 test_result = unittest.TextTestRunner(verbosity=2).run(suite) |
342 else: | 350 else: |
343 parser.error('Could not parse harness type %s.' % options.type) | 351 parser.error('Could not parse harness type %s.' % options.type) |
344 | 352 |
345 if not test_result.wasSuccessful(): | 353 if not test_result.wasSuccessful(): |
346 Die('Test harness was not successful') | 354 Die('Test harness was not successful') |
OLD | NEW |