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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 Dictionary of Update Identifiers->Relative cache locations. | 833 Dictionary of Update Identifiers->Relative cache locations. |
834 Raises: | 834 Raises: |
835 UpdateException if we fail to generate an update. | 835 UpdateException if we fail to generate an update. |
836 """ | 836 """ |
837 def _GenerateVMUpdate(target, src): | 837 def _GenerateVMUpdate(target, src): |
838 """Generates an update using the devserver.""" | 838 """Generates an update using the devserver.""" |
839 target = ReinterpretPathForChroot(target) | 839 target = ReinterpretPathForChroot(target) |
840 if src: | 840 if src: |
841 src = ReinterpretPathForChroot(src) | 841 src = ReinterpretPathForChroot(src) |
842 | 842 |
843 return RunCommandCaptureOutput(['sudo', | 843 return RunCommandCaptureOutput(['./enter_chroot.sh', |
| 844 '--nogit_config', |
| 845 '--', |
| 846 'sudo', |
844 './start_devserver', | 847 './start_devserver', |
845 '--pregenerate_update', | 848 '--pregenerate_update', |
846 '--exit', | 849 '--exit', |
847 '--image=%s' % target, | 850 '--image=%s' % target, |
848 '--src_image=%s' % src, | 851 '--src_image=%s' % src, |
849 '--for_vm', | 852 '--for_vm', |
850 ], combine_stdout_stderr=True, | 853 ], combine_stdout_stderr=True, |
851 enter_chroot=True, | |
852 print_cmd=False) | 854 print_cmd=False) |
853 | 855 |
854 # Get the list of deltas by mocking out update method in test class. | 856 # Get the list of deltas by mocking out update method in test class. |
855 test_suite = _PrepareTestSuite(parser, options, GenerateVirtualAUDeltasTest) | 857 test_suite = _PrepareTestSuite(parser, options, GenerateVirtualAUDeltasTest) |
856 test_result = unittest.TextTestRunner(verbosity=0).run(test_suite) | 858 test_result = unittest.TextTestRunner(verbosity=0).run(test_suite) |
857 | 859 |
858 Info('The following delta updates are required.') | 860 Info('The following delta updates are required.') |
859 update_ids = [] | 861 update_ids = [] |
860 jobs = [] | 862 jobs = [] |
861 args = [] | 863 args = [] |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 """Runs the tests given by the options and test_class in parallel.""" | 906 """Runs the tests given by the options and test_class in parallel.""" |
905 threads = [] | 907 threads = [] |
906 args = [] | 908 args = [] |
907 test_suite = _PrepareTestSuite(parser, options, test_class) | 909 test_suite = _PrepareTestSuite(parser, options, test_class) |
908 for test in test_suite: | 910 for test in test_suite: |
909 test_name = test.id() | 911 test_name = test.id() |
910 test_case = unittest.TestLoader().loadTestsFromName(test_name) | 912 test_case = unittest.TestLoader().loadTestsFromName(test_name) |
911 threads.append(unittest.TextTestRunner().run) | 913 threads.append(unittest.TextTestRunner().run) |
912 args.append(test_case) | 914 args.append(test_case) |
913 | 915 |
914 # TODO(sosa): Set back to options.jobs once parallel generation is | 916 results = _RunParallelJobs(options.jobs, threads, args, print_status=False) |
915 # no longer flaky. | |
916 results = _RunParallelJobs(1, threads, args, print_status=False) | |
917 for test_result in results: | 917 for test_result in results: |
918 if not test_result.wasSuccessful(): | 918 if not test_result.wasSuccessful(): |
919 Die('Test harness was not successful') | 919 Die('Test harness was not successful') |
920 | 920 |
921 | 921 |
922 def main(): | 922 def main(): |
923 parser = optparse.OptionParser() | 923 parser = optparse.OptionParser() |
924 parser.add_option('-b', '--base_image', | 924 parser.add_option('-b', '--base_image', |
925 help='path to the base image.') | 925 help='path to the base image.') |
926 parser.add_option('-r', '--board', | 926 parser.add_option('-r', '--board', |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 else: | 970 else: |
971 dev_server_cache = None | 971 dev_server_cache = None |
972 test_suite = _PrepareTestSuite(parser, options, test_class) | 972 test_suite = _PrepareTestSuite(parser, options, test_class) |
973 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) | 973 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) |
974 if not test_result.wasSuccessful(): | 974 if not test_result.wasSuccessful(): |
975 Die('Test harness was not successful.') | 975 Die('Test harness was not successful.') |
976 | 976 |
977 | 977 |
978 if __name__ == '__main__': | 978 if __name__ == '__main__': |
979 main() | 979 main() |
OLD | NEW |