| Index: tools/testing/dart/test_suite.dart
|
| diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
|
| index 70a8d39f453ac078067600fe3bb7c8aa343e1a6e..5160789d3a04819b84c1c7e931de80e1970358b3 100644
|
| --- a/tools/testing/dart/test_suite.dart
|
| +++ b/tools/testing/dart/test_suite.dart
|
| @@ -175,16 +175,26 @@ class TestInformation {
|
| String filename;
|
| Map optionsFromFile;
|
| bool isNegative;
|
| + bool isStaticClean;
|
| + bool hasStaticTypeAnnotations;
|
| + bool hasCompileTimeAnnotations;
|
| bool isNegativeIfChecked;
|
| bool hasFatalTypeErrors;
|
| bool hasRuntimeErrors;
|
| + // expected outcome from multi-test "static type error", "compile-time error", etc
|
| + String multitestOutcome;
|
|
|
| TestInformation(this.filename, this.optionsFromFile, this.isNegative,
|
| this.isNegativeIfChecked, this.hasFatalTypeErrors,
|
| - this.hasRuntimeErrors);
|
| + this.hasRuntimeErrors, this.multitestOutcome);
|
| }
|
|
|
|
|
| +class AnnotatedError {
|
| + String type; // "runtime", "static type", or "compile-time"
|
| +
|
| +}
|
| +
|
| /**
|
| * A standard [TestSuite] implementation that searches for tests in a
|
| * directory, and creates [TestCase]s that compile and/or run them.
|
| @@ -279,6 +289,7 @@ class StandardTestSuite implements TestSuite {
|
| dir.exists();
|
| }
|
|
|
| +
|
| void enqueueTestCaseFromTestInformation(TestInformation info) {
|
| var filename = info.filename;
|
| var optionsFromFile = info.optionsFromFile;
|
| @@ -338,16 +349,11 @@ class StandardTestSuite implements TestSuite {
|
| default:
|
| isNegative = isNegative ||
|
| (configuration['checked'] && info.isNegativeIfChecked);
|
| - bool enableFatalTypeErrors = false;
|
|
|
| if (configuration['component'] == 'dartc') {
|
| - // Only dartc supports fatal type errors. Enable fatal type
|
| - // errors with a flag and treat tests that have fatal type
|
| - // errors as negative.
|
| - // Also, tests that have runtime errors are not negative
|
| - // tests for dartc because dartc does not execute the test.
|
| + // dartc can detect static type errors by the
|
| + // format of the rror line
|
| if (info.hasFatalTypeErrors) {
|
| - enableFatalTypeErrors = true;
|
| isNegative = true;
|
| } else if (info.hasRuntimeErrors) {
|
| isNegative = false;
|
| @@ -355,8 +361,7 @@ class StandardTestSuite implements TestSuite {
|
| }
|
|
|
| var argumentLists = argumentListsFromFile(filename,
|
| - optionsFromFile,
|
| - enableFatalTypeErrors);
|
| + optionsFromFile);
|
|
|
| for (var args in argumentLists) {
|
| doTest(new TestCase('$suiteName/$testName',
|
| @@ -364,7 +369,8 @@ class StandardTestSuite implements TestSuite {
|
| configuration,
|
| completeHandler,
|
| expectations,
|
| - isNegative));
|
| + isNegative,
|
| + info));
|
| }
|
| }
|
| }
|
| @@ -374,14 +380,16 @@ class StandardTestSuite implements TestSuite {
|
| bool isNegative,
|
| [bool isNegativeIfChecked = false,
|
| bool hasFatalTypeErrors = false,
|
| - bool hasRuntimeErrors = false]) {
|
| + bool hasRuntimeErrors = false,
|
| + String multitestOutcome = null]) {
|
| // Cache the test information for each test case.
|
| var info = new TestInformation(filename,
|
| optionsFromFile,
|
| isNegative,
|
| isNegativeIfChecked,
|
| hasFatalTypeErrors,
|
| - hasRuntimeErrors);
|
| + hasRuntimeErrors,
|
| + multitestOutcome);
|
| cachedTests.add(info);
|
| enqueueTestCaseFromTestInformation(info);
|
| };
|
| @@ -733,12 +741,12 @@ class StandardTestSuite implements TestSuite {
|
| }
|
|
|
| List<List<String>> argumentListsFromFile(String filename,
|
| - Map optionsFromFile,
|
| - bool enableFatalTypeErrors) {
|
| + Map optionsFromFile) {
|
| List args = TestUtils.standardOptions(configuration);
|
| args.addAll(additionalOptions(filename));
|
| - if (enableFatalTypeErrors && configuration['component'] == 'dartc') {
|
| - args.add('--fatal-type-errors');
|
| + if (configuration['component'] == 'dartc') {
|
| + args.add('--error_format');
|
| + args.add('machine');
|
| }
|
|
|
| bool isMultitest = optionsFromFile["isMultitest"];
|
| @@ -775,6 +783,8 @@ 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 leadingHashRegExp = const RegExp(@"^#", multiLine: true);
|
| RegExp isolateStubsRegExp = const RegExp(@"// IsolateStubs=(.*)");
|
| RegExp domImportRegExp =
|
| @@ -828,6 +838,9 @@ class StandardTestSuite implements TestSuite {
|
| contents.contains("@runtime-error")) {
|
| isNegative = true;
|
| }
|
| + if (contents.contains("@static-clean")) {
|
| + isStaticClean = true;
|
| + }
|
|
|
| bool isMultitest = multiTestRegExp.hasMatch(contents);
|
| bool containsLeadingHash = leadingHashRegExp.hasMatch(contents);
|
| @@ -836,18 +849,27 @@ class StandardTestSuite implements TestSuite {
|
| bool containsDomImport = domImportRegExp.hasMatch(contents);
|
| bool isLibraryDefinition = libraryDefinitionRegExp.hasMatch(contents);
|
| bool containsSourceOrImport = sourceOrImportRegExp.hasMatch(contents);
|
| -
|
| + int numStaticTypeAnnotations = 0;
|
| + for (var i in staticTypeRegExp.allMatches(contents)) {
|
| + numStaticTypeAnnotations++;
|
| + }
|
| + int numCompileTimeAnnotations = 0;
|
| + for (var i in compileTimeRegExp.allMatches(contents)) {
|
| + numCompileTimeAnnotations++;
|
| + }
|
|
|
| return { "vmOptions": result,
|
| "dartOptions": dartOptions,
|
| "isNegative": isNegative,
|
| "otherScripts": otherScripts,
|
| "isMultitest": isMultitest,
|
| - "containsLeadingHash" : containsLeadingHash,
|
| - "isolateStubs" : isolateStubs,
|
| + "containsLeadingHash": containsLeadingHash,
|
| + "isolateStubs": isolateStubs,
|
| "containsDomImport": containsDomImport,
|
| "isLibraryDefinition": isLibraryDefinition,
|
| - "containsSourceOrImport": containsSourceOrImport };
|
| + "containsSourceOrImport": containsSourceOrImport,
|
| + "numStaticTypeAnnotations": numStaticTypeAnnotations,
|
| + "numCompileTimeAnnotations": numCompileTimeAnnotations};
|
| }
|
| }
|
|
|
|
|