Chromium Code Reviews| 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 473 args = new List.from(args); | 473 args = new List.from(args); |
| 474 String tempDir = createOutputDirectory(info.filePath, ''); | 474 String tempDir = createOutputDirectory(info.filePath, ''); |
| 475 args.add('--out=$tempDir/out.js'); | 475 args.add('--out=$tempDir/out.js'); |
| 476 List<Command> commands = <Command>[new Command(shellPath(), args)]; | 476 List<Command> commands = <Command>[new Command(shellPath(), args)]; |
| 477 if (info.hasCompileError) { | 477 if (info.hasCompileError) { |
| 478 // Do not attempt to run the compiled result. A compilation | 478 // Do not attempt to run the compiled result. A compilation |
| 479 // error should be reported by the compilation command. | 479 // error should be reported by the compilation command. |
| 480 } else if (configuration['runtime'] == 'd8') { | 480 } else if (configuration['runtime'] == 'd8') { |
| 481 var d8 = TestUtils.d8FileName(configuration); | 481 var d8 = TestUtils.d8FileName(configuration); |
| 482 commands.add(new Command(d8, ['$tempDir/out.js'])); | 482 commands.add(new Command(d8, ['$tempDir/out.js'])); |
| 483 } else if (configuration['runtime'] == 'jsshell') { | |
| 484 var jsshell = TestUtils.jsshellFileName(configuration); | |
| 485 var environment = TestUtils.jsshellEnvironment(configuration); | |
| 486 commands.add(new Command(jsshell, ['$tempDir/out.js'], environment)); | |
| 483 } | 487 } |
| 484 return commands; | 488 return commands; |
| 485 | 489 |
| 486 case 'dart2dart': | 490 case 'dart2dart': |
| 487 var compilerArguments = new List.from(args); | 491 var compilerArguments = new List.from(args); |
| 488 var additionalFlags = | 492 var additionalFlags = |
| 489 configuration['additional-compiler-flags'].split(' '); | 493 configuration['additional-compiler-flags'].split(' '); |
| 490 for (final flag in additionalFlags) { | 494 for (final flag in additionalFlags) { |
| 491 if (flag.isEmpty()) continue; | 495 if (flag.isEmpty()) continue; |
| 492 compilerArguments.add(flag); | 496 compilerArguments.add(flag); |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1298 static Future copyFile(Path source, Path dest) { | 1302 static Future copyFile(Path source, Path dest) { |
| 1299 var output = new File.fromPath(dest).openOutputStream(); | 1303 var output = new File.fromPath(dest).openOutputStream(); |
| 1300 new File.fromPath(source).openInputStream().pipe(output); | 1304 new File.fromPath(source).openInputStream().pipe(output); |
| 1301 var completer = new Completer(); | 1305 var completer = new Completer(); |
| 1302 output.onClosed = (){ completer.complete(null); }; | 1306 output.onClosed = (){ completer.complete(null); }; |
| 1303 return completer.future; | 1307 return completer.future; |
| 1304 } | 1308 } |
| 1305 | 1309 |
| 1306 static String executableSuffix(String executable) { | 1310 static String executableSuffix(String executable) { |
| 1307 if (Platform.operatingSystem == 'windows') { | 1311 if (Platform.operatingSystem == 'windows') { |
| 1308 if (executable == 'd8' || executable == 'vm' || executable == 'none') { | 1312 if (executable == 'd8' || |
| 1313 executable == 'vm' || | |
| 1314 executable == 'none' || | |
| 1315 executable == 'jsshell') { | |
| 1309 return '.exe'; | 1316 return '.exe'; |
| 1310 } else { | 1317 } else { |
| 1311 return '.bat'; | 1318 return '.bat'; |
| 1312 } | 1319 } |
| 1313 } | 1320 } |
| 1314 return ''; | 1321 return ''; |
| 1315 } | 1322 } |
| 1316 | 1323 |
| 1317 static String executableName(Map configuration) { | 1324 static String executableName(Map configuration) { |
| 1318 String suffix = executableSuffix(configuration['compiler']); | 1325 String suffix = executableSuffix(configuration['compiler']); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1429 args.add('--enable-checked-mode'); | 1436 args.add('--enable-checked-mode'); |
| 1430 } | 1437 } |
| 1431 // args.add("--verbose"); | 1438 // args.add("--verbose"); |
| 1432 if (!isBrowserRuntime(configuration['runtime'])) { | 1439 if (!isBrowserRuntime(configuration['runtime'])) { |
| 1433 args.add("--allow-mock-compilation"); | 1440 args.add("--allow-mock-compilation"); |
| 1434 } | 1441 } |
| 1435 } | 1442 } |
| 1436 return args; | 1443 return args; |
| 1437 } | 1444 } |
| 1438 | 1445 |
| 1446 static String jsshellDir(Map configuration) { | |
| 1447 return 'third_party/firefox_jsshell/${configuration['system']}'; | |
|
Mads Ager (google)
2012/10/04 11:33:35
You should make this relative to dartDir which wil
ricow1
2012/10/04 12:02:05
We don't do this for d8 or for dart2js, but done
| |
| 1448 } | |
| 1449 | |
| 1450 static String jsshellFileName(Map configuration) { | |
| 1451 var executableSuffix = executableSuffix('jsshell'); | |
| 1452 var executable = 'js$executableSuffix'; | |
| 1453 var jsshellDir = jsshellDir(configuration); | |
| 1454 return '$jsshellDir/$executable'; | |
| 1455 } | |
| 1456 | |
| 1457 static Map<String, String> jsshellEnvironment(Map configuration) { | |
| 1458 if (configuration['system'] == 'linux') { | |
|
Mads Ager (google)
2012/10/04 11:33:35
Do you only need to add something for linux? Does
ricow1
2012/10/04 12:02:05
On windows this worked and as discussed offline th
| |
| 1459 var jsshellDir = jsshellDir(configuration); | |
| 1460 return {'LD_LIBRARY_PATH': jsshellDir}; | |
| 1461 } | |
| 1462 return {}; | |
| 1463 } | |
| 1464 | |
| 1439 static bool isBrowserRuntime(String runtime) => Contains( | 1465 static bool isBrowserRuntime(String runtime) => Contains( |
| 1440 runtime, | 1466 runtime, |
| 1441 const <String>['drt', | 1467 const <String>['drt', |
| 1442 'dartium', | 1468 'dartium', |
| 1443 'ie', | 1469 'ie', |
| 1444 'safari', | 1470 'safari', |
| 1445 'opera', | 1471 'opera', |
| 1446 'chrome', | 1472 'chrome', |
| 1447 'ff']); | 1473 'ff']); |
| 1474 | |
| 1475 static bool isCommandLineRuntime(String runtime) => | |
|
ahe
2012/10/04 13:12:26
isJsCommandLineRuntime?
ricow1
2012/10/04 13:19:42
Done.
| |
| 1476 Contains(runtime, const <String>['d8', 'jsshell']); | |
| 1477 | |
| 1448 } | 1478 } |
| 1449 | 1479 |
| 1450 class SummaryReport { | 1480 class SummaryReport { |
| 1451 static int total = 0; | 1481 static int total = 0; |
| 1452 static int skipped = 0; | 1482 static int skipped = 0; |
| 1453 static int noCrash = 0; | 1483 static int noCrash = 0; |
| 1454 static int pass = 0; | 1484 static int pass = 0; |
| 1455 static int failOk = 0; | 1485 static int failOk = 0; |
| 1456 static int fail = 0; | 1486 static int fail = 0; |
| 1457 static int crash = 0; | 1487 static int crash = 0; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1491 * $noCrash tests are expected to be flaky but not crash | 1521 * $noCrash tests are expected to be flaky but not crash |
| 1492 * $pass tests are expected to pass | 1522 * $pass tests are expected to pass |
| 1493 * $failOk tests are expected to fail that we won't fix | 1523 * $failOk tests are expected to fail that we won't fix |
| 1494 * $fail tests are expected to fail that we should fix | 1524 * $fail tests are expected to fail that we should fix |
| 1495 * $crash tests are expected to crash that we should fix | 1525 * $crash tests are expected to crash that we should fix |
| 1496 * $timeout tests are allowed to timeout | 1526 * $timeout tests are allowed to timeout |
| 1497 """; | 1527 """; |
| 1498 print(report); | 1528 print(report); |
| 1499 } | 1529 } |
| 1500 } | 1530 } |
| OLD | NEW |