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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 cmd_args=(["--ui-test-action-max-timeout=450000"])) | 504 cmd_args=(["--ui-test-action-max-timeout=450000"])) |
505 | 505 |
506 def TestLayoutChunk(self, chunk_num, chunk_size): | 506 def TestLayoutChunk(self, chunk_num, chunk_size): |
507 # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the | 507 # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the |
508 # list of tests. Wrap around to beginning of list at end. | 508 # list of tests. Wrap around to beginning of list at end. |
509 # If chunk_size is zero, run all tests in the list once. | 509 # If chunk_size is zero, run all tests in the list once. |
510 # If a text file is given as argument, it is used as the list of tests. | 510 # If a text file is given as argument, it is used as the list of tests. |
511 assert((chunk_size == 0) != (len(self._args) == 0)) | 511 assert((chunk_size == 0) != (len(self._args) == 0)) |
512 # Build the ginormous commandline in 'cmd'. | 512 # Build the ginormous commandline in 'cmd'. |
513 # It's going to be roughly | 513 # It's going to be roughly |
514 # python valgrind_test.py ... python run_webkit_tests.py ... | 514 # python valgrind_test.py ... |
515 # but we'll use the --indirect flag to valgrind_test.py | 515 # but we'll use the --indirect flag to valgrind_test.py |
516 # to avoid valgrinding python. | 516 # to avoid valgrinding python. |
517 # Start by building the valgrind_test.py commandline. | 517 # Start by building the valgrind_test.py commandline. |
518 tool = valgrind_test.CreateTool(self._options.valgrind_tool) | 518 tool = valgrind_test.CreateTool(self._options.valgrind_tool) |
519 cmd = self._DefaultCommand(tool) | 519 cmd = self._DefaultCommand(tool) |
520 cmd.append("--trace_children") | 520 cmd.append("--trace_children") |
521 cmd.append("--indirect_webkit_layout") | 521 cmd.append("--indirect_webkit_layout") |
522 cmd.append("--ignore_exit_code") | 522 cmd.append("--ignore_exit_code") |
523 # Now build script_cmd, the run_webkits_tests.py commandline | 523 # Now build script_cmd, the run-webkits-tests commandline. |
524 # Store each chunk in its own directory so that we can find the data later | 524 # Store each chunk in its own directory so that we can find the data later |
525 chunk_dir = os.path.join("layout", "chunk_%05d" % chunk_num) | 525 chunk_dir = os.path.join("layout", "chunk_%05d" % chunk_num) |
526 out_dir = os.path.join(path_utils.ScriptDir(), "latest") | 526 out_dir = os.path.join(path_utils.ScriptDir(), "latest") |
527 out_dir = os.path.join(out_dir, chunk_dir) | 527 out_dir = os.path.join(out_dir, chunk_dir) |
528 if os.path.exists(out_dir): | 528 if os.path.exists(out_dir): |
529 old_files = glob.glob(os.path.join(out_dir, "*.txt")) | 529 old_files = glob.glob(os.path.join(out_dir, "*.txt")) |
530 for f in old_files: | 530 for f in old_files: |
531 os.remove(f) | 531 os.remove(f) |
532 else: | 532 else: |
533 os.makedirs(out_dir) | 533 os.makedirs(out_dir) |
534 script = os.path.join(self._source_dir, "webkit", "tools", "layout_tests", | 534 script = os.path.join(self._source_dir, "third_party", "WebKit", "Tools", |
535 "run_webkit_tests.py") | 535 "Scripts", "run-webkit-tests") |
536 # http://crbug.com/260627: After the switch to content_shell from DRT, each | 536 # http://crbug.com/260627: After the switch to content_shell from DRT, each |
537 # test now brings up 3 processes. Under Valgrind, they become memory bound | 537 # test now brings up 3 processes. Under Valgrind, they become memory bound |
538 # and can eventually OOM if we don't reduce the total count. | 538 # and can eventually OOM if we don't reduce the total count. |
539 # It'd be nice if content_shell automatically throttled the startup of new | 539 # It'd be nice if content_shell automatically throttled the startup of new |
540 # tests if we're low on memory. | 540 # tests if we're low on memory. |
541 jobs = max(1, int(multiprocessing.cpu_count() * 0.3)) | 541 jobs = max(1, int(multiprocessing.cpu_count() * 0.3)) |
542 script_cmd = ["python", script, "-v", | 542 script_cmd = ["python", script, "-v", |
543 # run a separate DumpRenderTree for each test | 543 # run a separate DumpRenderTree for each test |
544 "--batch-size=1", | 544 "--batch-size=1", |
545 "--fully-parallel", | 545 "--fully-parallel", |
546 "--child-processes=%d" % jobs, | 546 "--child-processes=%d" % jobs, |
547 "--time-out-ms=800000", | 547 "--time-out-ms=800000", |
548 "--no-retry-failures", # retrying takes too much time | 548 "--no-retry-failures", # retrying takes too much time |
549 # http://crbug.com/176908: Don't launch a browser when done. | 549 # http://crbug.com/176908: Don't launch a browser when done. |
550 "--no-show-results", | 550 "--no-show-results", |
551 "--nocheck-sys-deps"] | 551 "--nocheck-sys-deps"] |
552 # Pass build mode to run_webkit_tests.py. We aren't passed it directly, | 552 # Pass build mode to run-webkit-tests. We aren't passed it directly, |
553 # so parse it out of build_dir. run_webkit_tests.py can only handle | 553 # so parse it out of build_dir. run-webkit-tests can only handle |
554 # the two values "Release" and "Debug". | 554 # the two values "Release" and "Debug". |
555 # TODO(Hercules): unify how all our scripts pass around build mode | 555 # TODO(Hercules): unify how all our scripts pass around build mode |
556 # (--mode / --target / --build-dir / --debug) | 556 # (--mode / --target / --build-dir / --debug) |
557 if self._options.build_dir: | 557 if self._options.build_dir: |
558 build_root, mode = os.path.split(self._options.build_dir) | 558 build_root, mode = os.path.split(self._options.build_dir) |
559 script_cmd.extend(["--build-directory", build_root, "--target", mode]) | 559 script_cmd.extend(["--build-directory", build_root, "--target", mode]) |
560 if (chunk_size > 0): | 560 if (chunk_size > 0): |
561 script_cmd.append("--run-chunk=%d:%d" % (chunk_num, chunk_size)) | 561 script_cmd.append("--run-chunk=%d:%d" % (chunk_num, chunk_size)) |
562 if len(self._args): | 562 if len(self._args): |
563 # if the arg is a txt file, then treat it as a list of tests | 563 # if the arg is a txt file, then treat it as a list of tests |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 | 776 |
777 for t in options.test: | 777 for t in options.test: |
778 tests = ChromeTests(options, args, t) | 778 tests = ChromeTests(options, args, t) |
779 ret = tests.Run() | 779 ret = tests.Run() |
780 if ret: return ret | 780 if ret: return ret |
781 return 0 | 781 return 0 |
782 | 782 |
783 | 783 |
784 if __name__ == "__main__": | 784 if __name__ == "__main__": |
785 sys.exit(_main()) | 785 sys.exit(_main()) |
OLD | NEW |