Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2012 the V8 project authors. All rights reserved. | 3 # Copyright 2012 the V8 project authors. All rights reserved. |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 return False | 451 return False |
| 452 if not CheckTestMode("slow test", options.slow_tests): | 452 if not CheckTestMode("slow test", options.slow_tests): |
| 453 return False | 453 return False |
| 454 if not CheckTestMode("pass|fail test", options.pass_fail_tests): | 454 if not CheckTestMode("pass|fail test", options.pass_fail_tests): |
| 455 return False | 455 return False |
| 456 if options.no_i18n: | 456 if options.no_i18n: |
| 457 TEST_MAP["default"].remove("intl") | 457 TEST_MAP["default"].remove("intl") |
| 458 return True | 458 return True |
| 459 | 459 |
| 460 | 460 |
| 461 def ShardTests(tests, shard_count, shard_run): | 461 def ShardTests(tests, options): |
| 462 # Read gtest shard configuration from environment (e.g. set by swarming). | |
| 463 # If none is present, use values passed on the command line. | |
|
tandrii(chromium)
2015/10/12 11:54:31
since this overrides values specified on cmd, mayb
Michael Achenbach
2015/10/12 12:03:03
Done.
| |
| 464 shard_count = int(os.environ.get('GTEST_TOTAL_SHARDS', options.shard_count)) | |
| 465 shard_run = os.environ.get('GTEST_SHARD_INDEX') | |
| 466 if shard_run is not None: | |
| 467 # The v8 shard_run starts at 1, while GTEST_SHARD_INDEX starts at 0. | |
| 468 shard_run = int(shard_run) + 1 | |
| 469 else: | |
| 470 shard_run = options.shard_run | |
| 471 | |
| 462 if shard_count < 2: | 472 if shard_count < 2: |
| 463 return tests | 473 return tests |
| 464 if shard_run < 1 or shard_run > shard_count: | 474 if shard_run < 1 or shard_run > shard_count: |
| 465 print "shard-run not a valid number, should be in [1:shard-count]" | 475 print "shard-run not a valid number, should be in [1:shard-count]" |
| 466 print "defaulting back to running all tests" | 476 print "defaulting back to running all tests" |
| 467 return tests | 477 return tests |
| 468 count = 0 | 478 count = 0 |
| 469 shard = [] | 479 shard = [] |
| 470 for test in tests: | 480 for test in tests: |
| 471 if count % shard_count == shard_run - 1: | 481 if count % shard_count == shard_run - 1: |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 else: | 653 else: |
| 644 yield ["--random-seed=%d" % RandomSeed()] | 654 yield ["--random-seed=%d" % RandomSeed()] |
| 645 s.tests = [ | 655 s.tests = [ |
| 646 t.CopyAddingFlags(t.variant, flags) | 656 t.CopyAddingFlags(t.variant, flags) |
| 647 for t in variant_tests | 657 for t in variant_tests |
| 648 for flags in iter_seed_flags() | 658 for flags in iter_seed_flags() |
| 649 ] | 659 ] |
| 650 else: | 660 else: |
| 651 s.tests = variant_tests | 661 s.tests = variant_tests |
| 652 | 662 |
| 653 s.tests = ShardTests(s.tests, options.shard_count, options.shard_run) | 663 s.tests = ShardTests(s.tests, options) |
| 654 num_tests += len(s.tests) | 664 num_tests += len(s.tests) |
| 655 | 665 |
| 656 if options.cat: | 666 if options.cat: |
| 657 return 0 # We're done here. | 667 return 0 # We're done here. |
| 658 | 668 |
| 659 if options.report: | 669 if options.report: |
| 660 verbose.PrintReport(all_tests) | 670 verbose.PrintReport(all_tests) |
| 661 | 671 |
| 662 # Run the tests, either locally or distributed on the network. | 672 # Run the tests, either locally or distributed on the network. |
| 663 start_time = time.time() | 673 start_time = time.time() |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 704 verbose.PrintTestDurations(suites, overall_duration) | 714 verbose.PrintTestDurations(suites, overall_duration) |
| 705 | 715 |
| 706 if num_tests == 0: | 716 if num_tests == 0: |
| 707 print("Warning: no tests were run!") | 717 print("Warning: no tests were run!") |
| 708 | 718 |
| 709 return exit_code | 719 return exit_code |
| 710 | 720 |
| 711 | 721 |
| 712 if __name__ == "__main__": | 722 if __name__ == "__main__": |
| 713 sys.exit(Main()) | 723 sys.exit(Main()) |
| OLD | NEW |