Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 # | 6 # |
| 7 | 7 |
| 8 """ | 8 """ |
| 9 Runs a Dart unit test in different configurations: dartium, chromium, ia32, x64, | 9 Runs a Dart unit test in different configurations: dartium, chromium, ia32, x64, |
| 10 arm, simarm, and dartc. Example: | 10 arm, simarm, and dartc. Example: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 if (!needsToWait) pass(); | 98 if (!needsToWait) pass(); |
| 99 mainIsFinished = true; | 99 mainIsFinished = true; |
| 100 } catch(var e, var trace) { | 100 } catch(var e, var trace) { |
| 101 fail(e, trace); | 101 fail(e, trace); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 ''' | 104 ''' |
| 105 | 105 |
| 106 | 106 |
| 107 # Patterns for matching test options in .dart files. | 107 # Patterns for matching test options in .dart files. |
| 108 VM_OPTIONS_PATTERN = re.compile(r"// VMOptions=(.*)") | |
| 109 DART_OPTIONS_PATTERN = re.compile(r"// DartOptions=(.*)") | 108 DART_OPTIONS_PATTERN = re.compile(r"// DartOptions=(.*)") |
| 110 | 109 |
| 111 # Pattern for checking if the test is a web test. | 110 # Pattern for checking if the test is a web test. |
| 112 DOM_IMPORT_PATTERN = re.compile(r"^#import.*(dart:dom|html.dart)'\);", | 111 DOM_IMPORT_PATTERN = re.compile(r"^#import.*(dart:dom|html.dart)'\);", |
| 113 re.MULTILINE) | 112 re.MULTILINE) |
| 114 | 113 |
| 115 # Pattern for matching the output of a browser test. | 114 # Pattern for matching the output of a browser test. |
| 116 BROWSER_OUTPUT_PASS_PATTERN = re.compile(r"^Content-Type: text/plain\nPASS$", | 115 BROWSER_OUTPUT_PASS_PATTERN = re.compile(r"^Content-Type: text/plain\nPASS$", |
| 117 re.MULTILINE) | 116 re.MULTILINE) |
| 118 | 117 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 139 | 138 |
| 140 | 139 |
| 141 class Architecture(object): | 140 class Architecture(object): |
| 142 def __init__(self, root_path, arch, mode, test): | 141 def __init__(self, root_path, arch, mode, test): |
| 143 self.root_path = root_path; | 142 self.root_path = root_path; |
| 144 self.arch = arch; | 143 self.arch = arch; |
| 145 self.mode = mode; | 144 self.mode = mode; |
| 146 self.test = test; | 145 self.test = test; |
| 147 self.build_root = utils.GetBuildRoot(OS_GUESS, self.mode, self.arch) | 146 self.build_root = utils.GetBuildRoot(OS_GUESS, self.mode, self.arch) |
| 148 source = file(test).read() | 147 source = file(test).read() |
| 149 self.vm_options = utils.ParseTestOptions(VM_OPTIONS_PATTERN, | 148 self.vm_options = [] |
| 150 source, | 149 self.dart_options = [] |
| 151 root_path) | |
| 152 if not self.vm_options: self.vm_options = [] | |
| 153 | |
| 154 self.dart_options = utils.ParseTestOptions(DART_OPTIONS_PATTERN, | |
| 155 source, | |
| 156 root_path) | |
| 157 self.is_web_test = IsWebTest(test, source) | 150 self.is_web_test = IsWebTest(test, source) |
| 158 self.temp_dir = None | 151 self.temp_dir = None |
| 159 | 152 |
| 160 def HasFatalTypeErrors(self): | 153 def HasFatalTypeErrors(self): |
| 161 return False | 154 return False |
| 162 | 155 |
| 163 def GetTestFrameworkPath(self): | 156 def GetTestFrameworkPath(self): |
| 164 return join(self.root_path, 'tests', 'isolate', 'src', | 157 return join(self.root_path, 'tests', 'isolate', 'src', |
| 165 'TestFramework.dart') | 158 'TestFramework.dart') |
| 166 | 159 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 else: | 366 else: |
| 374 command += ['--', test_path] | 367 command += ['--', test_path] |
| 375 | 368 |
| 376 return command | 369 return command |
| 377 | 370 |
| 378 def GetFatalTypeErrorsFlags(self): | 371 def GetFatalTypeErrorsFlags(self): |
| 379 return [] | 372 return [] |
| 380 | 373 |
| 381 def RunTest(self, verbose): | 374 def RunTest(self, verbose): |
| 382 command = self.GetRunCommand() | 375 command = self.GetRunCommand() |
| 383 return ExecuteCommand(command, verbose) | 376 return ExeuteCommand(command, verbose) |
|
Ivan Posva
2011/10/13 07:17:34
?
Søren Gjesse
2011/10/13 07:28:15
Accidental edit.
| |
| 384 | 377 |
| 385 def Cleanup(self): | 378 def Cleanup(self): |
| 386 return | 379 return |
| 387 | 380 |
| 388 | 381 |
| 389 # Long term, we should do the running machinery that is currently in | 382 # Long term, we should do the running machinery that is currently in |
| 390 # DartRunner.java | 383 # DartRunner.java |
| 391 class DartcArchitecture(StandaloneArchitecture): | 384 class DartcArchitecture(StandaloneArchitecture): |
| 392 def __init__(self, root_path, arch, mode, test): | 385 def __init__(self, root_path, arch, mode, test): |
| 393 super(DartcArchitecture, self).__init__(root_path, arch, mode, test) | 386 super(DartcArchitecture, self).__init__(root_path, arch, mode, test) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 441 return ChromiumArchitecture(root_path, arch, mode, test) | 434 return ChromiumArchitecture(root_path, arch, mode, test) |
| 442 | 435 |
| 443 elif arch == 'dartium': | 436 elif arch == 'dartium': |
| 444 return DartiumArchitecture(root_path, arch, mode, test) | 437 return DartiumArchitecture(root_path, arch, mode, test) |
| 445 | 438 |
| 446 elif arch in ['ia32', 'x64', 'simarm', 'arm']: | 439 elif arch in ['ia32', 'x64', 'simarm', 'arm']: |
| 447 return RuntimeArchitecture(root_path, arch, mode, test) | 440 return RuntimeArchitecture(root_path, arch, mode, test) |
| 448 | 441 |
| 449 elif arch == 'dartc': | 442 elif arch == 'dartc': |
| 450 return DartcArchitecture(root_path, arch, mode, test) | 443 return DartcArchitecture(root_path, arch, mode, test) |
| 451 | |
| OLD | NEW |