Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/env python | 1 #!/bin/env python |
| 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2008 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 """Run layout tests using the test_shell. | 6 """Run layout tests using the test_shell. |
| 7 | 7 |
| 8 This is a port of the existing webkit test script run-webkit-tests. | 8 This is a port of the existing webkit test script run-webkit-tests. |
| 9 | 9 |
| 10 The TestRunner class runs a series of tests (TestType interface) against a set | 10 The TestRunner class runs a series of tests (TestType interface) against a set |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 for i in xrange(int(self._options.num_test_shells)): | 223 for i in xrange(int(self._options.num_test_shells)): |
| 224 shell_args = [] | 224 shell_args = [] |
| 225 test_args = test_type_base.TestArguments() | 225 test_args = test_type_base.TestArguments() |
| 226 if self._options.pixel_tests: | 226 if self._options.pixel_tests: |
| 227 png_path = os.path.join(self._options.results_directory, | 227 png_path = os.path.join(self._options.results_directory, |
| 228 "png_result%s.png" % i) | 228 "png_result%s.png" % i) |
| 229 shell_args.append("--pixel-tests=" + png_path) | 229 shell_args.append("--pixel-tests=" + png_path) |
| 230 test_args.png_path = png_path | 230 test_args.png_path = png_path |
| 231 | 231 |
| 232 test_args.wdiff = self._options.wdiff | 232 test_args.wdiff = self._options.wdiff |
| 233 | 233 test_args.new_baseline = self._options.new_baseline |
| 234 if self._options.new_baseline: | |
| 235 test_args.new_baseline = self._options.new_baseline | |
| 236 if not self._options.pixel_tests: | |
| 237 test_args.text_baseline = True | |
| 238 | |
| 239 test_args.show_sources = self._options.sources | 234 test_args.show_sources = self._options.sources |
| 240 | 235 |
| 241 # Create separate TestTypes instances for each thread. | 236 # Create separate TestTypes instances for each thread. |
| 242 test_types = [] | 237 test_types = [] |
| 243 for t in self._test_types: | 238 for t in self._test_types: |
| 244 test_types.append(t(self._options.platform, | 239 test_types.append(t(self._options.platform, |
| 245 self._options.results_directory)) | 240 self._options.results_directory)) |
| 246 | 241 |
| 247 if self._options.startup_dialog: | 242 if self._options.startup_dialog: |
| 248 shell_args.append('--testshell-startup-dialog') | 243 shell_args.append('--testshell-startup-dialog') |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 try: | 501 try: |
| 507 test_shell_binary_path = path_utils.TestShellBinaryPath(options.target) | 502 test_shell_binary_path = path_utils.TestShellBinaryPath(options.target) |
| 508 except: | 503 except: |
| 509 print "\nERROR: test_shell is not found. Be sure that you have built it" | 504 print "\nERROR: test_shell is not found. Be sure that you have built it" |
| 510 print "and that you are using the correct build. This script will run the" | 505 print "and that you are using the correct build. This script will run the" |
| 511 print "Release one by default. Use --debug to use the Debug build.\n" | 506 print "Release one by default. Use --debug to use the Debug build.\n" |
| 512 sys.exit(1) | 507 sys.exit(1) |
| 513 | 508 |
| 514 logging.info("Using platform '%s'" % options.platform) | 509 logging.info("Using platform '%s'" % options.platform) |
| 515 logging.info("Placing test results in %s" % options.results_directory) | 510 logging.info("Placing test results in %s" % options.results_directory) |
| 511 if options.new_baseline: | |
| 512 logging.info("Placing new baselines in %s" % | |
| 513 os.path.join(path_utils.PlatformResultsDir(options.platform), | |
| 514 options.platform)) | |
| 516 logging.info("Using %s build at %s" % | 515 logging.info("Using %s build at %s" % |
| 517 (options.target, test_shell_binary_path)) | 516 (options.target, test_shell_binary_path)) |
| 518 if options.pixel_tests: | 517 if options.pixel_tests: |
| 519 logging.info("Running pixel tests") | 518 logging.info("Running pixel tests") |
| 520 | 519 |
| 521 if 'cygwin' == sys.platform: | 520 if 'cygwin' == sys.platform: |
| 522 logging.warn("#" * 40) | 521 logging.warn("#" * 40) |
| 523 logging.warn("# UNEXPECTED PYTHON VERSION") | 522 logging.warn("# UNEXPECTED PYTHON VERSION") |
| 524 logging.warn("# This script should be run using the version of python") | 523 logging.warn("# This script should be run using the version of python") |
| 525 logging.warn("# in third_party/python_24/") | 524 logging.warn("# in third_party/python_24/") |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 option_parser.add_option("", "--pixel-tests", action="store_true", | 558 option_parser.add_option("", "--pixel-tests", action="store_true", |
| 560 default=False, | 559 default=False, |
| 561 help="enable pixel-to-pixel PNG comparisons") | 560 help="enable pixel-to-pixel PNG comparisons") |
| 562 option_parser.add_option("", "--wdiff", action="store_true", | 561 option_parser.add_option("", "--wdiff", action="store_true", |
| 563 default=False, | 562 default=False, |
| 564 help="enable word-by-word diffing") | 563 help="enable word-by-word diffing") |
| 565 option_parser.add_option("", "--results-directory", | 564 option_parser.add_option("", "--results-directory", |
| 566 default="layout-test-results", | 565 default="layout-test-results", |
| 567 help="Output results directory source dir," | 566 help="Output results directory source dir," |
| 568 " relative to Debug or Release") | 567 " relative to Debug or Release") |
| 569 option_parser.add_option("", "--new-baseline", default=None, metavar="DIR", | 568 option_parser.add_option("", "--new-baseline", action="store_true", |
| 570 help="save results as new baselines into this " | 569 default=False, |
| 571 "directory (e.g. layout_test_results/v8), " | 570 help="save all generated results as new baselines " |
| 572 "overwriting whatever's already there. " | 571 "into the platform directory , overwriting " |
|
tony
2008/11/14 04:45:42
Nit: space before comma.
| |
| 573 "If pixel tests are being run, only image " | 572 "whatever's already there.") |
| 574 "baselines will be saved, not text.") | |
| 575 option_parser.add_option("", "--noshow-results", action="store_true", | 573 option_parser.add_option("", "--noshow-results", action="store_true", |
| 576 default=False, help="don't launch the test_shell" | 574 default=False, help="don't launch the test_shell" |
| 577 " with results after the tests are done") | 575 " with results after the tests are done") |
| 578 option_parser.add_option("", "--full-results-html", action="store_true", | 576 option_parser.add_option("", "--full-results-html", action="store_true", |
| 579 default=False, help="show all failures in" | 577 default=False, help="show all failures in" |
| 580 "results.html, rather than only regressions") | 578 "results.html, rather than only regressions") |
| 581 option_parser.add_option("", "--nocompare-failures", action="store_true", | 579 option_parser.add_option("", "--nocompare-failures", action="store_true", |
| 582 default=False, | 580 default=False, |
| 583 help="Disable comparison to the last test run. " | 581 help="Disable comparison to the last test run. " |
| 584 "When enabled, show stats on how many tests " | 582 "When enabled, show stats on how many tests " |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 607 default=False, | 605 default=False, |
| 608 help="create a dialog on test_shell.exe startup") | 606 help="create a dialog on test_shell.exe startup") |
| 609 option_parser.add_option("", "--winhttp", action="store_true", | 607 option_parser.add_option("", "--winhttp", action="store_true", |
| 610 default=False, | 608 default=False, |
| 611 help="Use WinHTTP stack") | 609 help="Use WinHTTP stack") |
| 612 option_parser.add_option("", "--test-list", action="append", | 610 option_parser.add_option("", "--test-list", action="append", |
| 613 help="read list of tests to run from file", | 611 help="read list of tests to run from file", |
| 614 metavar="FILE") | 612 metavar="FILE") |
| 615 options, args = option_parser.parse_args() | 613 options, args = option_parser.parse_args() |
| 616 main(options, args) | 614 main(options, args) |
| OLD | NEW |