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. Runs multiple instances in | 8 Similar to sharding_supervisor.py but finer grained. Runs multiple instances in |
9 parallel. | 9 parallel. |
10 """ | 10 """ |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 nb_runs += len(items) | 580 nb_runs += len(items) |
581 if not any(not i['returncode'] for i in items): | 581 if not any(not i['returncode'] for i in items): |
582 fail.append(test_case) | 582 fail.append(test_case) |
583 elif len(items) > 1 and any(not i['returncode'] for i in items): | 583 elif len(items) > 1 and any(not i['returncode'] for i in items): |
584 flaky.append(test_case) | 584 flaky.append(test_case) |
585 elif len(items) == 1 and items[0]['returncode'] == 0: | 585 elif len(items) == 1 and items[0]['returncode'] == 0: |
586 success.append(test_case) | 586 success.append(test_case) |
587 else: | 587 else: |
588 assert False, items | 588 assert False, items |
589 | 589 |
590 # Retry all the failures serially to see if they are just flaky when | |
591 # run at the same time. | |
592 if fail: | |
593 print 'Retrying failed tests serially.' | |
594 progress = Progress(len(fail)) | |
595 function = Runner( | |
596 executable, os.getcwd(), timeout, progress, retry_count=1).map | |
597 test_cases_retry = fail[:] | |
598 | |
599 for test_case in test_cases_retry: | |
600 output = function(test_case) | |
601 progress.print_update() | |
602 results[output[0]['test_case']].append(output) | |
603 if not output[0]['returncode']: | |
604 fail.remove(test_case) | |
605 flaky.append(test_case) | |
606 | |
607 LogResults(result_file, results) | |
608 sys.stdout.write('\n') | |
609 | |
610 print 'Summary:' | 590 print 'Summary:' |
611 for test_case in sorted(flaky): | 591 for test_case in sorted(flaky): |
612 items = results[test_case] | 592 items = results[test_case] |
613 print '%s is flaky (tried %d times)' % (test_case, len(items)) | 593 print '%s is flaky (tried %d times)' % (test_case, len(items)) |
614 | 594 |
615 for test_case in sorted(fail): | 595 for test_case in sorted(fail): |
616 print '%s failed' % (test_case) | 596 print '%s failed' % (test_case) |
617 | 597 |
618 print 'Success: %4d %5.2f%%' % (len(success), len(success) * 100. / total) | 598 print 'Success: %4d %5.2f%%' % (len(success), len(success) * 100. / total) |
619 print 'Flaky: %4d %5.2f%%' % (len(flaky), len(flaky) * 100. / total) | 599 print 'Flaky: %4d %5.2f%%' % (len(flaky), len(flaky) * 100. / total) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 return run_test_cases( | 732 return run_test_cases( |
753 executable, | 733 executable, |
754 test_cases, | 734 test_cases, |
755 options.jobs, | 735 options.jobs, |
756 options.timeout, | 736 options.timeout, |
757 result_file) | 737 result_file) |
758 | 738 |
759 | 739 |
760 if __name__ == '__main__': | 740 if __name__ == '__main__': |
761 sys.exit(main(sys.argv[1:])) | 741 sys.exit(main(sys.argv[1:])) |
OLD | NEW |