Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2011 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 re | 9 import re |
| 10 import sys | 10 import sys |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 """ | 234 """ |
| 235 # Just make sure some tests pass on original image. Some old images | 235 # Just make sure some tests pass on original image. Some old images |
| 236 # don't pass many tests. | 236 # don't pass many tests. |
| 237 self.PrepareBase(self.base_image_path) | 237 self.PrepareBase(self.base_image_path) |
| 238 # TODO(sosa): move to 100% once we start testing using the autotest paired | 238 # TODO(sosa): move to 100% once we start testing using the autotest paired |
| 239 # with the dev channel. | 239 # with the dev channel. |
| 240 percent_passed = self.VerifyImage(10) | 240 percent_passed = self.VerifyImage(10) |
| 241 | 241 |
| 242 # Update to - all tests should pass on new image. | 242 # Update to - all tests should pass on new image. |
| 243 Info('Updating from base image on vm to target image.') | 243 Info('Updating from base image on vm to target image.') |
| 244 self.PerformUpdate(self.base_image_path, self.target_image_path) | 244 self.PerformUpdate(self.base_image_path, self.target_image_path) |
|
petkov
2011/01/07 23:41:05
the comment above seems inconsistent -- here and 3
| |
| 245 self.VerifyImage(100) | 245 self.VerifyImage(100) |
| 246 | 246 |
| 247 # Update from - same percentage should pass that originally passed. | 247 # Update from - same percentage should pass that originally passed. |
| 248 Info('Updating from updated image on vm back to base image.') | 248 Info('Updating from updated image on vm back to base image.') |
| 249 self.PerformUpdate(self.target_image_path, self.base_image_path) | 249 self.PerformUpdate(self.target_image_path, self.base_image_path) |
| 250 self.VerifyImage(percent_passed) | 250 self.VerifyImage(percent_passed) |
| 251 | 251 |
| 252 def testFullUpdateWipeStateful(self): | 252 def testFullUpdateWipeStateful(self): |
| 253 """Tests if we can update after cleaning the stateful partition. | 253 """Tests if we can update after cleaning the stateful partition. |
| 254 | 254 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 if self.data_size > (2 * 1024 * 1024): | 365 if self.data_size > (2 * 1024 * 1024): |
| 366 self.delay_count += 1 | 366 self.delay_count += 1 |
| 367 time.sleep(20) | 367 time.sleep(20) |
| 368 | 368 |
| 369 self.data_size += len(data) | 369 self.data_size += len(data) |
| 370 return data | 370 return data |
| 371 | 371 |
| 372 self.AttemptUpdateWithFilter(DelayedFilter()) | 372 self.AttemptUpdateWithFilter(DelayedFilter()) |
| 373 | 373 |
| 374 def SimpleTest(self): | 374 def SimpleTest(self): |
| 375 """A simple update that updates the target image to itself. | 375 """A simple update that updates once from a base image to a target. |
| 376 | 376 |
| 377 We explicitly don't use test prefix so that isn't run by default. Can be | 377 We explicitly don't use test prefix so that isn't run by default. Can be |
| 378 run using test_prefix option. | 378 run using test_prefix option. |
| 379 """ | 379 """ |
| 380 self.PrepareBase(self.target_image_path) | 380 self.PrepareBase(self.base_image_path) |
| 381 self._UpdateImage(self.target_image_path) | 381 self.PerformUpdate(self.target_image_path, self.base_image_path) |
| 382 self.VerifyImage(100) | 382 self.VerifyImage(100) |
| 383 | 383 |
| 384 | 384 |
| 385 class RealAUTest(unittest.TestCase, AUTest): | 385 class RealAUTest(unittest.TestCase, AUTest): |
| 386 """Test harness for updating real images.""" | 386 """Test harness for updating real images.""" |
| 387 | 387 |
| 388 def setUp(self): | 388 def setUp(self): |
| 389 AUTest.setUp(self) | 389 AUTest.setUp(self) |
| 390 | 390 |
| 391 @classmethod | 391 @classmethod |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 638 test_loader.testMethodPrefix = options.test_prefix | 638 test_loader.testMethodPrefix = options.test_prefix |
| 639 test_suite = test_loader.loadTestsFromTestCase(test_class) | 639 test_suite = test_loader.loadTestsFromTestCase(test_class) |
| 640 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) | 640 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) |
| 641 | 641 |
| 642 if not test_result.wasSuccessful(): | 642 if not test_result.wasSuccessful(): |
| 643 Die('Test harness was not successful') | 643 Die('Test harness was not successful') |
| 644 | 644 |
| 645 | 645 |
| 646 if __name__ == '__main__': | 646 if __name__ == '__main__': |
| 647 main() | 647 main() |
| OLD | NEW |