diff --git a/tools/testing/dart/multitest.dart b/tools/testing/dart/multitest.dart index 89958303c40..c68fb2c401c 100644 --- a/tools/testing/dart/multitest.dart +++ b/tools/testing/dart/multitest.dart @@ -141,7 +141,7 @@ Set _findAllRelativeImports(String topLibrary) { for (String filename in thisPass) { File f = new File(filename); for (String line in f.readAsLinesSync()) { - Match match = relativeImportRegExp.firstMatch(line); + Match match = relativeImportRegExp.firstMatch(line); if (match != null) { String relativePath = match.group(3); if (foundImports.contains(relativePath)) { @@ -165,7 +165,7 @@ Set _findAllRelativeImports(String topLibrary) { void DoMultitest(String filename, String outputDir, String testDir, - // TODO(zundel): Are the boolean flags now redundant + // TODO(zundel): Are the boolean flags now redundant // with the 'multitestOutcome' field? Function doTest(String filename, bool isNegative, diff --git a/tools/testing/dart/test_options.dart b/tools/testing/dart/test_options.dart index 16dd8908965..e3efee2b836 100644 --- a/tools/testing/dart/test_options.dart +++ b/tools/testing/dart/test_options.dart @@ -62,7 +62,7 @@ is 'dart file.dart' and you specify special command new _TestOptionSpecification( 'component', ''' -Controls how dart code is compiled and executed. +Controls how dart code is compiled and executed. vm: Run dart code on the standalone dart vm. @@ -217,10 +217,10 @@ Controls how dart code is compiled and executed. 'Path to frog library', ['--froglib'], [], - ''), + ''), new _TestOptionSpecification( 'noBatch', - 'Do not run browser tests in batch mode', + 'Do not run browser tests in batch mode', ['-n', '--nobatch'], [], false, diff --git a/tools/testing/dart/test_progress.dart b/tools/testing/dart/test_progress.dart index 63e17b7a7c1..df4daaf4a43 100644 --- a/tools/testing/dart/test_progress.dart +++ b/tools/testing/dart/test_progress.dart @@ -129,8 +129,8 @@ class ProgressIndicator { for (var s in test.output.diagnostics) { output.add('$prefix ${s}'); prefix = ' '; - } - } + } + } if (!test.output.stdout.isEmpty()) { output.add(''); output.add('stdout:'); diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart index d61423c3542..19088caa2cd 100644 --- a/tools/testing/dart/test_runner.dart +++ b/tools/testing/dart/test_runner.dart @@ -171,7 +171,7 @@ class BrowserTestCase extends TestCase { * the time the process took to run. It also contains a pointer to the * [TestCase] this is the output of. */ -interface TestOutput default TestOutputImpl { +interface TestOutput default TestOutputImpl { TestOutput.fromCase(TestCase testCase, int exitCode, bool timedOut, List stdout, List stderr, Duration time); @@ -181,7 +181,7 @@ interface TestOutput default TestOutputImpl { bool get hasCrashed(); - bool get hasTimedOut(); + bool get hasTimedOut(); bool get didFail(); @@ -204,7 +204,7 @@ class TestOutputImpl implements TestOutput { */ bool requestRetry = false; - // Don't call this constructor, call TestOutput.fromCase() to + // Don't call this constructor, call TestOutput.fromCase() to // get anew TestOutput instance. TestOutputImpl(this.testCase, this.exitCode, this.timedOut, this.stdout, this.stderr, this.time) { @@ -212,8 +212,8 @@ class TestOutputImpl implements TestOutput { diagnostics = []; } - factory TestOutputImpl.fromCase (testCase, exitCode, timedOut, stdout, stderr, - time) { + factory TestOutputImpl.fromCase (testCase, exitCode, timedOut, + stdout, stderr, time) { if (testCase is BrowserTestCase) { return new BrowserTestOutputImpl(testCase, exitCode, timedOut, stdout, stderr, time); @@ -256,7 +256,7 @@ class TestOutputImpl implements TestOutput { } class BrowserTestOutputImpl extends TestOutputImpl { - BrowserTestOutputImpl(testCase, exitCode, timedOut, stdout, stderr, time) : + BrowserTestOutputImpl(testCase, exitCode, timedOut, stdout, stderr, time) : super(testCase, exitCode, timedOut, stdout, stderr, time); bool get didFail() { @@ -290,13 +290,13 @@ class BrowserTestOutputImpl extends TestOutputImpl { } } -// The static analyzer does not actaully execute code, so +// The static analyzer does not actaully execute code, so // the criteria for success now depend on the text sent // to stderr. class AnalysisTestOutputImpl extends TestOutputImpl { - boolean alreadyComputed = false; - boolean failResult; - AnalysisTestOutputImpl(testCase, exitCode, timedOut, stdout, stderr, time) : + bool alreadyComputed = false; + bool failResult; + AnalysisTestOutputImpl(testCase, exitCode, timedOut, stdout, stderr, time) : super(testCase, exitCode, timedOut, stdout, stderr, time) { } @@ -325,11 +325,11 @@ class AnalysisTestOutputImpl extends TestOutputImpl { // ignore all others if (fields[1] == 'STATIC_TYPE') { staticWarnings.add(fields); - } + } } // OK to Skip error output that doesn't match the machine format } - if (testCase.info != null + if (testCase.info != null && testCase.info.optionsFromFile['isMultitest']) { return _didMultitestFail(errors, staticWarnings); } @@ -394,7 +394,7 @@ class AnalysisTestOutputImpl extends TestOutputImpl { return true; } - if (numCompileTimeAnnotations > 0 + if (numCompileTimeAnnotations > 0 && numCompileTimeAnnotations < errors.length) { // Expected compile-time errors were not returned. The test did not 'fail' in the way @@ -413,7 +413,7 @@ class AnalysisTestOutputImpl extends TestOutputImpl { return false; } else if (errors.length != 0) { return true; - } + } return false; } @@ -485,7 +485,7 @@ class RunningProcess { for (var line in testCase.output.stdout) print(line); } if (allowRetries != null && allowRetries - && testCase.usesWebDriver && testCase.output.unexpectedOutput + && testCase.usesWebDriver && testCase.output.unexpectedOutput && testCase.numRetries > 0) { // Selenium tests can be flaky. Try rerunning. testCase.output.requestRetry = true; @@ -680,7 +680,7 @@ class BatchRunnerProcess { var exitCode = 0; if (outcome == "CRASH") exitCode = -10; if (outcome == "FAIL" || outcome == "TIMEOUT") exitCode = 1; - new TestOutput.fromCase(_currentTest, exitCode, outcome == "TIMEOUT", + new TestOutput.fromCase(_currentTest, exitCode, outcome == "TIMEOUT", _testStdout, _testStderr, new Date.now().difference(_startTime)); // Move on when both stdout and stderr has been drained. If the test // crashed, we restarted the process and therefore do not attempt to @@ -962,11 +962,11 @@ class ProcessQueue { browserUsed == 'safari'; /** True if the Selenium Server is ready to be used. */ - bool get _isSeleniumAvailable() => _seleniumServer != null || + bool get _isSeleniumAvailable() => _seleniumServer != null || _seleniumAlreadyRunning; /** - * Restart all the processes that have been waiting/stopped for the server to + * Restart all the processes that have been waiting/stopped for the server to * start up. If we just call this once we end up with a single-"threaded" run. */ void resumeTesting() { @@ -986,7 +986,7 @@ class ProcessQueue { arg.add('/v'); } Process p = new Process.start(cmd, arg); - final StringInputStream stdoutStringStream = + final StringInputStream stdoutStringStream = new StringInputStream(p.stdout); stdoutStringStream.onLine = () { var line = stdoutStringStream.readLine(); @@ -1052,7 +1052,7 @@ class ProcessQueue { // Heads up: there seems to an obscure data race of some form in // the VM between launching the server process and launching the test // tasks that disappears when you read IO (which is convenient, since - // that is our condition for knowing that the server is ready). + // that is our condition for knowing that the server is ready). StringInputStream stdoutStringStream = new StringInputStream(_seleniumServer.stdout); StringInputStream stderrStringStream = diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart index 801cd576812..8099e21a33f 100644 --- a/tools/testing/dart/test_suite.dart +++ b/tools/testing/dart/test_suite.dart @@ -177,7 +177,6 @@ class TestInformation { bool isNegativeIfChecked; bool hasFatalTypeErrors; bool hasRuntimeErrors; - // expected outcome from multi-test "static type error", "compile-time error", etc Set multitestOutcome; TestInformation(this.filename, this.optionsFromFile, this.isNegative, @@ -641,7 +640,7 @@ class StandardTestSuite implements TestSuite { String tempDirPath = TestUtils.buildDir(configuration); if (requiresCleanTemporaryDirectory) { tempDirPath = globalTemporaryDirectory(); - String debugMode = + String debugMode = (configuration['mode'] == 'debug') ? 'Debug_' : 'Release_'; generatedTestPath = ['${debugMode}_${configuration["arch"]}'] .addAll(generatedTestPath); @@ -666,8 +665,8 @@ class StandardTestSuite implements TestSuite { } } tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); - return TestUtils.mkdirRecursive(tempDirPath, - Strings.join(generatedTestPath, '/')); + return TestUtils.mkdirRecursive(tempDirPath, + Strings.join(generatedTestPath, '/')); } String get scriptType() { @@ -765,8 +764,10 @@ class StandardTestSuite implements TestSuite { RegExp dartOptionsRegExp = const RegExp(@"// DartOptions=(.*)"); RegExp otherScriptsRegExp = const RegExp(@"// OtherScripts=(.*)"); RegExp multiTestRegExp = const RegExp(@"/// [0-9][0-9]:(.*)"); - RegExp staticTypeRegExp = const RegExp(@"/// ([0-9][0-9]:){0,1}\s*static type error"); - RegExp compileTimeRegExp = const RegExp(@"/// ([0-9][0-9]:){0,1}\s*compile-time error"); + RegExp staticTypeRegExp = + const RegExp(@"/// ([0-9][0-9]:){0,1}\s*static type error"); + RegExp compileTimeRegExp = + const RegExp(@"/// ([0-9][0-9]:){0,1}\s*compile-time error"); RegExp staticCleanRegExp = const RegExp(@"// @static-clean"); RegExp leadingHashRegExp = const RegExp(@"^#", multiLine: true); RegExp isolateStubsRegExp = const RegExp(@"// IsolateStubs=(.*)"); @@ -820,7 +821,7 @@ class StandardTestSuite implements TestSuite { } isStaticClean = true; } - + List otherScripts = new List(); matches = otherScriptsRegExp.allMatches(contents); for (var match in matches) { @@ -831,7 +832,7 @@ class StandardTestSuite implements TestSuite { contents.contains("@runtime-error")) { isNegative = true; } - + bool isMultitest = multiTestRegExp.hasMatch(contents); bool containsLeadingHash = leadingHashRegExp.hasMatch(contents); Match isolateMatch = isolateStubsRegExp.firstMatch(contents); @@ -1034,15 +1035,14 @@ class JUnitTestSuite implements TestSuite { class TestUtils { - - /** - * Creates a directory using a [relativePath] to an existing + /** + * Creates a directory using a [relativePath] to an existing * [base] directory if that [relativePath] does not already exist. */ static Directory mkdirRecursive(String base, String relativePath) { Directory baseDir = new Directory(base); Expect.isTrue(baseDir.existsSync(), - "Expected ${base} to already exist"); + "Expected ${base} to already exist"); var tempDir = new Directory(base); for (String dir in relativePath.split('/')) { base = "$base/$dir"; @@ -1065,7 +1065,7 @@ class TestUtils { handle.writeListSync(contents, 0, contents.length); handle.closeSync(); } - + static String executableSuffix(String component) { if (new Platform().operatingSystem() == 'windows') { if (component != 'frogium'