| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 args = new List.from(args); | 462 args = new List.from(args); |
| 463 String tempDir = createOutputDirectory(info.filePath, ''); | 463 String tempDir = createOutputDirectory(info.filePath, ''); |
| 464 args.add('--out=$tempDir/out.js'); | 464 args.add('--out=$tempDir/out.js'); |
| 465 List<Command> commands = <Command>[new Command(shellPath(), args)]; | 465 List<Command> commands = <Command>[new Command(shellPath(), args)]; |
| 466 if (info.hasCompileError) { | 466 if (info.hasCompileError) { |
| 467 // Do not attempt to run the compiled result. A compilation | 467 // Do not attempt to run the compiled result. A compilation |
| 468 // error should be reported by the compilation command. | 468 // error should be reported by the compilation command. |
| 469 } else if (configuration['runtime'] == 'd8') { | 469 } else if (configuration['runtime'] == 'd8') { |
| 470 var d8 = TestUtils.d8FileName(configuration); | 470 var d8 = TestUtils.d8FileName(configuration); |
| 471 commands.add(new Command(d8, ['$tempDir/out.js'])); | 471 commands.add(new Command(d8, ['$tempDir/out.js'])); |
| 472 } else if (configuration['runtime'] == 'jsshell') { | |
| 473 var jsshell = TestUtils.jsshellFileName(configuration); | |
| 474 var environment = TestUtils.jsshellEnvironment(configuration); | |
| 475 commands.add(new Command(jsshell, ['$tempDir/out.js'], environment)); | |
| 476 } | 472 } |
| 477 return commands; | 473 return commands; |
| 478 | 474 |
| 479 case 'dart2dart': | 475 case 'dart2dart': |
| 480 var compilerArguments = new List.from(args); | 476 var compilerArguments = new List.from(args); |
| 481 var additionalFlags = | 477 var additionalFlags = |
| 482 configuration['additional-compiler-flags'].split(' '); | 478 configuration['additional-compiler-flags'].split(' '); |
| 483 for (final flag in additionalFlags) { | 479 for (final flag in additionalFlags) { |
| 484 if (flag.isEmpty()) continue; | 480 if (flag.isEmpty()) continue; |
| 485 compilerArguments.add(flag); | 481 compilerArguments.add(flag); |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 static Future copyFile(Path source, Path dest) { | 1260 static Future copyFile(Path source, Path dest) { |
| 1265 var output = new File.fromPath(dest).openOutputStream(); | 1261 var output = new File.fromPath(dest).openOutputStream(); |
| 1266 new File.fromPath(source).openInputStream().pipe(output); | 1262 new File.fromPath(source).openInputStream().pipe(output); |
| 1267 var completer = new Completer(); | 1263 var completer = new Completer(); |
| 1268 output.onClosed = (){ completer.complete(null); }; | 1264 output.onClosed = (){ completer.complete(null); }; |
| 1269 return completer.future; | 1265 return completer.future; |
| 1270 } | 1266 } |
| 1271 | 1267 |
| 1272 static String executableSuffix(String executable) { | 1268 static String executableSuffix(String executable) { |
| 1273 if (Platform.operatingSystem == 'windows') { | 1269 if (Platform.operatingSystem == 'windows') { |
| 1274 if (executable == 'd8' || | 1270 if (executable == 'd8' || executable == 'vm' || executable == 'none') { |
| 1275 executable == 'vm' || | |
| 1276 executable == 'none' || | |
| 1277 executable == 'jsshell') { | |
| 1278 return '.exe'; | 1271 return '.exe'; |
| 1279 } else { | 1272 } else { |
| 1280 return '.bat'; | 1273 return '.bat'; |
| 1281 } | 1274 } |
| 1282 } | 1275 } |
| 1283 return ''; | 1276 return ''; |
| 1284 } | 1277 } |
| 1285 | 1278 |
| 1286 static String executableName(Map configuration) { | 1279 static String executableName(Map configuration) { |
| 1287 String suffix = executableSuffix(configuration['compiler']); | 1280 String suffix = executableSuffix(configuration['compiler']); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 args.add('--enable-checked-mode'); | 1391 args.add('--enable-checked-mode'); |
| 1399 } | 1392 } |
| 1400 // args.add("--verbose"); | 1393 // args.add("--verbose"); |
| 1401 if (!isBrowserRuntime(configuration['runtime'])) { | 1394 if (!isBrowserRuntime(configuration['runtime'])) { |
| 1402 args.add("--allow-mock-compilation"); | 1395 args.add("--allow-mock-compilation"); |
| 1403 } | 1396 } |
| 1404 } | 1397 } |
| 1405 return args; | 1398 return args; |
| 1406 } | 1399 } |
| 1407 | 1400 |
| 1408 static String jsshellDir(Map configuration) { | |
| 1409 var base = dartDir(); | |
| 1410 return '$base/third_party/firefox_jsshell/${configuration['system']}'; | |
| 1411 } | |
| 1412 | |
| 1413 static String jsshellFileName(Map configuration) { | |
| 1414 var executableSuffix = executableSuffix('jsshell'); | |
| 1415 var executable = 'js$executableSuffix'; | |
| 1416 var jsshellDir = jsshellDir(configuration); | |
| 1417 return '$jsshellDir/$executable'; | |
| 1418 } | |
| 1419 | |
| 1420 static Map<String, String> jsshellEnvironment(Map configuration) { | |
| 1421 if (configuration['system'] == 'linux') { | |
| 1422 var jsshellDir = jsshellDir(configuration); | |
| 1423 return {'LD_LIBRARY_PATH': jsshellDir}; | |
| 1424 } | |
| 1425 return {}; | |
| 1426 } | |
| 1427 | |
| 1428 static bool isBrowserRuntime(String runtime) => Contains( | 1401 static bool isBrowserRuntime(String runtime) => Contains( |
| 1429 runtime, | 1402 runtime, |
| 1430 const <String>['drt', | 1403 const <String>['drt', |
| 1431 'dartium', | 1404 'dartium', |
| 1432 'ie', | 1405 'ie', |
| 1433 'safari', | 1406 'safari', |
| 1434 'opera', | 1407 'opera', |
| 1435 'chrome', | 1408 'chrome', |
| 1436 'ff']); | 1409 'ff']); |
| 1437 | |
| 1438 static bool isJsCommandLineRuntime(String runtime) => | |
| 1439 Contains(runtime, const <String>['d8', 'jsshell']); | |
| 1440 | |
| 1441 } | 1410 } |
| 1442 | 1411 |
| 1443 class SummaryReport { | 1412 class SummaryReport { |
| 1444 static int total = 0; | 1413 static int total = 0; |
| 1445 static int skipped = 0; | 1414 static int skipped = 0; |
| 1446 static int noCrash = 0; | 1415 static int noCrash = 0; |
| 1447 static int pass = 0; | 1416 static int pass = 0; |
| 1448 static int failOk = 0; | 1417 static int failOk = 0; |
| 1449 static int fail = 0; | 1418 static int fail = 0; |
| 1450 static int crash = 0; | 1419 static int crash = 0; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 * $noCrash tests are expected to be flaky but not crash | 1453 * $noCrash tests are expected to be flaky but not crash |
| 1485 * $pass tests are expected to pass | 1454 * $pass tests are expected to pass |
| 1486 * $failOk tests are expected to fail that we won't fix | 1455 * $failOk tests are expected to fail that we won't fix |
| 1487 * $fail tests are expected to fail that we should fix | 1456 * $fail tests are expected to fail that we should fix |
| 1488 * $crash tests are expected to crash that we should fix | 1457 * $crash tests are expected to crash that we should fix |
| 1489 * $timeout tests are allowed to timeout | 1458 * $timeout tests are allowed to timeout |
| 1490 """; | 1459 """; |
| 1491 print(report); | 1460 print(report); |
| 1492 } | 1461 } |
| 1493 } | 1462 } |
| OLD | NEW |