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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 def TestSyncIntegration(self): | 505 def TestSyncIntegration(self): |
506 return self.SimpleTest("chrome", "sync_integration_tests", | 506 return self.SimpleTest("chrome", "sync_integration_tests", |
507 valgrind_test_args=self.UI_VALGRIND_ARGS, | 507 valgrind_test_args=self.UI_VALGRIND_ARGS, |
508 cmd_args=(["--ui-test-action-max-timeout=450000"])) | 508 cmd_args=(["--ui-test-action-max-timeout=450000"])) |
509 | 509 |
510 def TestLayoutChunk(self, chunk_num, chunk_size): | 510 def TestLayoutChunk(self, chunk_num, chunk_size): |
511 # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the | 511 # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the |
512 # list of tests. Wrap around to beginning of list at end. | 512 # list of tests. Wrap around to beginning of list at end. |
513 # If chunk_size is zero, run all tests in the list once. | 513 # If chunk_size is zero, run all tests in the list once. |
514 # If a text file is given as argument, it is used as the list of tests. | 514 # If a text file is given as argument, it is used as the list of tests. |
515 # | 515 assert((chunk_size == 0) != (len(self._args) == 0)) |
Timur Iskhodzhanov
2014/08/05 09:28:01
This is gonna fire if you pass contradictory flags
Lei Zhang
2014/08/06 01:53:07
This only asserts if you pass "-n 0" without addit
| |
516 # Build the ginormous commandline in 'cmd'. | 516 # Build the ginormous commandline in 'cmd'. |
517 # It's going to be roughly | 517 # It's going to be roughly |
518 # python valgrind_test.py ... python run_webkit_tests.py ... | 518 # python valgrind_test.py ... python run_webkit_tests.py ... |
519 # but we'll use the --indirect flag to valgrind_test.py | 519 # but we'll use the --indirect flag to valgrind_test.py |
520 # to avoid valgrinding python. | 520 # to avoid valgrinding python. |
521 # Start by building the valgrind_test.py commandline. | 521 # Start by building the valgrind_test.py commandline. |
522 tool = valgrind_test.CreateTool(self._options.valgrind_tool) | 522 tool = valgrind_test.CreateTool(self._options.valgrind_tool) |
523 cmd = self._DefaultCommand(tool) | 523 cmd = self._DefaultCommand(tool) |
524 cmd.append("--trace_children") | 524 cmd.append("--trace_children") |
525 cmd.append("--indirect_webkit_layout") | 525 cmd.append("--indirect_webkit_layout") |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 | 585 |
586 | 586 |
587 def TestLayout(self): | 587 def TestLayout(self): |
588 # A "chunk file" is maintained in the local directory so that each test | 588 # A "chunk file" is maintained in the local directory so that each test |
589 # runs a slice of the layout tests of size chunk_size that increments with | 589 # runs a slice of the layout tests of size chunk_size that increments with |
590 # each run. Since tests can be added and removed from the layout tests at | 590 # each run. Since tests can be added and removed from the layout tests at |
591 # any time, this is not going to give exact coverage, but it will allow us | 591 # any time, this is not going to give exact coverage, but it will allow us |
592 # to continuously run small slices of the layout tests under valgrind rather | 592 # to continuously run small slices of the layout tests under valgrind rather |
593 # than having to run all of them in one shot. | 593 # than having to run all of them in one shot. |
594 chunk_size = self._options.num_tests | 594 chunk_size = self._options.num_tests |
595 if (chunk_size == 0): | 595 if chunk_size == 0 or len(self._args): |
596 return self.TestLayoutChunk(0, 0) | 596 return self.TestLayoutChunk(0, 0) |
597 chunk_num = 0 | 597 chunk_num = 0 |
598 chunk_file = os.path.join("valgrind_layout_chunk.txt") | 598 chunk_file = os.path.join("valgrind_layout_chunk.txt") |
599 logging.info("Reading state from " + chunk_file) | 599 logging.info("Reading state from " + chunk_file) |
600 try: | 600 try: |
601 f = open(chunk_file) | 601 f = open(chunk_file) |
602 if f: | 602 if f: |
603 chunk_str = f.read() | 603 chunk_str = f.read() |
604 if len(chunk_str): | 604 if len(chunk_str): |
605 chunk_num = int(chunk_str) | 605 chunk_num = int(chunk_str) |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
781 | 781 |
782 for t in options.test: | 782 for t in options.test: |
783 tests = ChromeTests(options, args, t) | 783 tests = ChromeTests(options, args, t) |
784 ret = tests.Run() | 784 ret = tests.Run() |
785 if ret: return ret | 785 if ret: return ret |
786 return 0 | 786 return 0 |
787 | 787 |
788 | 788 |
789 if __name__ == "__main__": | 789 if __name__ == "__main__": |
790 sys.exit(_main()) | 790 sys.exit(_main()) |
OLD | NEW |