OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Runs each test cases as a single shard, single process execution. | 6 """Runs each test cases as a single shard, single process execution. |
7 | 7 |
8 Similar to sharding_supervisor.py but finer grained. It runs each test case | 8 Similar to sharding_supervisor.py but finer grained. It runs each test case |
9 individually instead of running per shard. Runs multiple instances in parallel. | 9 individually instead of running per shard. Runs multiple instances in parallel. |
10 """ | 10 """ |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 | 843 |
844 if self.verbose > 1: | 844 if self.verbose > 1: |
845 self.progress.update_item('Command %s finished after %ss' % (cmd, | 845 self.progress.update_item('Command %s finished after %ss' % (cmd, |
846 duration), | 846 duration), |
847 False, False) | 847 False, False) |
848 | 848 |
849 # It needs to be valid utf-8 otherwise it can't be stored. | 849 # It needs to be valid utf-8 otherwise it can't be stored. |
850 # TODO(maruel): Be more intelligent than decoding to ascii. | 850 # TODO(maruel): Be more intelligent than decoding to ascii. |
851 utf8_output = output.decode('ascii', 'ignore').encode('utf-8') | 851 utf8_output = output.decode('ascii', 'ignore').encode('utf-8') |
852 | 852 |
853 if len(test_cases) > 1: | 853 data = process_output(utf8_output.splitlines(True), test_cases) |
854 data = process_output( | 854 data = normalize_testing_time(data, duration, returncode) |
855 utf8_output.splitlines(True), test_cases) | |
856 data = normalize_testing_time(data, duration, returncode) | |
857 else: | |
858 if '[ RUN ]' not in output: | |
859 # Can't find gtest marker, mark it as invalid. | |
860 returncode = returncode or 1 | |
861 data = [ | |
862 { | |
863 'test_case': test_cases[0], | |
864 'returncode': returncode, | |
865 'duration': duration, | |
866 'output': utf8_output, | |
867 } | |
868 ] | |
869 | |
870 data = chromium_filter_tests(data) | 855 data = chromium_filter_tests(data) |
871 | 856 |
872 if sys.platform == 'win32': | 857 if sys.platform == 'win32': |
873 output = output.replace('\r\n', '\n') | 858 output = output.replace('\r\n', '\n') |
874 | 859 |
875 for i in data: | 860 for i in data: |
876 self.decider.got_result(i['returncode'] == 0) | 861 self.decider.got_result(i['returncode'] == 0) |
877 need_to_retry = i['returncode'] != 0 and try_count < self.retries | 862 need_to_retry = i['returncode'] != 0 and try_count < self.retries |
878 if try_count: | 863 if try_count: |
879 line = '%s (%.2fs) - retry #%d' % ( | 864 line = '%s (%.2fs) - retry #%d' % ( |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 options.gtest_output, | 1571 options.gtest_output, |
1587 result_file, | 1572 result_file, |
1588 options.verbose) | 1573 options.verbose) |
1589 except Failure as e: | 1574 except Failure as e: |
1590 print >> sys.stderr, e.args[0] | 1575 print >> sys.stderr, e.args[0] |
1591 return 1 | 1576 return 1 |
1592 | 1577 |
1593 | 1578 |
1594 if __name__ == '__main__': | 1579 if __name__ == '__main__': |
1595 sys.exit(main(sys.argv[1:])) | 1580 sys.exit(main(sys.argv[1:])) |
OLD | NEW |