Chromium Code Reviews| Index: tools/testing/dart/test_suite.dart |
| =================================================================== |
| --- tools/testing/dart/test_suite.dart (revision 12653) |
| +++ tools/testing/dart/test_suite.dart (working copy) |
| @@ -428,9 +428,23 @@ |
| List<List<String>> vmOptionsList = getVmOptions(info.optionsFromFile); |
| Expect.isFalse(vmOptionsList.isEmpty(), "empty vmOptionsList"); |
| + |
| + // Check for an "ExtraCommand" comment from the file, and generate |
| + // a command for it, if needed. |
| + var optionsFromFile = info.optionsFromFile; |
| + var commands = []; |
| + var command = optionsFromFile['extraCommand']; |
| + var args = optionsFromFile['extraCommandArgs']; |
| + if (command != null) { |
| + commands.add(new Command(command, args)); |
| + } |
| + |
| + List _append(list1,list2) => []..addAll(list1)..addAll(list2); |
|
Emily Fortuna
2012/09/20 23:07:19
woohoo! real-life use of method cascades!
Is ther
Alan Knight
2012/09/20 23:29:59
It's called in one place, but inside a loop, so I
|
| + |
| for (var vmOptions in vmOptionsList) { |
| doTest(new TestCase('$suiteName/$testName', |
| - makeCommands(info, vmOptions, commonArguments), |
| + _append(commands, |
| + makeCommands(info, vmOptions, commonArguments)), |
| configuration, |
| completeHandler, |
| expectations, |
| @@ -665,6 +679,17 @@ |
| } |
| } |
| + var extraCommand = optionsFromFile['extraCommand']; |
| + if (extraCommand != null) { |
| + var args = optionsFromFile['extraCommandArgs']; |
| + // As a special case, a command of "dart" should run with the same |
| + // dart executable that we are using. |
| + if (extraCommand == 'dart') { |
| + extraCommand = new Options().executable; |
| + } |
| + commands.add(new Command(extraCommand, args)); |
| + } |
| + |
| // Construct the command that executes the browser test |
| List<String> args; |
| if (runtime == 'ie' || runtime == 'ff' || runtime == 'chrome' || |
| @@ -942,6 +967,10 @@ |
| const RegExp(@"^#library\(", multiLine: true); |
| RegExp sourceOrImportRegExp = |
| const RegExp(@"^#(source|import|resource)\(", multiLine: true); |
| + RegExp extraCommandRegExp = |
| + const RegExp(@"// ExtraCommand=(.*)", multiLine: true); |
| + RegExp extraArgsRegExp = |
| + const RegExp(@"// ExtraCommandArgs=(.*)", multiLine: true); |
| // Read the entire file into a byte buffer and transform it to a |
| // String. This will treat the file as ascii but the only parts |
| @@ -977,6 +1006,11 @@ |
| dartOptions = match[1].split(' ').filter((e) => e != ''); |
| } |
| + var match = extraCommandRegExp.firstMatch(contents); |
| + var extraCommand = (match != null) ? match.group(1) : null; |
| + match = extraArgsRegExp.firstMatch(contents); |
| + var extraCommandArgs = (match != null) ? match.group(1).split(' ') : []; |
| + |
| matches = staticCleanRegExp.allMatches(contents); |
| for (var match in matches) { |
| if (isStaticClean) { |
| @@ -1028,7 +1062,9 @@ |
| "isLibraryDefinition": isLibraryDefinition, |
| "containsSourceOrImport": containsSourceOrImport, |
| "numStaticTypeAnnotations": numStaticTypeAnnotations, |
| - "numCompileTimeAnnotations": numCompileTimeAnnotations}; |
| + "numCompileTimeAnnotations": numCompileTimeAnnotations, |
| + "extraCommand": extraCommand, |
| + "extraCommandArgs": extraCommandArgs}; |
| } |
| List<List<String>> getVmOptions(Map optionsFromFile) { |