| OLD | NEW |
| 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
| 3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
| 4 # | 4 # |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import platform | 7 import platform |
| 8 import re | 8 import re |
| 9 import shutil | 9 import shutil |
| 10 import subprocess | 10 import subprocess |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 DART_OPTIONS_PATTERN = re.compile(r'// DartOptions=(.*)') | 112 DART_OPTIONS_PATTERN = re.compile(r'// DartOptions=(.*)') |
| 113 | 113 |
| 114 # Pattern for checking if the test is a web test. | 114 # Pattern for checking if the test is a web test. |
| 115 DOM_IMPORT_PATTERN = re.compile(r'#import.*(dart:(dom|html)|html\.dart).*\);', | 115 DOM_IMPORT_PATTERN = re.compile(r'#import.*(dart:(dom|html)|html\.dart).*\);', |
| 116 re.MULTILINE) | 116 re.MULTILINE) |
| 117 | 117 |
| 118 # Pattern for matching the output of a browser test. | 118 # Pattern for matching the output of a browser test. |
| 119 BROWSER_OUTPUT_PASS_PATTERN = re.compile(r'^Content-Type: text/plain\nPASS$', | 119 BROWSER_OUTPUT_PASS_PATTERN = re.compile(r'^Content-Type: text/plain\nPASS$', |
| 120 re.MULTILINE) | 120 re.MULTILINE) |
| 121 | 121 |
| 122 # Pattern for matching flaky errors of browser tests. xvfb-run by default uses |
| 123 # DISPLAY=:99, we keep that in the error pattern to avoid matching real |
| 124 # errors when DISPLAY is set incorrectly. |
| 125 BROWSER_FLAKY_DISPLAY_ERR_PATTERN = re.compile( |
| 126 r'Gtk-WARNING \*\*: cannot open display: :99', re.MULTILINE) |
| 127 |
| 122 # Pattern for checking if the test is a library in itself. | 128 # Pattern for checking if the test is a library in itself. |
| 123 LIBRARY_DEFINITION_PATTERN = re.compile(r'^#library\(.*\);', | 129 LIBRARY_DEFINITION_PATTERN = re.compile(r'^#library\(.*\);', |
| 124 re.MULTILINE) | 130 re.MULTILINE) |
| 125 SOURCE_OR_IMPORT_PATTERN = re.compile(r'^#(source|import)\(.*\);', | 131 SOURCE_OR_IMPORT_PATTERN = re.compile(r'^#(source|import)\(.*\);', |
| 126 re.MULTILINE) | 132 re.MULTILINE) |
| 127 | 133 |
| 128 | 134 |
| 129 class Error(Exception): | 135 class Error(Exception): |
| 130 """Base class for exceptions in this module.""" | 136 """Base class for exceptions in this module.""" |
| 131 pass | 137 pass |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 f.close() | 290 f.close() |
| 285 | 291 |
| 286 drt_flags.append(html_output_file) | 292 drt_flags.append(html_output_file) |
| 287 | 293 |
| 288 return [drt_location] + drt_flags | 294 return [drt_location] + drt_flags |
| 289 | 295 |
| 290 def HasFailed(self, output): | 296 def HasFailed(self, output): |
| 291 """Return True if the 'PASS' result string isn't in the output.""" | 297 """Return True if the 'PASS' result string isn't in the output.""" |
| 292 return not BROWSER_OUTPUT_PASS_PATTERN.search(output) | 298 return not BROWSER_OUTPUT_PASS_PATTERN.search(output) |
| 293 | 299 |
| 300 def WasFlakyDrt(self, error): |
| 301 """Return whether the error indicates a flaky error from running. |
| 302 DumpRenderTree within xvfb-run. |
| 303 """ |
| 304 return BROWSER_FLAKY_DISPLAY_ERR_PATTERN.search(error) |
| 305 |
| 294 def RunTest(self, verbose): | 306 def RunTest(self, verbose): |
| 295 """Calls GetRunCommand() and executes the returned commandline. | 307 """Calls GetRunCommand() and executes the returned commandline. |
| 296 | 308 |
| 297 Args: | 309 Args: |
| 298 verbose: if True, print additional diagnostics to stdout. | 310 verbose: if True, print additional diagnostics to stdout. |
| 299 | 311 |
| 300 Returns: | 312 Returns: |
| 301 Return code from executable. 0 == PASS, 253 = CRASH, anything | 313 Return code from executable. 0 == PASS, 253 = CRASH, anything |
| 302 else is treated as FAIL | 314 else is treated as FAIL |
| 303 """ | 315 """ |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 return WebDriverArchitecture(root_path, arch, mode, component, test) | 575 return WebDriverArchitecture(root_path, arch, mode, component, test) |
| 564 | 576 |
| 565 elif component in ['vm', 'frog', 'frogsh']: | 577 elif component in ['vm', 'frog', 'frogsh']: |
| 566 return StandaloneArchitecture(root_path, arch, mode, component, test) | 578 return StandaloneArchitecture(root_path, arch, mode, component, test) |
| 567 | 579 |
| 568 elif component == 'leg': | 580 elif component == 'leg': |
| 569 return LegArchitecture(root_path, arch, mode, component, test) | 581 return LegArchitecture(root_path, arch, mode, component, test) |
| 570 | 582 |
| 571 elif component == 'dartc': | 583 elif component == 'dartc': |
| 572 return DartcArchitecture(root_path, arch, mode, component, test) | 584 return DartcArchitecture(root_path, arch, mode, component, test) |
| OLD | NEW |