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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 else: | 652 else: |
653 self._PrepareRealBase(image_path) | 653 self._PrepareRealBase(image_path) |
654 | 654 |
655 def _UpdateImage(self, image_path, src_image_path='', stateful_change='old', | 655 def _UpdateImage(self, image_path, src_image_path='', stateful_change='old', |
656 proxy_port=None, private_key_path=None): | 656 proxy_port=None, private_key_path=None): |
657 if self.au_type == 'vm' and src_image_path and self._first_update: | 657 if self.au_type == 'vm' and src_image_path and self._first_update: |
658 src_image_path = self.vm_image_path | 658 src_image_path = self.vm_image_path |
659 self._first_update = False | 659 self._first_update = False |
660 | 660 |
661 # Generate a value that combines delta with private key path. | 661 # Generate a value that combines delta with private key path. |
662 val = '%s+%s' % (src_image_path, private_key_path) | 662 val = src_image_path |
| 663 if private_key_path: val = '%s+%s' % (val, private_key_path) |
663 if not self.delta_list.has_key(image_path): | 664 if not self.delta_list.has_key(image_path): |
664 self.delta_list[image_path] = set([val]) | 665 self.delta_list[image_path] = set([val]) |
665 else: | 666 else: |
666 self.delta_list[image_path].add(val) | 667 self.delta_list[image_path].add(val) |
667 | 668 |
668 def AttemptUpdateWithPayloadExpectedFailure(self, payload, expected_msg): | 669 def AttemptUpdateWithPayloadExpectedFailure(self, payload, expected_msg): |
669 pass | 670 pass |
670 | 671 |
671 def VerifyImage(self, percent_required_to_pass): | 672 def VerifyImage(self, percent_required_to_pass): |
672 pass | 673 pass |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 test_result = unittest.TextTestRunner(verbosity=0).run(test_suite) | 864 test_result = unittest.TextTestRunner(verbosity=0).run(test_suite) |
864 if not test_result.wasSuccessful(): | 865 if not test_result.wasSuccessful(): |
865 raise UpdateException(1, 'Error finding updates to generate.') | 866 raise UpdateException(1, 'Error finding updates to generate.') |
866 | 867 |
867 Info('The following delta updates are required.') | 868 Info('The following delta updates are required.') |
868 update_ids = [] | 869 update_ids = [] |
869 jobs = [] | 870 jobs = [] |
870 args = [] | 871 args = [] |
871 for target, srcs in PregenerateAUDeltas.delta_list.items(): | 872 for target, srcs in PregenerateAUDeltas.delta_list.items(): |
872 for src_key in srcs: | 873 for src_key in srcs: |
873 (src, key) = src_key.split('+') | 874 (src, _ , key) = src_key.partition('+') |
874 # TODO(sosa): Add private key as part of caching name once devserver can | 875 # TODO(sosa): Add private key as part of caching name once devserver can |
875 # handle it its own cache. | 876 # handle it its own cache. |
876 update_id = _GenerateUpdateId(target=target, src=src, key=key) | 877 update_id = _GenerateUpdateId(target=target, src=src, key=key) |
877 print >> sys.stderr, 'AU: %s' % update_id | 878 print >> sys.stderr, 'AU: %s' % update_id |
878 update_ids.append(update_id) | 879 update_ids.append(update_id) |
879 jobs.append(_GenerateVMUpdate) | 880 jobs.append(_GenerateVMUpdate) |
880 args.append((target, src, key)) | 881 args.append((target, src, key)) |
881 | 882 |
882 raw_results = _RunParallelJobs(options.jobs, jobs, args, print_status=True) | 883 raw_results = _RunParallelJobs(options.jobs, jobs, args, print_status=True) |
883 results = [] | 884 results = [] |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 # Can't run in parallel with only one remote device. | 1068 # Can't run in parallel with only one remote device. |
1068 test_suite = _PrepareTestSuite(parser, options, test_class) | 1069 test_suite = _PrepareTestSuite(parser, options, test_class) |
1069 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) | 1070 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) |
1070 if not test_result.wasSuccessful(): Die('Test harness failed.') | 1071 if not test_result.wasSuccessful(): Die('Test harness failed.') |
1071 finally: | 1072 finally: |
1072 my_server.Stop() | 1073 my_server.Stop() |
1073 | 1074 |
1074 | 1075 |
1075 if __name__ == '__main__': | 1076 if __name__ == '__main__': |
1076 main() | 1077 main() |
OLD | NEW |