| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Module containing class that implements an au_worker for a test device.""" | 5 """Module containing class that implements an au_worker for a test device.""" |
| 6 | 6 |
| 7 import unittest | 7 import unittest |
| 8 | 8 |
| 9 import cros_build_lib as cros_lib | 9 import cros_build_lib as cros_lib |
| 10 | 10 |
| 11 import au_worker | 11 import au_worker |
| 12 | 12 |
| 13 class RealAUWorker(au_worker.AUWorker): | 13 class RealAUWorker(au_worker.AUWorker): |
| 14 """Test harness for updating real images.""" | 14 """Test harness for updating real images.""" |
| 15 | 15 |
| 16 def __init__(self, options): | 16 def __init__(self, options, test_results_root): |
| 17 """Processes non-vm-specific options.""" | 17 """Processes non-vm-specific options.""" |
| 18 au_worker.AUWorker.__init__(self, options) | 18 au_worker.AUWorker.__init__(self, options, test_results_root) |
| 19 self.remote = options.remote | 19 self.remote = options.remote |
| 20 if not self.remote: cros_lib.Die('We require a remote address for tests.') | 20 if not self.remote: cros_lib.Die('We require a remote address for tests.') |
| 21 | 21 |
| 22 def PrepareBase(self, image_path): | 22 def PrepareBase(self, image_path): |
| 23 """Auto-update to base image to prepare for test.""" | 23 """Auto-update to base image to prepare for test.""" |
| 24 self.PrepareRealBase(image_path) | 24 self.PrepareRealBase(image_path) |
| 25 | 25 |
| 26 def UpdateImage(self, image_path, src_image_path='', stateful_change='old', | 26 def UpdateImage(self, image_path, src_image_path='', stateful_change='old', |
| 27 proxy_port=None, private_key_path=None): | 27 proxy_port=None, private_key_path=None): |
| 28 """Updates a remote image using image_to_live.sh.""" | 28 """Updates a remote image using image_to_live.sh.""" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 '--payload=%s' % update_path, | 44 '--payload=%s' % update_path, |
| 45 '--remote=%s' % self.remote, | 45 '--remote=%s' % self.remote, |
| 46 stateful_change_flag, | 46 stateful_change_flag, |
| 47 '--verify', | 47 '--verify', |
| 48 ] | 48 ] |
| 49 if proxy_port: cmd.append('--proxy_port=%s' % proxy_port) | 49 if proxy_port: cmd.append('--proxy_port=%s' % proxy_port) |
| 50 self.RunUpdateCmd(cmd) | 50 self.RunUpdateCmd(cmd) |
| 51 | 51 |
| 52 def VerifyImage(self, unittest, percent_required_to_pass=100): | 52 def VerifyImage(self, unittest, percent_required_to_pass=100): |
| 53 """Verifies an image using run_remote_tests.sh with verification suite.""" | 53 """Verifies an image using run_remote_tests.sh with verification suite.""" |
| 54 test_directory = self.GetNextResultsPath('verify') |
| 54 output = cros_lib.RunCommand( | 55 output = cros_lib.RunCommand( |
| 55 ['%s/run_remote_tests.sh' % self.crosutils, | 56 ['%s/run_remote_tests.sh' % self.crosutils, |
| 56 '--remote=%s' % self.remote, | 57 '--remote=%s' % self.remote, |
| 58 '--results_dir_root=%s' % test_directory, |
| 57 self.verify_suite, | 59 self.verify_suite, |
| 58 ], error_ok=True, enter_chroot=False, redirect_stdout=True) | 60 ], error_ok=True, enter_chroot=False, redirect_stdout=True) |
| 59 return self.AssertEnoughTestsPassed(unittest, output, | 61 return self.AssertEnoughTestsPassed(unittest, output, |
| 60 percent_required_to_pass) | 62 percent_required_to_pass) |
| 61 | 63 |
| OLD | NEW |