Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged | 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged |
| 3 # Copyright (C) 2011 Apple Inc. All rights reserved. | 3 # Copyright (C) 2011 Apple Inc. All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 import logging | 31 import logging |
| 32 import optparse | 32 import optparse |
| 33 import os | 33 import os |
| 34 import sys | 34 import sys |
| 35 import time | |
| 35 import traceback | 36 import traceback |
| 36 | 37 |
| 37 from webkitpy.common.host import Host | 38 from webkitpy.common.host import Host |
| 38 from webkitpy.common.system.executive import Executive | 39 from webkitpy.common.system.executive import Executive |
| 39 from webkitpy.layout_tests.controllers.manager import Manager | 40 from webkitpy.layout_tests.controllers.manager import Manager |
| 40 from webkitpy.layout_tests.models import test_run_results | 41 from webkitpy.layout_tests.models import test_run_results |
| 41 from webkitpy.layout_tests.port.factory import configuration_options, platform_o ptions | 42 from webkitpy.layout_tests.port.factory import configuration_options, platform_o ptions |
| 42 from webkitpy.layout_tests.views import buildbot_results | 43 from webkitpy.layout_tests.views import buildbot_results |
| 43 from webkitpy.layout_tests.views import printing | 44 from webkitpy.layout_tests.views import printing |
| 44 from webkitpy.layout_tests.generate_results_dashboard import DashBoardGenerator | 45 from webkitpy.layout_tests.generate_results_dashboard import DashBoardGenerator |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 default=0, | 325 default=0, |
| 325 help="Set the maximum number of locked shards"), | 326 help="Set the maximum number of locked shards"), |
| 326 optparse.make_option( | 327 optparse.make_option( |
| 327 "--nocheck-sys-deps", | 328 "--nocheck-sys-deps", |
| 328 action="store_true", | 329 action="store_true", |
| 329 default=False, | 330 default=False, |
| 330 help="Don't check the system dependencies (themes)"), | 331 help="Don't check the system dependencies (themes)"), |
| 331 optparse.make_option( | 332 optparse.make_option( |
| 332 "--order", | 333 "--order", |
| 333 action="store", | 334 action="store", |
| 334 default="natural", | 335 default=None, |
| 335 help=("determine the order in which the test cases will be run. " | 336 help=("determine the order in which the test cases will be run. " |
| 336 "'none' == use the order in which the tests were listed " | 337 "'none' == use the order in which the tests were listed " |
| 337 "either in arguments or test list, " | 338 "either in arguments or test list, " |
| 338 "'natural' == use the natural order (default), " | 339 "'natural' == use the natural order (default), " |
| 339 "'random-seeded' == randomize the test order using a fixed seed, " | 340 "'random-seeded=SEED' == randomize the test order using " |
| 341 "a fixed seed, " | |
| 340 "'random' == randomize the test order.")), | 342 "'random' == randomize the test order.")), |
| 341 optparse.make_option( | 343 optparse.make_option( |
| 342 "--profile", | 344 "--profile", |
| 343 action="store_true", | 345 action="store_true", |
| 344 help="Output per-test profile information."), | 346 help="Output per-test profile information."), |
| 345 optparse.make_option( | 347 optparse.make_option( |
| 346 "--profiler", | 348 "--profiler", |
| 347 action="store", | 349 action="store", |
| 348 help="Output per-test profile information, using the specified p rofiler."), | 350 help="Output per-test profile information, using the specified p rofiler."), |
| 349 optparse.make_option( | 351 optparse.make_option( |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 optparse.make_option( | 452 optparse.make_option( |
| 451 "--test-results-server", | 453 "--test-results-server", |
| 452 default="", | 454 default="", |
| 453 help="If specified, upload results json files to this appengine server."), | 455 help="If specified, upload results json files to this appengine server."), |
| 454 optparse.make_option( | 456 optparse.make_option( |
| 455 "--write-full-results-to", | 457 "--write-full-results-to", |
| 456 help=("If specified, copy full_results.json from the results dir to the " | 458 help=("If specified, copy full_results.json from the results dir to the " |
| 457 "specified path.")), | 459 "specified path.")), |
| 458 ])) | 460 ])) |
| 459 | 461 |
| 462 # Support gtest command line interface | |
| 463 # https://github.com/google/googletest/blob/master/googletest/docs/AdvancedG uide.md#running-test-programs-advanced-options | |
| 464 option_group_definitions.append( | |
| 465 ("gtest compatibility API Options", [ | |
| 466 # Listing Tests Names | |
| 467 ################################################################### | |
| 468 # https://github.com/google/googletest/blob/master/googletest/docs/A dvancedGuide.md#listing-test-names | |
| 469 # | |
| 470 # --gtest_list_tests | |
| 471 # Format is; | |
| 472 # TestCase1. | |
| 473 # TestName1 | |
| 474 # TestName2 | |
| 475 # TestCase2. | |
| 476 # TestName | |
| 477 # optparse.make_option( | |
| 478 # "--gtest_list_tests", | |
| 479 # default="", | |
| 480 # help=""), | |
| 481 | |
| 482 # Filtering | |
| 483 ################################################################### | |
| 484 # https://github.com/google/googletest/blob/master/googletest/docs/A dvancedGuide.md#running-a-subset-of-the-tests | |
| 485 # | |
| 486 # --gtest_filter | |
| 487 # : - Separator for multiple patterns | |
| 488 # * - Match anything | |
| 489 # ? - Match single | |
| 490 # - - (Starts with) Exclude these matches | |
| 491 # optparse.make_option( | |
| 492 # "--gtest_filter", | |
| 493 # default="", | |
| 494 # help=""), | |
| 495 | |
| 496 # Disabled tests | |
| 497 ################################################################### | |
| 498 # https://github.com/google/googletest/blob/master/googletest/docs/A dvancedGuide.md#temporarily-disabling-tests | |
| 499 # | |
| 500 # --gtest_also_run_disabled_tests | |
| 501 # $GTEST_ALSO_RUN_DISABLED_TESTS | |
| 502 # | |
| 503 # --skipped=ignore | |
| 504 # --skip-failing-tests | |
| 505 # --ignore-flaky-tests | |
| 506 # optparse.make_option( | |
| 507 # "--gtest_also_run_disabled_tests", | |
| 508 # default=os.environ.get("GTEST_ALSO_RUN_DISABLED_TESTS", "0"), | |
| 509 # type=bool, | |
| 510 # action="store_true", | |
| 511 # help=""), | |
| 512 | |
| 513 # Repeating | |
| 514 ################################################################### | |
| 515 # https://github.com/google/googletest/blob/master/googletest/docs/A dvancedGuide.md#repeating-the-tests | |
| 516 # | |
| 517 # --gtest_repeat=TIMES | |
| 518 # | |
| 519 # ?? --repeat-each | |
| 520 # ?? --iterations | |
| 521 optparse.make_option( | |
| 522 "--gtest_repeat", | |
| 523 default="1", | |
| 524 type="int", | |
| 525 help=""), | |
| 526 | |
| 527 # Shuffling | |
| 528 ################################################################### | |
| 529 # https://github.com/google/googletest/blob/master/googletest/docs/A dvancedGuide.md#shuffling-the-tests | |
| 530 # | |
| 531 # --gtest_shuffle | |
| 532 # $GTEST_SHUFFLE | |
| 533 # 1 == enable shuffle | |
| 534 optparse.make_option( | |
| 535 "--gtest_shuffle", | |
| 536 default=os.environ.get("GTEST_SHUFFLE", "0"), | |
| 537 action="store_true", | |
| 538 help=""), | |
| 539 | |
| 540 # --gtest_random_seed=SEED | |
| 541 # $GTEST_RANDOM_SEED | |
| 542 # 0 == "use current time" | |
| 543 # 1->99999 == Random seed | |
| 544 # --order=random-seeded | |
| 545 optparse.make_option( | |
| 546 "--gtest_random_seed", | |
| 547 default=os.environ.get("GTEST_RANDOM_SEED", "-1"), | |
| 548 type="int", | |
| 549 help=""), | |
| 550 | |
| 551 # Sharding | |
| 552 ################################################################### | |
| 553 # https://github.com/google/googletest/blob/master/googletest/docs/A dvancedGuide.md#distributing-test-functions-to-multiple-machines | |
| 554 # $GTEST_TOTAL_SHARDS | |
| 555 # $GTEST_SHARD_INDEX -- [0, GTEST_TOTAL_SHARDS - 1] | |
| 556 # $GTEST_SHARD_STATUS_FILE -- ??? | |
| 557 | |
| 558 # --run-part | |
| 559 # --run-chunk | |
| 560 optparse.make_option( | |
| 561 "--gtest_shard_index", | |
| 562 default=os.environ.get("GTEST_SHARD_INDEX", "-1"), | |
| 563 type="int", | |
| 564 help=""), | |
| 565 optparse.make_option( | |
| 566 "--gtest_total_shards", | |
| 567 default=os.environ.get("GTEST_TOTAL_SHARDS", "-1"), | |
| 568 type="int", | |
| 569 help=""), | |
| 570 | |
| 571 # Output | |
| 572 ################################################################### | |
| 573 # GTEST_OUTPUT | |
| 574 # --gtest_output | |
| 575 optparse.make_option( | |
| 576 "--gtest_output", | |
| 577 default="", | |
| 578 help=""), | |
| 579 ])) | |
| 580 | |
| 581 # Isolate command line interface | |
| 582 option_group_definitions.append( | |
|
Dirk Pranke
2016/06/21 22:05:24
I don't necessarily think we should add all of the
| |
| 583 ("Swarming & Isolate compatibility API Options", [ | |
| 584 # --write-full-results-to | |
| 585 optparse.make_option( | |
| 586 "--isolated-script-test-output", | |
| 587 default="", | |
| 588 help=""), | |
| 589 ])) | |
| 590 | |
| 460 option_parser = optparse.OptionParser() | 591 option_parser = optparse.OptionParser() |
| 461 | 592 |
| 462 for group_name, group_options in option_group_definitions: | 593 for group_name, group_options in option_group_definitions: |
| 463 option_group = optparse.OptionGroup(option_parser, group_name) | 594 option_group = optparse.OptionGroup(option_parser, group_name) |
| 464 option_group.add_options(group_options) | 595 option_group.add_options(group_options) |
| 465 option_parser.add_option_group(option_group) | 596 option_parser.add_option_group(option_group) |
| 466 | 597 |
| 467 return option_parser.parse_args(args) | 598 return option_parser.parse_args(args) |
| 468 | 599 |
| 469 | 600 |
| 470 def _set_up_derived_options(port, options, args): | 601 def _set_up_derived_options(port, options, args): |
| 471 """Sets the options values that depend on other options values.""" | 602 """Sets the options values that depend on other options values.""" |
| 603 | |
| 472 if options.batch_size is None: | 604 if options.batch_size is None: |
| 473 options.batch_size = port.default_batch_size() | 605 options.batch_size = port.default_batch_size() |
| 474 | 606 |
| 475 if not options.child_processes: | 607 if not options.child_processes: |
| 476 options.child_processes = os.environ.get("WEBKIT_TEST_CHILD_PROCESSES", | 608 options.child_processes = os.environ.get("WEBKIT_TEST_CHILD_PROCESSES", |
| 477 str(port.default_child_processe s())) | 609 str(port.default_child_processe s())) |
| 478 if not options.max_locked_shards: | 610 if not options.max_locked_shards: |
| 479 options.max_locked_shards = int(os.environ.get("WEBKIT_TEST_MAX_LOCKED_S HARDS", | 611 options.max_locked_shards = int(os.environ.get("WEBKIT_TEST_MAX_LOCKED_S HARDS", |
| 480 str(port.default_max_lock ed_shards()))) | 612 str(port.default_max_lock ed_shards()))) |
| 481 | 613 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 | 661 |
| 530 if not options.test_list: | 662 if not options.test_list: |
| 531 options.test_list = [] | 663 options.test_list = [] |
| 532 options.test_list.append(port.host.filesystem.join(port.layout_tests_dir (), 'SmokeTests')) | 664 options.test_list.append(port.host.filesystem.join(port.layout_tests_dir (), 'SmokeTests')) |
| 533 if not options.skipped: | 665 if not options.skipped: |
| 534 options.skipped = 'always' | 666 options.skipped = 'always' |
| 535 | 667 |
| 536 if not options.skipped: | 668 if not options.skipped: |
| 537 options.skipped = 'default' | 669 options.skipped = 'default' |
| 538 | 670 |
| 671 # gtest API to existing arguments | |
| 672 ###################################################################### | |
| 673 # Listing Tests Names | |
| 674 # FIXME: Put stuff here | |
| 675 # Filtering | |
| 676 # FIXME: Put stuff here | |
| 677 # Disabled tests | |
| 678 # FIXME: Put stuff here | |
| 679 | |
| 680 # Repeating | |
| 681 if options.gtest_repeat > 1: | |
| 682 options.iterations = options.gtest_repeat | |
| 683 | |
| 684 # Shuffling | |
| 685 if options.gtest_shuffle == 1: | |
| 686 if options.order: | |
| 687 _log.fatal("Can't supply --gtest_shuffle and --order") | |
| 688 | |
| 689 seed = options.gtest_random_seed | |
| 690 if seed in (-1, 0): | |
| 691 seed = int(time.time()) | |
| 692 | |
| 693 options.order = 'random-seeded=%s' % seed | |
| 694 | |
| 695 if options.gtest_random_seed != -1 and not options.order.startswith('random- seeded'): | |
| 696 _log.fatal("Can't supply --gtest_random_seed supplied, but order not set to random-seeded") | |
| 697 | |
| 698 if options.order is None: | |
| 699 options.order = 'natural' | |
| 700 | |
| 701 # Sharding | |
| 702 if options.gtest_shard_index != -1: | |
| 703 if options.gtest_total_shards == -1: | |
| 704 _log.fatal('Require --gtest_total_shards if --gtest_shard_index is s et.') | |
| 705 | |
| 706 if options.run_part: | |
| 707 _log.fatal("Can't supply --gtest sharding options and --run_part!") | |
| 708 | |
| 709 options.run_part = '%i:%i' % (options.gtest_shard_index + 1, options.gte st_total_shards) | |
| 710 | |
| 711 # Output | |
| 712 # FIXME: Put stuff here | |
| 713 | |
| 539 | 714 |
| 540 def _run_tests(port, options, args, printer): | 715 def _run_tests(port, options, args, printer): |
| 541 _set_up_derived_options(port, options, args) | 716 _set_up_derived_options(port, options, args) |
| 542 manager = Manager(port, options, printer) | 717 manager = Manager(port, options, printer) |
| 543 printer.print_config(port.results_directory()) | 718 printer.print_config(port.results_directory()) |
| 544 return manager.run(args) | 719 return manager.run(args) |
| 545 | 720 |
| 546 | 721 |
| 547 def run(port, options, args, logging_stream, stdout): | 722 def run(port, options, args, logging_stream, stdout): |
| 548 logger = logging.getLogger() | 723 logger = logging.getLogger() |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 576 _log.debug("\t%s" % process) | 751 _log.debug("\t%s" % process) |
| 577 | 752 |
| 578 return run_details | 753 return run_details |
| 579 | 754 |
| 580 finally: | 755 finally: |
| 581 printer.cleanup() | 756 printer.cleanup() |
| 582 | 757 |
| 583 if __name__ == '__main__': | 758 if __name__ == '__main__': |
| 584 exit_code = main(sys.argv[1:], sys.stdout, sys.stderr) | 759 exit_code = main(sys.argv[1:], sys.stdout, sys.stderr) |
| 585 sys.exit(exit_code) | 760 sys.exit(exit_code) |
| OLD | NEW |