Index: tools/testing/dart/test_suite.dart |
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart |
index e6a8e3ab02ed372a7379393878b694e0ef7e9cac..c95ad9474769c884a7247c645d7d18700adbd2d6 100644 |
--- a/tools/testing/dart/test_suite.dart |
+++ b/tools/testing/dart/test_suite.dart |
@@ -415,30 +415,6 @@ abstract class TestSuite { |
return createGeneratedTestDirectoryHelper( |
"pub_package_builds", 'public_packages', directoryOfPubspecYaml, ""); |
} |
- |
- /** |
- * Helper function for discovering the packages in the dart repository. |
- */ |
- Future<List> listDir(Path path, Function isValid) { |
- var dir = new Directory(path.toNativePath()); |
- return dir.exists().then((exists) { |
- if (!exists) return []; |
- return dir |
- .list(recursive: false) |
- .where((fse) => fse is Directory) |
- .map((FileSystemEntity entity) { |
- var directory = entity as Directory; |
- var fullPath = directory.absolute.path; |
- var packageName = new Path(fullPath).filename; |
- if (isValid(packageName)) { |
- return [packageName, path.append(packageName).toNativePath()]; |
- } |
- return null; |
- }) |
- .where((name) => name != null) |
- .toList(); |
- }); |
- } |
} |
Future<Iterable<String>> ccTestLister(String runnerPath) { |
@@ -450,7 +426,7 @@ Future<Iterable<String>> ccTestLister(String runnerPath) { |
return result.stdout |
.split('\n') |
.map((line) => line.trim()) |
- .where((name) => name.length > 0); |
+ .where((name) => name.isNotEmpty); |
}); |
} |
@@ -576,7 +552,7 @@ class StandardTestSuite extends TestSuite { |
final Path dartDir; |
Predicate<String> isTestFilePredicate; |
final bool listRecursively; |
- final extraVmOptions; |
+ final List<String> extraVmOptions; |
List<Uri> _dart2JsBootstrapDependencies; |
StandardTestSuite(Map configuration, String suiteName, Path suiteDirectory, |
@@ -666,7 +642,7 @@ class StandardTestSuite extends TestSuite { |
// Check if we have already found and generated the tests for this suite. |
if (!testCache.containsKey(suiteName)) { |
- cachedTests = testCache[suiteName] = []; |
+ cachedTests = testCache[suiteName] = <TestInformation>[]; |
await enqueueTests(); |
} else { |
for (var info in testCache[suiteName]) { |
@@ -850,10 +826,10 @@ class StandardTestSuite extends TestSuite { |
List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile); |
assert(!vmOptionsList.isEmpty); |
- for (var vmOptionsVarient = 0; |
- vmOptionsVarient < vmOptionsList.length; |
- vmOptionsVarient++) { |
- var vmOptions = vmOptionsList[vmOptionsVarient]; |
+ for (var vmOptionsVariant = 0; |
+ vmOptionsVariant < vmOptionsList.length; |
+ vmOptionsVariant++) { |
+ var vmOptions = vmOptionsList[vmOptionsVariant]; |
var allVmOptions = vmOptions; |
if (!extraVmOptions.isEmpty) { |
allVmOptions = new List.from(vmOptions)..addAll(extraVmOptions); |
@@ -861,7 +837,7 @@ class StandardTestSuite extends TestSuite { |
var commands = baseCommands.toList(); |
commands.addAll( |
- makeCommands(info, vmOptionsVarient, allVmOptions, commonArguments)); |
+ makeCommands(info, vmOptionsVariant, allVmOptions, commonArguments)); |
enqueueNewTestCase(new TestCase( |
'$suiteName/$testName', commands, configuration, expectations, |
isNegative: isNegative(info), info: info)); |
@@ -882,14 +858,13 @@ class StandardTestSuite extends TestSuite { |
return negative; |
} |
- List<Command> makeCommands( |
- TestInformation info, int vmOptionsVarient, var vmOptions, var args) { |
- List<Command> commands = <Command>[]; |
- CompilerConfiguration compilerConfiguration = |
- new CompilerConfiguration(configuration); |
+ List<Command> makeCommands(TestInformation info, int vmOptionsVarient, |
+ List<String> vmOptions, List<String> args) { |
+ var commands = <Command>[]; |
+ var compilerConfiguration = new CompilerConfiguration(configuration); |
List<String> sharedOptions = info.optionsFromFile['sharedOptions']; |
- List<String> compileTimeArguments = <String>[]; |
+ var compileTimeArguments = <String>[]; |
String tempDir; |
if (compilerConfiguration.hasCompiler) { |
compileTimeArguments = compilerConfiguration.computeCompilerArguments( |
@@ -903,9 +878,9 @@ class StandardTestSuite extends TestSuite { |
tempDir = createCompilationOutputDirectory(path); |
List<String> otherResources = info.optionsFromFile['otherResources']; |
- for (String name in otherResources) { |
- Path namePath = new Path(name); |
- Path fromPath = info.filePath.directoryPath.join(namePath); |
+ for (var name in otherResources) { |
+ var namePath = new Path(name); |
+ var fromPath = info.filePath.directoryPath.join(namePath); |
new File('$tempDir/$name').parent.createSync(recursive: true); |
new File(fromPath.toNativePath()).copySync('$tempDir/$name'); |
} |
@@ -1044,8 +1019,14 @@ class StandardTestSuite extends TestSuite { |
* subTestName, Set<String>> if we are running a browser multi-test (one |
* compilation and many browser runs). |
*/ |
- void enqueueBrowserTest(List<Command> baseCommands, Path packageRoot, |
- Path packages, TestInformation info, String testName, expectations) { |
+ void enqueueBrowserTest( |
+ List<Command> baseCommands, |
+ Path packageRoot, |
+ Path packages, |
+ TestInformation info, |
+ String testName, |
+ /* Set<Expectation> | Map<String, Set<Expectation>> */ dynamic |
+ expectations) { |
RegExp badChars = new RegExp('[-=/]'); |
List VmOptionsList = getVmOptions(info.optionsFromFile); |
bool multipleOptions = VmOptionsList.length > 1; |
@@ -1064,7 +1045,7 @@ class StandardTestSuite extends TestSuite { |
Path packages, |
TestInformation info, |
String testName, |
- expectations, |
+ /* Set<Expectation> | Map<String, Set<Expectation>> */ expectations, |
List<String> vmOptions, |
String tempDir) { |
// TODO(Issue 14651): If we're on dartium, we need to pass [packageRoot] |
@@ -1241,8 +1222,8 @@ class StandardTestSuite extends TestSuite { |
} |
} |
- void enqueueHtmlTest( |
- HtmlTestInformation info, String testName, expectations) { |
+ void enqueueHtmlTest(HtmlTestInformation info, String testName, |
+ Set<Expectation> expectations) { |
final String compiler = configuration['compiler']; |
final String runtime = configuration['runtime']; |
// Html tests work only with the browser controller. |
@@ -1255,7 +1236,7 @@ class StandardTestSuite extends TestSuite { |
final String tempDir = createOutputDirectory(filePath, ''); |
final Uri tempUri = new Uri.file('$tempDir/'); |
String contents = htmlTest.getContents(info, compileToJS); |
- final commands = []; |
+ final commands = <Command>[]; |
void Fail(String message) { |
var msg = "$message: ${info.filePath}"; |
@@ -1310,7 +1291,7 @@ class StandardTestSuite extends TestSuite { |
/** Helper to create a compilation command for a single input file. */ |
Command _compileCommand(String inputFile, String outputFile, String compiler, |
- String dir, optionsFromFile) { |
+ String dir, Map optionsFromFile) { |
assert(compiler == 'dart2js'); |
List<String> args; |
if (compilerPath.endsWith('.dart')) { |
@@ -1339,7 +1320,7 @@ class StandardTestSuite extends TestSuite { |
/** Helper to create a Polymer deploy command for a single HTML file. */ |
Command _polymerDeployCommand( |
- String inputFile, String outputDir, optionsFromFile) { |
+ String inputFile, String outputDir, Map optionsFromFile) { |
List<String> args = []; |
String packages = packagesArgument( |
optionsFromFile['packageRoot'], optionsFromFile['packages']); |
@@ -1527,7 +1508,7 @@ class StandardTestSuite extends TestSuite { |
bytes = null; |
// Find the options in the file. |
- List<List> result = new List<List>(); |
+ var result = <List<String>>[]; |
List<String> dartOptions; |
List<String> sharedOptions; |
String packageRoot; |
@@ -1665,8 +1646,7 @@ class StandardTestSuite extends TestSuite { |
var needsVmOptions = COMPILERS.contains(configuration['compiler']) && |
RUNTIMES.contains(configuration['runtime']); |
if (!needsVmOptions) return [[]]; |
- final vmOptions = optionsFromFile['vmOptions']; |
- return vmOptions; |
+ return optionsFromFile['vmOptions']; |
} |
/** |
@@ -1720,8 +1700,14 @@ class PKGTestSuite extends StandardTestSuite { |
isTestFilePredicate: (f) => f.endsWith('_test.dart'), |
recursive: true); |
- void enqueueBrowserTest(List<Command> baseCommands, Path packageRoot, |
- packages, TestInformation info, String testName, expectations) { |
+ void enqueueBrowserTest( |
+ List<Command> baseCommands, |
+ Path packageRoot, |
+ packages, |
+ TestInformation info, |
+ String testName, |
+ /* Set<Expectation> | Map<String, Set<Expectation>> */ dynamic |
+ expectations) { |
String runtime = configuration['runtime']; |
Path filePath = info.filePath; |
Path dir = filePath.directoryPath; |
@@ -1733,7 +1719,7 @@ class PKGTestSuite extends StandardTestSuite { |
baseCommands, packageRoot, packages, info, testName, expectations); |
} else { |
Path relativeHtml = customHtmlPath.relativeTo(TestUtils.dartDir); |
- List<Command> commands = []..addAll(baseCommands); |
+ var commands = baseCommands.toList(); |
var fullPath = _createUrlPathFromFile(customHtmlPath); |
commands.add(CommandBuilder.instance.getBrowserTestCommand( |
@@ -1855,7 +1841,7 @@ class TestUtils { |
* Any script using TestUtils must set dartDirUri to a file:// URI |
* pointing to the root of the Dart checkout. |
*/ |
- static setDartDirUri(uri) { |
+ static void setDartDirUri(Uri uri) { |
dartDirUri = uri; |
dartDir = new Path(uri.toFilePath()); |
} |
@@ -1952,7 +1938,7 @@ class TestUtils { |
} |
} |
- static deleteTempSnapshotDirectory(Map configuration) { |
+ static void deleteTempSnapshotDirectory(Map configuration) { |
if (configuration['compiler'] == 'dart2app' || |
configuration['compiler'] == 'dart2appjit' || |
configuration['compiler'] == 'precompiler') { |
@@ -2091,7 +2077,7 @@ class TestUtils { |
// is an X in front of the arch. We don't allow both a cross compiled |
// and a normal version to be present (except if you specifically pass |
// in the build_directory). |
- var mode; |
+ String mode; |
switch (configuration['mode']) { |
case 'debug': |
mode = 'Debug'; |
@@ -2105,7 +2091,7 @@ class TestUtils { |
default: |
throw 'Unrecognized mode configuration: ${configuration['mode']}'; |
} |
- var os; |
+ String os; |
switch (configuration['system']) { |
case 'android': |
os = 'Android'; |