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 |
11 | 11 |
12 sys.path.append(os.path.join(os.path.dirname(__file__), '../lib')) | 12 sys.path.append(os.path.join(os.path.dirname(__file__), '../lib')) |
13 from cros_build_lib import Die | 13 from cros_build_lib import Die |
14 from cros_build_lib import Info | 14 from cros_build_lib import Info |
15 from cros_build_lib import ReinterpretPathForChroot | 15 from cros_build_lib import ReinterpretPathForChroot |
16 from cros_build_lib import RunCommand | 16 from cros_build_lib import RunCommand |
17 from cros_build_lib import Warning | 17 from cros_build_lib import Warning |
18 | 18 |
19 | 19 |
20 _KVM_PID_FILE = '/tmp/harness_pid' | 20 _KVM_PID_FILE = '/tmp/harness_pid' |
21 _FULL_VDISK_SIZE = 6072 | 21 _FULL_VDISK_SIZE = 6072 |
22 _FULL_STATEFULFS_SIZE = 2048 | 22 _FULL_STATEFULFS_SIZE = 3074 |
23 | 23 |
24 # Globals to communicate options to unit tests. | 24 # Globals to communicate options to unit tests. |
25 global base_image_path | 25 global base_image_path |
26 global board | 26 global board |
27 global remote | 27 global remote |
28 global target_image_path | 28 global target_image_path |
29 global vm_graphics_flag | 29 global vm_graphics_flag |
30 | 30 |
31 | 31 |
32 _VERIFY_SUITE = 'suite_Smoke' | 32 _VERIFY_SUITE = 'suite_Smoke' |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 """Tests if we can update normally. | 120 """Tests if we can update normally. |
121 | 121 |
122 This test checks that we can update by updating the stateful partition | 122 This test checks that we can update by updating the stateful partition |
123 rather than wiping it. | 123 rather than wiping it. |
124 """ | 124 """ |
125 # Just make sure some tests pass on original image. Some old images | 125 # Just make sure some tests pass on original image. Some old images |
126 # don't pass many tests. | 126 # don't pass many tests. |
127 self.PrepareBase() | 127 self.PrepareBase() |
128 # TODO(sosa): move to 100% once we start testing using the autotest paired | 128 # TODO(sosa): move to 100% once we start testing using the autotest paired |
129 # with the dev channel. | 129 # with the dev channel. |
130 percent_passed = self.VerifyImage(42) | 130 percent_passed = self.VerifyImage(10) |
131 | 131 |
132 # Update to - all tests should pass on new image. | 132 # Update to - all tests should pass on new image. |
133 Info('Updating from base image on vm to target image.') | 133 Info('Updating from base image on vm to target image.') |
134 self.UpdateImage(target_image_path) | 134 self.UpdateImage(target_image_path) |
135 self.VerifyImage(100) | 135 self.VerifyImage(100) |
136 | 136 |
137 # Update from - same percentage should pass that originally passed. | 137 # Update from - same percentage should pass that originally passed. |
138 Info('Updating from updated image on vm back to base image.') | 138 Info('Updating from updated image on vm back to base image.') |
139 self.UpdateImage(base_image_path) | 139 self.UpdateImage(base_image_path) |
140 self.VerifyImage(percent_passed) | 140 self.VerifyImage(percent_passed) |
141 | 141 |
142 # TODO(sosa): Re-enable once we have a good way of checking for version | 142 # TODO(sosa): Re-enable once we have a good way of checking for version |
143 # compatibility. | 143 # compatibility. |
144 def NotestFullUpdateWipeStateful(self): | 144 def testFullUpdateWipeStateful(self): |
petkov
2010/10/25 16:55:36
Don't you need to remove the TODO?
| |
145 """Tests if we can update after cleaning the stateful partition. | 145 """Tests if we can update after cleaning the stateful partition. |
146 | 146 |
147 This test checks that we can update successfully after wiping the | 147 This test checks that we can update successfully after wiping the |
148 stateful partition. | 148 stateful partition. |
149 """ | 149 """ |
150 # Just make sure some tests pass on original image. Some old images | 150 # Just make sure some tests pass on original image. Some old images |
151 # don't pass many tests. | 151 # don't pass many tests. |
152 self.PrepareBase() | 152 self.PrepareBase() |
153 # TODO(sosa): move to 100% once we start testing using the autotest paired | 153 # TODO(sosa): move to 100% once we start testing using the autotest paired |
154 # with the dev channel. | 154 # with the dev channel. |
155 percent_passed = self.VerifyImage(42) | 155 percent_passed = self.VerifyImage(10) |
156 | 156 |
157 # Update to - all tests should pass on new image. | 157 # Update to - all tests should pass on new image. |
158 Info('Updating from base image on vm to target image and wiping stateful.') | 158 Info('Updating from base image on vm to target image and wiping stateful.') |
159 self.UpdateImage(target_image_path, 'clean') | 159 self.UpdateImage(target_image_path, 'clean') |
160 self.VerifyImage(100) | 160 self.VerifyImage(100) |
161 | 161 |
162 # Update from - same percentage should pass that originally passed. | 162 # Update from - same percentage should pass that originally passed. |
163 Info('Updating from updated image back to base image and wiping stateful.') | 163 Info('Updating from updated image back to base image and wiping stateful.') |
164 self.UpdateImage(base_image_path, 'clean') | 164 self.UpdateImage(base_image_path, 'clean') |
165 self.VerifyImage(percent_passed) | 165 self.VerifyImage(percent_passed) |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 else: | 317 else: |
318 remote = options.remote | 318 remote = options.remote |
319 | 319 |
320 suite = unittest.TestLoader().loadTestsFromTestCase(RealAUTest) | 320 suite = unittest.TestLoader().loadTestsFromTestCase(RealAUTest) |
321 test_result = unittest.TextTestRunner(verbosity=2).run(suite) | 321 test_result = unittest.TextTestRunner(verbosity=2).run(suite) |
322 else: | 322 else: |
323 parser.error('Could not parse harness type %s.' % options.type) | 323 parser.error('Could not parse harness type %s.' % options.type) |
324 | 324 |
325 if not test_result.wasSuccessful(): | 325 if not test_result.wasSuccessful(): |
326 Die('Test harness was not successful') | 326 Die('Test harness was not successful') |
OLD | NEW |