| 6 | |
| 7 | The code for new-run-webkit-tests lives in Tools/Scripts/webkitpy/layout_tests (although it has dependencies on a few other webkitpy packages). |
| 8 | |
| 9 | There are four major parts to the code: |
| 10 | |
| 11 | * The port/ package, which encapsulates all of the logic that is either port-specific (to apple mac, chromium, gtk, etc.) or abstracts over stuff that *might* need to be customized, even if no one does it today. |
| 12 | |
| 13 | * The models/ package, which captures the major data structures used during the layout tests |
| 14 | |
| 15 | * The controllers/ package, which captures the basic control flow of a test run |
| 16 | |
| 17 | * The layout_package/ and views/ packages, which are responsible for updating the logs, the output a console while running the test, and formatting the results for the dashboards. |
| 18 | |
| 19 | == Data Models == |
| 20 | |
| 21 | The TestExpectations object contains an in-memory representation of all of the entries in the various TestExpectations files |
| 22 | |
| 23 | The test_run_results.RunDetails object is a plain data object containing: |
| 24 | * the results of the initial full run of tests (as a TestRunResults object) |
| 25 | * the results of any retried tests (another TestRunResults object) |
| 26 | * a summary of the combined results from both runs (as a plain python dictionary) |
| 27 | * the port-specific exit status corresponding to the summarized results |
| 28 | |
| 29 | Each TestRunResults object is a list of TestResults (one for each test run) plus a bunch of aggregated statistics |
| 30 | |
| 31 | Each TestResult contains a list of computed failure types (TestFailures, like text mismatch, image mismatch, crash) for each test as well as some statistics, but does not contain the actual output (i.e., the DriverOutput) from each test; that data is discarded except when failures occur, in which case the DriverOutput is written to the filesystem. |
| 32 | |
| 33 | == Control flow == |
| 34 | |
| 35 | The main run_webkit_tests.py parses the command line otpions and performs some setup (determining which Port object to use, and setting up a Printer to control output and logging), and then creates a Manager object to actually find and run the tests. Once the tests are run, we print the results on stdout as necessary and upload them to the dashboards if so desired. |
| 36 | |
| 37 | The Manager creates a LayoutTestFinder to handle the complex logic of figuring out which tests to run, and a LayoutTestRunner to actually run the tests. The manager is also responsible for handling the retries and computing the RunDetails. |
| 38 | |
| 39 | The LayoutTestRunner implements the multiprocess manager/worker-queue model used to run tests in parallel. All of the tests are turned into TestInput objects and written to a shared queue. The N child processes read from the queue, and run each test using a SingleTestRunner instance. the SingleTestRunner is responsible for actually executing the test (by talking to a Driver object obtained from a port, which talks to DumpRenderTree/WebKitTestRunner/content_shell) and examining the output. The results of examining the output are turned into a TestResults object. When there are failures, they are written to disk using a TestResultWriter. |
| 40 | |
| 41 | |
| 42 | |