Chromium Code Reviews| 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 various chrome tests through valgrind_test.py.''' | 6 ''' Runs various chrome tests through valgrind_test.py.''' |
| 7 | 7 |
| 8 import glob | 8 import glob |
| 9 import logging | 9 import logging |
| 10 import multiprocessing | 10 import multiprocessing |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 "url": TestURL, "url_unittests": TestURL, | 561 "url": TestURL, "url_unittests": TestURL, |
| 562 "views": TestViews, "views_unittests": TestViews, | 562 "views": TestViews, "views_unittests": TestViews, |
| 563 } | 563 } |
| 564 | 564 |
| 565 | 565 |
| 566 def _main(): | 566 def _main(): |
| 567 parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " | 567 parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " |
| 568 "[-t <test> ...]") | 568 "[-t <test> ...]") |
| 569 parser.disable_interspersed_args() | 569 parser.disable_interspersed_args() |
| 570 | 570 |
| 571 parser.add_option("", "--help-tests", dest="help_tests", action="store_true", | 571 parser.add_option("--help-tests", dest="help_tests", action="store_true", |
| 572 default=False, help="List all available tests") | 572 default=False, help="List all available tests") |
| 573 parser.add_option("-b", "--build-dir", | 573 parser.add_option("-b", "--build-dir", |
| 574 # TODO(thakis): Remove --build_dir once bots don't pass it. | 574 # TODO(thakis): Remove --build_dir once bots don't pass it. |
| 575 "--build_dir", | 575 "--build_dir", |
| 576 help="the location of the compiler output") | 576 help="the location of the compiler output") |
| 577 parser.add_option("--target", help="Debug or Release") | |
| 577 parser.add_option("-t", "--test", action="append", default=[], | 578 parser.add_option("-t", "--test", action="append", default=[], |
| 578 help="which test to run, supports test:gtest_filter format " | 579 help="which test to run, supports test:gtest_filter format " |
| 579 "as well.") | 580 "as well.") |
| 580 parser.add_option("", "--baseline", action="store_true", default=False, | 581 parser.add_option("--baseline", action="store_true", default=False, |
| 581 help="generate baseline data instead of validating") | 582 help="generate baseline data instead of validating") |
| 582 parser.add_option("", "--gtest_filter", | 583 parser.add_option("--gtest_filter", |
| 583 help="additional arguments to --gtest_filter") | 584 help="additional arguments to --gtest_filter") |
| 584 parser.add_option("", "--gtest_repeat", | 585 parser.add_option("--gtest_repeat", help="argument for --gtest_repeat") |
| 585 help="argument for --gtest_repeat") | |
| 586 parser.add_option("-v", "--verbose", action="store_true", default=False, | 586 parser.add_option("-v", "--verbose", action="store_true", default=False, |
| 587 help="verbose output - enable debug log messages") | 587 help="verbose output - enable debug log messages") |
| 588 parser.add_option("", "--tool", dest="valgrind_tool", default="memcheck", | 588 parser.add_option("--tool", dest="valgrind_tool", default="memcheck", |
| 589 help="specify a valgrind tool to run the tests under") | 589 help="specify a valgrind tool to run the tests under") |
| 590 parser.add_option("", "--tool_flags", dest="valgrind_tool_flags", default="", | 590 parser.add_option("--tool_flags", dest="valgrind_tool_flags", default="", |
| 591 help="specify custom flags for the selected valgrind tool") | 591 help="specify custom flags for the selected valgrind tool") |
| 592 parser.add_option("", "--keep_logs", action="store_true", default=False, | 592 parser.add_option("--keep_logs", action="store_true", default=False, |
| 593 help="store memory tool logs in the <tool>.logs directory " | 593 help="store memory tool logs in the <tool>.logs directory " |
| 594 "instead of /tmp.\nThis can be useful for tool " | 594 "instead of /tmp.\nThis can be useful for tool " |
| 595 "developers/maintainers.\nPlease note that the <tool>" | 595 "developers/maintainers.\nPlease note that the <tool>" |
| 596 ".logs directory will be clobbered on tool startup.") | 596 ".logs directory will be clobbered on tool startup.") |
| 597 parser.add_option("-n", "--num_tests", type="int", | 597 parser.add_option("-n", "--num_tests", type="int", |
| 598 default=ChromeTests.LAYOUT_TESTS_DEFAULT_CHUNK_SIZE, | 598 default=ChromeTests.LAYOUT_TESTS_DEFAULT_CHUNK_SIZE, |
| 599 help="for layout tests: # of subtests per run. 0 for all.") | 599 help="for layout tests: # of subtests per run. 0 for all.") |
| 600 # TODO(thestig) Remove this if we can. | 600 # TODO(thestig) Remove this if we can. |
| 601 parser.add_option("", "--gtest_color", dest="gtest_color", default="no", | 601 parser.add_option("--gtest_color", dest="gtest_color", default="no", |
| 602 help="dummy compatibility flag for sharding_supervisor.") | 602 help="dummy compatibility flag for sharding_supervisor.") |
| 603 | 603 |
| 604 options, args = parser.parse_args() | 604 options, args = parser.parse_args() |
| 605 | 605 |
| 606 # target used to be a part of build_dir, so only add it if it's not there. | |
| 607 # TODO(thakis): Always do this once the memory master no longer passes | |
|
Alexander Potapenko
2013/10/07 18:45:35
Nit: Valgrind and Heapcheck run on MFYI, not Memor
| |
| 608 # the target as part of build_dir. | |
| 609 if options.target and options.target not in options.build_dir: | |
| 610 options.build_dir = os.path.join(options.build_dir, options.target) | |
| 611 | |
| 606 if options.verbose: | 612 if options.verbose: |
| 607 logging_utils.config_root(logging.DEBUG) | 613 logging_utils.config_root(logging.DEBUG) |
| 608 else: | 614 else: |
| 609 logging_utils.config_root() | 615 logging_utils.config_root() |
| 610 | 616 |
| 611 if options.help_tests: | 617 if options.help_tests: |
| 612 ChromeTests.ShowTests() | 618 ChromeTests.ShowTests() |
| 613 return 0 | 619 return 0 |
| 614 | 620 |
| 615 if not options.test: | 621 if not options.test: |
| 616 parser.error("--test not specified") | 622 parser.error("--test not specified") |
| 617 | 623 |
| 618 if len(options.test) != 1 and options.gtest_filter: | 624 if len(options.test) != 1 and options.gtest_filter: |
| 619 parser.error("--gtest_filter and multiple tests don't make sense together") | 625 parser.error("--gtest_filter and multiple tests don't make sense together") |
| 620 | 626 |
| 621 for t in options.test: | 627 for t in options.test: |
| 622 tests = ChromeTests(options, args, t) | 628 tests = ChromeTests(options, args, t) |
| 623 ret = tests.Run() | 629 ret = tests.Run() |
| 624 if ret: return ret | 630 if ret: return ret |
| 625 return 0 | 631 return 0 |
| 626 | 632 |
| 627 | 633 |
| 628 if __name__ == "__main__": | 634 if __name__ == "__main__": |
| 629 sys.exit(_main()) | 635 sys.exit(_main()) |
| OLD | NEW |