| 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 """This module runs a suite of Auto Update tests. | 7 """This module runs a suite of Auto Update tests. |
| 8 | 8 |
| 9 The tests can be run on either a virtual machine or actual device depending | 9 The tests can be run on either a virtual machine or actual device depending |
| 10 on parameters given. Specific tests can be run by invoking --test_prefix. | 10 on parameters given. Specific tests can be run by invoking --test_prefix. |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 | 730 |
| 731 def __init__(self): | 731 def __init__(self): |
| 732 self.proc = None | 732 self.proc = None |
| 733 threading.Thread.__init__(self) | 733 threading.Thread.__init__(self) |
| 734 | 734 |
| 735 def run(self): | 735 def run(self): |
| 736 # Kill previous running instance of devserver if it exists. | 736 # Kill previous running instance of devserver if it exists. |
| 737 RunCommand(['sudo', 'pkill', '-f', 'devserver.py'], error_ok=True, | 737 RunCommand(['sudo', 'pkill', '-f', 'devserver.py'], error_ok=True, |
| 738 print_cmd=False) | 738 print_cmd=False) |
| 739 RunCommand(['sudo', | 739 RunCommand(['sudo', |
| 740 './start_devserver', | 740 'start_devserver', |
| 741 '--archive_dir=./static', | 741 '--archive_dir=./static', |
| 742 '--client_prefix=ChromeOSUpdateEngine', | 742 '--client_prefix=ChromeOSUpdateEngine', |
| 743 '--production', | 743 '--production', |
| 744 ], enter_chroot=True, print_cmd=False) | 744 ], enter_chroot=True, print_cmd=False) |
| 745 | 745 |
| 746 def Stop(self): | 746 def Stop(self): |
| 747 """Kills the devserver instance.""" | 747 """Kills the devserver instance.""" |
| 748 RunCommand(['sudo', 'pkill', '-f', 'devserver.py'], error_ok=True, | 748 RunCommand(['sudo', 'pkill', '-f', 'devserver.py'], error_ok=True, |
| 749 print_cmd=False) | 749 print_cmd=False) |
| 750 | 750 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 Dictionary of Update Identifiers->Relative cache locations. | 837 Dictionary of Update Identifiers->Relative cache locations. |
| 838 Raises: | 838 Raises: |
| 839 UpdateException if we fail to generate an update. | 839 UpdateException if we fail to generate an update. |
| 840 """ | 840 """ |
| 841 def _GenerateVMUpdate(target, src, private_key_path): | 841 def _GenerateVMUpdate(target, src, private_key_path): |
| 842 """Generates an update using the devserver.""" | 842 """Generates an update using the devserver.""" |
| 843 command = ['./enter_chroot.sh', | 843 command = ['./enter_chroot.sh', |
| 844 '--nogit_config', | 844 '--nogit_config', |
| 845 '--', | 845 '--', |
| 846 'sudo', | 846 'sudo', |
| 847 './start_devserver', | 847 'start_devserver', |
| 848 '--pregenerate_update', | 848 '--pregenerate_update', |
| 849 '--exit', | 849 '--exit', |
| 850 ] | 850 ] |
| 851 # Add actual args to command. | 851 # Add actual args to command. |
| 852 command.append('--image=%s' % ReinterpretPathForChroot(target)) | 852 command.append('--image=%s' % ReinterpretPathForChroot(target)) |
| 853 if src: command.append('--src_image=%s' % ReinterpretPathForChroot(src)) | 853 if src: command.append('--src_image=%s' % ReinterpretPathForChroot(src)) |
| 854 if options.type == 'vm': command.append('--for_vm') | 854 if options.type == 'vm': command.append('--for_vm') |
| 855 if private_key_path: | 855 if private_key_path: |
| 856 command.append('--private_key=%s' % | 856 command.append('--private_key=%s' % |
| 857 ReinterpretPathForChroot(private_key_path)) | 857 ReinterpretPathForChroot(private_key_path)) |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 image], | 972 image], |
| 973 print_cmd=False, redirect_stdout=True, redirect_stderr=True, | 973 print_cmd=False, redirect_stdout=True, redirect_stderr=True, |
| 974 enter_chroot=True, cwd=crosutils_dir) | 974 enter_chroot=True, cwd=crosutils_dir) |
| 975 | 975 |
| 976 | 976 |
| 977 def CleanPreviousWork(options): | 977 def CleanPreviousWork(options): |
| 978 """Cleans up previous work from the devserver cache and local image cache.""" | 978 """Cleans up previous work from the devserver cache and local image cache.""" |
| 979 Info('Cleaning up previous work.') | 979 Info('Cleaning up previous work.') |
| 980 # Wipe devserver cache. | 980 # Wipe devserver cache. |
| 981 RunCommandCaptureOutput( | 981 RunCommandCaptureOutput( |
| 982 ['sudo', './start_devserver', '--clear_cache', '--exit', ], | 982 ['sudo', 'start_devserver', '--clear_cache', '--exit', ], |
| 983 enter_chroot=True, print_cmd=False, combine_stdout_stderr=True) | 983 enter_chroot=True, print_cmd=False, combine_stdout_stderr=True) |
| 984 | 984 |
| 985 # Clean previous vm images if they exist. | 985 # Clean previous vm images if they exist. |
| 986 if options.type == 'vm': | 986 if options.type == 'vm': |
| 987 target_vm_image_path = '%s/chromiumos_qemu_image.bin' % os.path.dirname( | 987 target_vm_image_path = '%s/chromiumos_qemu_image.bin' % os.path.dirname( |
| 988 options.target_image) | 988 options.target_image) |
| 989 base_vm_image_path = '%s/chromiumos_qemu_image.bin' % os.path.dirname( | 989 base_vm_image_path = '%s/chromiumos_qemu_image.bin' % os.path.dirname( |
| 990 options.base_image) | 990 options.base_image) |
| 991 if os.path.exists(target_vm_image_path): os.remove(target_vm_image_path) | 991 if os.path.exists(target_vm_image_path): os.remove(target_vm_image_path) |
| 992 if os.path.exists(base_vm_image_path): os.remove(base_vm_image_path) | 992 if os.path.exists(base_vm_image_path): os.remove(base_vm_image_path) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 # Can't run in parallel with only one remote device. | 1070 # Can't run in parallel with only one remote device. |
| 1071 test_suite = _PrepareTestSuite(parser, options, test_class) | 1071 test_suite = _PrepareTestSuite(parser, options, test_class) |
| 1072 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) | 1072 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) |
| 1073 if not test_result.wasSuccessful(): Die('Test harness failed.') | 1073 if not test_result.wasSuccessful(): Die('Test harness failed.') |
| 1074 finally: | 1074 finally: |
| 1075 my_server.Stop() | 1075 my_server.Stop() |
| 1076 | 1076 |
| 1077 | 1077 |
| 1078 if __name__ == '__main__': | 1078 if __name__ == '__main__': |
| 1079 main() | 1079 main() |
| OLD | NEW |