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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 RunCommand([ | 118 RunCommand([ |
119 '%s/image_to_live.sh' % self.crosutils, | 119 '%s/image_to_live.sh' % self.crosutils, |
120 '--image=%s' % image_path, | 120 '--image=%s' % image_path, |
121 '--remote=%s' % remote, | 121 '--remote=%s' % remote, |
122 stateful_change_flag, | 122 stateful_change_flag, |
123 '--verify', | 123 '--verify', |
124 ], enter_chroot=False) | 124 ], enter_chroot=False) |
125 | 125 |
126 | 126 |
127 def NotVerifyImage(self): | 127 def VerifyImage(self): |
128 """Verifies an image using run_remote_tests.sh with verification suite.""" | 128 """Verifies an image using run_remote_tests.sh with verification suite.""" |
129 RunCommand([ | 129 RunCommand([ |
130 '%s/run_remote_tests.sh' % self.crosutils, | 130 '%s/run_remote_tests.sh' % self.crosutils, |
131 '--remote=%s' % remote, | 131 '--remote=%s' % remote, |
132 _VERIFY_SUITE, | 132 _VERIFY_SUITE, |
133 ], error_ok=False, enter_chroot=False) | 133 ], error_ok=False, enter_chroot=False) |
134 | 134 |
135 | 135 |
136 class VirtualAUTest(unittest.TestCase, AUTest): | 136 class VirtualAUTest(unittest.TestCase, AUTest): |
137 """Test harness for updating virtual machines.""" | 137 """Test harness for updating virtual machines.""" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 if not base_image_path: | 223 if not base_image_path: |
224 parser.error('Need path to base image for vm.') | 224 parser.error('Need path to base image for vm.') |
225 | 225 |
226 if not target_image_path: | 226 if not target_image_path: |
227 parser.error('Need path to target image to update with.') | 227 parser.error('Need path to target image to update with.') |
228 | 228 |
229 if not board: | 229 if not board: |
230 parser.error('Need board to convert base image to vm.') | 230 parser.error('Need board to convert base image to vm.') |
231 | 231 |
| 232 return_code = 0 |
| 233 |
232 # Only run the test harness we care about. | 234 # Only run the test harness we care about. |
233 if options.type == 'vm': | 235 if options.type == 'vm': |
234 suite = unittest.TestLoader().loadTestsFromTestCase(VirtualAUTest) | 236 suite = unittest.TestLoader().loadTestsFromTestCase(VirtualAUTest) |
235 unittest.TextTestRunner(verbosity=2).run(suite) | 237 return_code = unittest.TextTestRunner(verbosity=2).run(suite) |
236 elif options.type == 'real': | 238 elif options.type == 'real': |
237 if not options.remote: | 239 if not options.remote: |
238 parser.error('Real tests require a remote test machine.') | 240 parser.error('Real tests require a remote test machine.') |
239 else: | 241 else: |
240 remote = options.remote | 242 remote = options.remote |
241 | 243 |
242 suite = unittest.TestLoader().loadTestsFromTestCase(RealAUTest) | 244 suite = unittest.TestLoader().loadTestsFromTestCase(RealAUTest) |
243 unittest.TextTestRunner(verbosity=2).run(suite) | 245 return_code = unittest.TextTestRunner(verbosity=2).run(suite) |
244 else: | 246 else: |
245 parser.error('Could not parse harness type %s.' % options.type) | 247 parser.error('Could not parse harness type %s.' % options.type) |
| 248 |
| 249 sys.exit(return_code) |
OLD | NEW |