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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 '--board=%s' % board, | 245 '--board=%s' % board, |
246 '--test_image'], enter_chroot=True) | 246 '--test_image'], enter_chroot=True) |
247 else: | 247 else: |
248 Info('Using existing VM image') | 248 Info('Using existing VM image') |
249 | 249 |
250 self.assertTrue(os.path.exists(self.vm_image_path)) | 250 self.assertTrue(os.path.exists(self.vm_image_path)) |
251 | 251 |
252 def UpdateImage(self, image_path, stateful_change='old'): | 252 def UpdateImage(self, image_path, stateful_change='old'): |
253 """Updates VM image with image_path.""" | 253 """Updates VM image with image_path.""" |
254 stateful_change_flag = self.GetStatefulChangeFlag(stateful_change) | 254 stateful_change_flag = self.GetStatefulChangeFlag(stateful_change) |
| 255 if self.source_image == base_image_path: |
| 256 self.source_image = self.vm_image_path |
255 | 257 |
256 RunCommand(['%s/cros_run_vm_update' % self.crosutilsbin, | 258 RunCommand(['%s/cros_run_vm_update' % self.crosutilsbin, |
257 '--update_image_path=%s' % image_path, | 259 '--update_image_path=%s' % image_path, |
258 '--vm_image_path=%s' % self.vm_image_path, | 260 '--vm_image_path=%s' % self.vm_image_path, |
259 '--snapshot', | 261 '--snapshot', |
260 vm_graphics_flag, | 262 vm_graphics_flag, |
261 '--persist', | 263 '--persist', |
262 '--kvm_pid=%s' % _KVM_PID_FILE, | 264 '--kvm_pid=%s' % _KVM_PID_FILE, |
263 stateful_change_flag, | 265 stateful_change_flag, |
264 '--src_image=%s' % self.source_image, | 266 '--src_image=%s' % self.source_image, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 else: | 337 else: |
336 remote = options.remote | 338 remote = options.remote |
337 | 339 |
338 suite = unittest.TestLoader().loadTestsFromTestCase(RealAUTest) | 340 suite = unittest.TestLoader().loadTestsFromTestCase(RealAUTest) |
339 test_result = unittest.TextTestRunner(verbosity=2).run(suite) | 341 test_result = unittest.TextTestRunner(verbosity=2).run(suite) |
340 else: | 342 else: |
341 parser.error('Could not parse harness type %s.' % options.type) | 343 parser.error('Could not parse harness type %s.' % options.type) |
342 | 344 |
343 if not test_result.wasSuccessful(): | 345 if not test_result.wasSuccessful(): |
344 Die('Test harness was not successful') | 346 Die('Test harness was not successful') |
OLD | NEW |