Chromium Code Reviews| Index: tools/testing/dart/test_suite.dart |
| diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart |
| index 6796368ca89cfd89ee2fc25f16c3e34353caca21..770aaa94abf63f825fbcdf654e92d5c604ce87a4 100644 |
| --- a/tools/testing/dart/test_suite.dart |
| +++ b/tools/testing/dart/test_suite.dart |
| @@ -310,7 +310,7 @@ class CCTestSuite extends TestSuite { |
| String hostRunnerPath; |
| final String dartDir; |
| List<String> statusFilePaths; |
| - TestCaseEvent doTest; |
| + Function doTest; |
| VoidFunction doDone; |
| ReceivePort receiveTestName; |
| TestExpectations testExpectations; |
| @@ -360,16 +360,17 @@ class CCTestSuite extends TestSuite { |
| var args = TestUtils.standardOptions(configuration); |
| args.add(testName); |
| + var command = CommandBuilder.instance.getCommand( |
| + 'run_vm_unittest', targetRunnerPath, args); |
| doTest( |
| new TestCase(constructedName, |
| - [new Command('run_vm_unittest', targetRunnerPath, args)], |
| + [command], |
| configuration, |
| - completeHandler, |
| expectations)); |
| } |
| } |
| - void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]) { |
| + void forEachTest(Function onTest, Map testCache, [VoidFunction onDone]) { |
| doTest = onTest; |
| doDone = onDone; |
| @@ -392,9 +393,6 @@ class CCTestSuite extends TestSuite { |
| statusFileRead); |
| } |
| } |
| - |
| - void completeHandler(TestCase testCase) { |
| - } |
| } |
| @@ -422,7 +420,7 @@ class TestInformation { |
| class StandardTestSuite extends TestSuite { |
| final Path suiteDir; |
| final List<String> statusFilePaths; |
| - TestCaseEvent doTest; |
| + Function doTest; |
| TestExpectations testExpectations; |
| List<TestInformation> cachedTests; |
| final Path dartDir; |
| @@ -506,7 +504,7 @@ class StandardTestSuite extends TestSuite { |
| List<String> additionalOptions(Path filePath) => []; |
| - void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]) { |
| + void forEachTest(Function onTest, Map testCache, [VoidFunction onDone]) { |
| updateDartium().then((_) { |
| doTest = onTest; |
| @@ -739,7 +737,6 @@ class StandardTestSuite extends TestSuite { |
| doTest(new TestCase('$suiteName/$testName', |
| makeCommands(info, vmOptions, commonArguments), |
| configuration, |
| - completeHandler, |
| expectations, |
| isNegative: isNegative, |
| info: info)); |
| @@ -754,21 +751,20 @@ class StandardTestSuite extends TestSuite { |
| String tempDir = createOutputDirectory(info.filePath, ''); |
| args.add('--out=$tempDir/out.js'); |
| - List<Command> commands = |
| - <Command>[new CompilationCommand(compiler, |
| - "$tempDir/out.js", |
| - !useSdk, |
| - dart2JsBootstrapDependencies, |
| - compilerPath, |
| - args)]; |
| + var command = CommandBuilder.instance.getCompilationCommand( |
| + compiler, "$tempDir/out.js", !useSdk, |
| + dart2JsBootstrapDependencies, compilerPath, args); |
| + |
| + List<Command> commands = <Command>[command]; |
| if (info.hasCompileError) { |
| // Do not attempt to run the compiled result. A compilation |
| // error should be reported by the compilation command. |
| } else if (configuration['runtime'] == 'd8') { |
| - commands.add(new Command("d8", d8FileName, ['$tempDir/out.js'])); |
| + commands.add(CommandBuilder.instance.getCommand( |
| + "d8", d8FileName, ['$tempDir/out.js'])); |
| } else if (configuration['runtime'] == 'jsshell') { |
| - commands.add( |
| - new Command("jsshell", jsShellFileName, ['$tempDir/out.js'])); |
| + commands.add(CommandBuilder.instance.getCommand( |
| + "jsshell", jsShellFileName, ['$tempDir/out.js'])); |
| } |
| return commands; |
| @@ -779,12 +775,9 @@ class StandardTestSuite extends TestSuite { |
| args.add('--out=$tempDir/out.dart'); |
| List<Command> commands = |
| - <Command>[new CompilationCommand(compiler, |
| - "$tempDir/out.dart", |
| - !useSdk, |
| - dart2JsBootstrapDependencies, |
| - compilerPath, |
| - args)]; |
| + <Command>[CommandBuilder.instance.getCompilationCommand( |
| + compiler, "$tempDir/out.dart", !useSdk, |
| + dart2JsBootstrapDependencies, compilerPath, args)]; |
| if (info.hasCompileError) { |
| // Do not attempt to run the compiled result. A compilation |
| // error should be reported by the compilation command. |
| @@ -793,22 +786,23 @@ class StandardTestSuite extends TestSuite { |
| var vmArguments = new List.from(vmOptions); |
| vmArguments.addAll([ |
| '--ignore-unrecognized-flags', '$tempDir/out.dart']); |
| - commands.add(new Command("vm", vmFileName, vmArguments)); |
| + commands.add( |
| + CommandBuilder.instance.getCommand("vm", vmFileName, vmArguments)); |
| } else { |
| throw 'Unsupported runtime ${configuration["runtime"]} for dart2dart'; |
| } |
| return commands; |
| case 'none': |
| - case 'dartc': |
| - case 'dartanalyzer': |
| - case 'dart2analyzer': |
| - var displayName = (configuration['compiler'] == 'none' |
| - ? 'vm' : configuration['compiler']); |
| var arguments = new List.from(vmOptions); |
| arguments.addAll(args); |
| - return <Command>[ |
| - new Command(displayName, dartShellFileName, arguments)]; |
| + return <Command>[CommandBuilder.instance.getCommand( |
| + 'vm', dartShellFileName, arguments)]; |
| + |
| + case 'dartanalyzer': |
| + case 'dart2analyzer': |
| + return <Command>[CommandBuilder.instance.getAnalysisCommand( |
| + compiler, dartShellFileName, args, flavour: compiler)]; |
| default: |
| throw 'Unknown compiler ${configuration["compiler"]}'; |
| @@ -900,7 +894,6 @@ class StandardTestSuite extends TestSuite { |
| dartWrapper.closeSync(); |
| } |
| - |
| /** |
| * The [StandardTestSuite] has support for tests that |
| * compile a test from Dart to JavaScript, and then run the resulting |
| @@ -1008,17 +1001,10 @@ class StandardTestSuite extends TestSuite { |
| // Variables for browser multi-tests. |
| List<String> subtestNames = info.optionsFromFile['subtestNames']; |
| - BrowserTestCase multitestParentTest; |
| int subtestIndex = 0; |
| // Construct the command that executes the browser test |
| do { |
| List<Command> commandSet = new List<Command>.from(commands); |
| - if (subtestIndex != 0) { |
| - // NOTE: The first time we enter this loop, all the compilation |
| - // commands will be executed. On subsequent loop iterations, we |
| - // don't need to do any compilations. Thus we set "commandSet = []". |
| - commandSet = []; |
| - } |
| var htmlPath_subtest = _createUrlPathFromFile(new Path(htmlPath)); |
| var fullHtmlPath = _getUriForBrowserTest(info, htmlPath_subtest, |
| @@ -1032,9 +1018,9 @@ class StandardTestSuite extends TestSuite { |
| args = ['tools/testing/dart/launch_browser.dart', |
| runtime, |
| fullHtmlPath]; |
| - commandSet.add(new Command(runtime, |
| - TestUtils.dartTestExecutable.toString(), |
| - args)); |
| + commandSet.add(CommandBuilder.instance.getBrowserTestCommand( |
| + runtime, fullHtmlPath, |
| + TestUtils.dartTestExecutable.toString(), args)); |
| } else if (TestUtils.usesWebDriver(runtime)) { |
| args = [ |
| dartDir.append('tools/testing/run_selenium.py').toNativePath(), |
| @@ -1048,12 +1034,10 @@ class StandardTestSuite extends TestSuite { |
| if (subtestIndex != 0) { |
| args.add('--force-refresh'); |
| } |
| - commandSet.add(new Command(runtime, 'python', args)); |
| + commandSet.add(CommandBuilder.instance.getSeleniumTestCommand( |
| + runtime, fullHtmlPath, 'python', args)); |
| } else { |
| - if (runtime != "drt") { |
| - print("Unknown runtime $runtime"); |
| - exit(1); |
| - } |
| + assert(runtime == "drt"); |
| var dartFlags = []; |
| var contentShellOptions = []; |
| @@ -1077,11 +1061,9 @@ class StandardTestSuite extends TestSuite { |
| fullHtmlPath = "${fullHtmlPath}'-p"; |
| } |
| } |
| - commandSet.add(new ContentShellCommand(contentShellFilename, |
| - fullHtmlPath, |
| - contentShellOptions, |
| - dartFlags, |
| - expectedOutput)); |
| + commandSet.add(CommandBuilder.instance.getContentShellCommand( |
| + contentShellFilename, fullHtmlPath, contentShellOptions, |
| + dartFlags, expectedOutput)); |
| } |
| // Create BrowserTestCase and queue it. |
| @@ -1090,20 +1072,13 @@ class StandardTestSuite extends TestSuite { |
| if (info.optionsFromFile['isMultiHtmlTest']) { |
| testDisplayName = '$testDisplayName/${subtestNames[subtestIndex]}'; |
| testCase = new BrowserTestCase(testDisplayName, |
| - commandSet, configuration, completeHandler, |
| + commandSet, configuration, |
| expectations['$testName/${subtestNames[subtestIndex]}'], |
| - info, info.hasCompileError || info.hasRuntimeError, fullHtmlPath, |
| - subtestIndex != 0); |
| + info, info.hasCompileError || info.hasRuntimeError, fullHtmlPath); |
| } else { |
| testCase = new BrowserTestCase(testDisplayName, |
| - commandSet, configuration, completeHandler, expectations, |
| - info, info.hasCompileError || info.hasRuntimeError, fullHtmlPath, |
| - false); |
| - } |
| - if (subtestIndex == 0) { |
| - multitestParentTest = testCase; |
| - } else { |
| - multitestParentTest.addObserver(testCase); |
| + commandSet, configuration, expectations, |
| + info, info.hasCompileError || info.hasRuntimeError, fullHtmlPath); |
| } |
| doTest(testCase); |
| @@ -1130,12 +1105,9 @@ class StandardTestSuite extends TestSuite { |
| args.insert(0, executable); |
| executable = dartShellFileName; |
| } |
| - return new CompilationCommand(compiler, |
| - outputFile, |
| - !useSdk, |
| - dart2JsBootstrapDependencies, |
| - compilerPath, |
| - args); |
| + return CommandBuilder.instance.getCompilationCommand( |
| + compiler, outputFile, !useSdk, |
| + dart2JsBootstrapDependencies, compilerPath, args); |
| } |
| /** |
| @@ -1228,9 +1200,6 @@ class StandardTestSuite extends TestSuite { |
| return dartDir.append('client/tests/dartium/chrome').toNativePath(); |
| } |
| - void completeHandler(TestCase testCase) { |
| - } |
| - |
| List<String> commonArgumentsFromFile(Path filePath, Map optionsFromFile) { |
| List args = TestUtils.standardOptions(configuration); |
| @@ -1667,17 +1636,14 @@ class JUnitTestSuite extends TestSuite { |
| updatedConfiguration[key] = value; |
| }); |
| updatedConfiguration['timeout'] *= 3; |
| + var command = CommandBuilder.instance.getCommand('junit_test', 'java', args); |
|
ricow1
2013/07/30 09:30:11
long line
kustermann
2013/07/31 15:53:54
Done.
|
| doTest(new TestCase(suiteName, |
| - [new Command('junit_test', 'java', args)], |
| + [command], |
| updatedConfiguration, |
| - completeHandler, |
| new Set<String>.from([PASS]))); |
| doDone(); |
| } |
| - void completeHandler(TestCase testCase) { |
| - } |
| - |
| void computeClassPath() { |
| classPath = |
| ['$buildDir/analyzer/util/analyzer/dart_analyzer.jar', |