| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 * Classes and methods for enumerating and preparing tests. | 6 * Classes and methods for enumerating and preparing tests. |
| 7 * | 7 * |
| 8 * This library includes: | 8 * This library includes: |
| 9 * | 9 * |
| 10 * - Creating tests by listing all the Dart files in certain directories, | 10 * - Creating tests by listing all the Dart files in certain directories, |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } | 268 } |
| 269 | 269 |
| 270 bool listRecursively() => false; | 270 bool listRecursively() => false; |
| 271 | 271 |
| 272 String shellPath() => TestUtils.dartShellFileName(configuration); | 272 String shellPath() => TestUtils.dartShellFileName(configuration); |
| 273 | 273 |
| 274 List<String> additionalOptions(String filename) => []; | 274 List<String> additionalOptions(String filename) => []; |
| 275 | 275 |
| 276 void forEachTest(Function onTest, Map testCache, String globalTempDir(), | 276 void forEachTest(Function onTest, Map testCache, String globalTempDir(), |
| 277 [Function onDone = null]) { | 277 [Function onDone = null]) { |
| 278 // If DumpRenderTree is required, and not yet updated, wait for update. | 278 // If DumpRenderTree/Dartium is required, and not yet updated, |
| 279 if (configuration['runtime'] == 'drt' && !DumpRenderTreeUpdater.updated) { | 279 // wait for update. |
| 280 Expect.isTrue(DumpRenderTreeUpdater.isActive); | 280 var updater = runtimeUpdater(configuration['runtime']); |
| 281 DumpRenderTreeUpdater.onUpdated.add(() { | 281 if (updater !== null && !updater.updated) { |
| 282 Expect.isTrue(updater.isActive); |
| 283 updater.onUpdated.add(() { |
| 282 forEachTest(onTest, testCache, globalTempDir, onDone); | 284 forEachTest(onTest, testCache, globalTempDir, onDone); |
| 283 }); | 285 }); |
| 284 return; | 286 return; |
| 285 } | 287 } |
| 286 | 288 |
| 287 doTest = onTest; | 289 doTest = onTest; |
| 288 doDone = (onDone != null) ? onDone : (() => null); | 290 doDone = (onDone != null) ? onDone : (() => null); |
| 289 globalTemporaryDirectory = globalTempDir; | 291 globalTemporaryDirectory = globalTempDir; |
| 290 | 292 |
| 291 var filesRead = 0; | 293 var filesRead = 0; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 // TODO(efortuna): this shortening of htmlFilename is a band-aid until | 553 // TODO(efortuna): this shortening of htmlFilename is a band-aid until |
| 552 // the above TODO gets fixed. Windows cannot have paths that are longer | 554 // the above TODO gets fixed. Windows cannot have paths that are longer |
| 553 // than 260 characters, and without this hack, we were running past the | 555 // than 260 characters, and without this hack, we were running past the |
| 554 // the limit. | 556 // the limit. |
| 555 String htmlFilename = getHtmlName(filename); | 557 String htmlFilename = getHtmlName(filename); |
| 556 while ('${tempDir.path}/../$htmlFilename'.length >= 260) { | 558 while ('${tempDir.path}/../$htmlFilename'.length >= 260) { |
| 557 htmlFilename = htmlFilename.substring(htmlFilename.length~/2); | 559 htmlFilename = htmlFilename.substring(htmlFilename.length~/2); |
| 558 } | 560 } |
| 559 htmlPath = '${tempDir.path}/../$htmlFilename'; | 561 htmlPath = '${tempDir.path}/../$htmlFilename'; |
| 560 } | 562 } |
| 561 final String scriptPath = (compiler == 'none' && runtime == 'drt') ? | 563 final String scriptPath = (compiler == 'none') ? |
| 562 dartWrapperFilename : compiledDartWrapperFilename; | 564 dartWrapperFilename : compiledDartWrapperFilename; |
| 563 // Create the HTML file for the test. | 565 // Create the HTML file for the test. |
| 564 RandomAccessFile htmlTest = new File(htmlPath).openSync(FileMode.WRITE); | 566 RandomAccessFile htmlTest = new File(htmlPath).openSync(FileMode.WRITE); |
| 565 String filePrefix = ''; | 567 String filePrefix = ''; |
| 566 if (new Platform().operatingSystem() == 'windows') { | 568 if (new Platform().operatingSystem() == 'windows') { |
| 567 // Firefox on Windows does not like absolute file path names that start | 569 // Firefox on Windows does not like absolute file path names that start |
| 568 // with 'C:' adding 'file:///' solves the problem. | 570 // with 'C:' adding 'file:///' solves the problem. |
| 569 filePrefix = 'file:///'; | 571 filePrefix = 'file:///'; |
| 570 } | 572 } |
| 571 htmlTest.writeStringSync(GetHtmlContents( | 573 htmlTest.writeStringSync(GetHtmlContents( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 602 String compiledName = '${name.substring(0, end)}.js'; | 604 String compiledName = '${name.substring(0, end)}.js'; |
| 603 commands.add(_compileCommand( | 605 commands.add(_compileCommand( |
| 604 '$dir/$name', '${tempDir.path}/$compiledName', | 606 '$dir/$name', '${tempDir.path}/$compiledName', |
| 605 compiler, tempDir.path, vmOptions)); | 607 compiler, tempDir.path, vmOptions)); |
| 606 } | 608 } |
| 607 } | 609 } |
| 608 | 610 |
| 609 // Construct the command that executes the browser test | 611 // Construct the command that executes the browser test |
| 610 List<String> args; | 612 List<String> args; |
| 611 if (runtime == 'ie' || runtime == 'ff' || runtime == 'chrome' || | 613 if (runtime == 'ie' || runtime == 'ff' || runtime == 'chrome' || |
| 612 runtime == 'safari' || runtime == 'opera') { | 614 runtime == 'safari' || runtime == 'opera' || runtime == 'dartium') { |
| 613 args = ['$dartDir/tools/testing/run_selenium.py', | 615 args = ['$dartDir/tools/testing/run_selenium.py', |
| 614 '--browser=$runtime', | 616 '--browser=$runtime', |
| 615 '--timeout=${configuration["timeout"] - 2}', | 617 '--timeout=${configuration["timeout"] - 2}', |
| 616 '--out=$htmlPath']; | 618 '--out=$htmlPath']; |
| 617 } else { | 619 } else { |
| 618 args = [ | 620 args = [ |
| 619 '$dartDir/tools/testing/drt-trampoline.py', | 621 '$dartDir/tools/testing/drt-trampoline.py', |
| 620 dumpRenderTreeFilename, | 622 dumpRenderTreeFilename, |
| 621 '--no-timeout' | 623 '--no-timeout' |
| 622 ]; | 624 ]; |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 } | 1294 } |
| 1293 if (configuration['runtime'] != 'drt') { | 1295 if (configuration['runtime'] != 'drt') { |
| 1294 args.add("--allow-mock-compilation"); | 1296 args.add("--allow-mock-compilation"); |
| 1295 } | 1297 } |
| 1296 } | 1298 } |
| 1297 return args; | 1299 return args; |
| 1298 } | 1300 } |
| 1299 | 1301 |
| 1300 static bool isBrowserRuntime(String runtime) => | 1302 static bool isBrowserRuntime(String runtime) => |
| 1301 const <String>['drt', | 1303 const <String>['drt', |
| 1304 'dartium', |
| 1302 'ie', | 1305 'ie', |
| 1303 'safari', | 1306 'safari', |
| 1304 'opera', | 1307 'opera', |
| 1305 'chrome', | 1308 'chrome', |
| 1306 'ff'].some((x) => x == runtime); | 1309 'ff'].some((x) => x == runtime); |
| 1307 } | 1310 } |
| 1308 | 1311 |
| 1309 class SummaryReport { | 1312 class SummaryReport { |
| 1310 static int total = 0; | 1313 static int total = 0; |
| 1311 static int skipped = 0; | 1314 static int skipped = 0; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 * $noCrash tests are expected to be flaky but not crash | 1353 * $noCrash tests are expected to be flaky but not crash |
| 1351 * $pass tests are expected to pass | 1354 * $pass tests are expected to pass |
| 1352 * $failOk tests are expected to fail that we won't fix | 1355 * $failOk tests are expected to fail that we won't fix |
| 1353 * $fail tests are expected to fail that we should fix | 1356 * $fail tests are expected to fail that we should fix |
| 1354 * $crash tests are expected to crash that we should fix | 1357 * $crash tests are expected to crash that we should fix |
| 1355 * $timeout tests are allowed to timeout | 1358 * $timeout tests are allowed to timeout |
| 1356 """; | 1359 """; |
| 1357 print(report); | 1360 print(report); |
| 1358 } | 1361 } |
| 1359 } | 1362 } |
| OLD | NEW |