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 heapcheck_test.py. | 6 ''' Runs various chrome tests through heapcheck_test.py. |
7 | 7 |
8 Most of this code is copied from ../valgrind/chrome_tests.py. | 8 Most of this code is copied from ../valgrind/chrome_tests.py. |
9 TODO(glider): put common functions to a standalone module. | 9 TODO(glider): put common functions to a standalone module. |
10 ''' | 10 ''' |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 if not sys.platform.startswith('linux'): | 468 if not sys.platform.startswith('linux'): |
469 logging.error("Heap checking works only on Linux at the moment.") | 469 logging.error("Heap checking works only on Linux at the moment.") |
470 return 1 | 470 return 1 |
471 parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " | 471 parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " |
472 "[-t <test> ...]") | 472 "[-t <test> ...]") |
473 parser.disable_interspersed_args() | 473 parser.disable_interspersed_args() |
474 parser.add_option("-b", "--build-dir", | 474 parser.add_option("-b", "--build-dir", |
475 # TODO(thakis): Remove --build_dir once bots don't pass it. | 475 # TODO(thakis): Remove --build_dir once bots don't pass it. |
476 "--build_dir", | 476 "--build_dir", |
477 help="the location of the output of the compiler output") | 477 help="the location of the output of the compiler output") |
478 parser.add_option("-t", "--test", action="append", | 478 parser.add_option("--target", help="Debug or Release") |
479 help="which test to run") | 479 parser.add_option("-t", "--test", action="append", help="which test to run") |
480 parser.add_option("", "--gtest_filter", | 480 parser.add_option("--gtest_filter", |
481 help="additional arguments to --gtest_filter") | 481 help="additional arguments to --gtest_filter") |
482 parser.add_option("", "--gtest_repeat", | 482 parser.add_option("--gtest_repeat", help="argument for --gtest_repeat") |
483 help="argument for --gtest_repeat") | |
484 parser.add_option("-v", "--verbose", action="store_true", default=False, | 483 parser.add_option("-v", "--verbose", action="store_true", default=False, |
485 help="verbose output - enable debug log messages") | 484 help="verbose output - enable debug log messages") |
486 # My machine can do about 120 layout tests/hour in release mode. | 485 # My machine can do about 120 layout tests/hour in release mode. |
487 # Let's do 30 minutes worth per run. | 486 # Let's do 30 minutes worth per run. |
488 # The CPU is mostly idle, so perhaps we can raise this when | 487 # The CPU is mostly idle, so perhaps we can raise this when |
489 # we figure out how to run them more efficiently. | 488 # we figure out how to run them more efficiently. |
490 parser.add_option("-n", "--num_tests", default=60, type="int", | 489 parser.add_option("-n", "--num_tests", default=60, type="int", |
491 help="for layout tests: # of subtests per run. 0 for all.") | 490 help="for layout tests: # of subtests per run. 0 for all.") |
492 | 491 |
493 options, args = parser.parse_args() | 492 options, args = parser.parse_args() |
494 | 493 |
| 494 # target used to be a part of build_dir, so only add it if it's not there. |
| 495 # TODO(thakis): Always do this once the memory master no longer passes |
| 496 # the target as part of build_dir. |
| 497 if options.target and options.target not in options.build_dir: |
| 498 options.build_dir = os.path.join(options.build_dir, options.target) |
| 499 |
495 if options.verbose: | 500 if options.verbose: |
496 logging_utils.config_root(logging.DEBUG) | 501 logging_utils.config_root(logging.DEBUG) |
497 else: | 502 else: |
498 logging_utils.config_root() | 503 logging_utils.config_root() |
499 | 504 |
500 if not options.test or not len(options.test): | 505 if not options.test or not len(options.test): |
501 parser.error("--test not specified") | 506 parser.error("--test not specified") |
502 | 507 |
503 for t in options.test: | 508 for t in options.test: |
504 tests = ChromeTests(options, args, t) | 509 tests = ChromeTests(options, args, t) |
505 ret = tests.Run() | 510 ret = tests.Run() |
506 if ret: | 511 if ret: |
507 return ret | 512 return ret |
508 return 0 | 513 return 0 |
509 | 514 |
510 | 515 |
511 if __name__ == "__main__": | 516 if __name__ == "__main__": |
512 sys.exit(main()) | 517 sys.exit(main()) |
OLD | NEW |