Add a --use-fasta-parse flag to test.py; add a 'analyzer-use-fasta-parser' buildbot configuration.

Change-Id: I802df6b5fbfe963a466ce49f29d2bb0c84f14d25
Reviewed-on: https://dart-review.googlesource.com/60810
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
diff --git a/pkg/pkg.status b/pkg/pkg.status
index 81ab31b..7a258a5 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -153,6 +153,39 @@
 [ $arch == x64 && $runtime == vm && $system == windows && $checked ]
 analyzer/test/src/task/strong/inferred_type_test: Pass, Slow
 
+# analyzer using the fasta parser
+[ $builder_tag == analyzer_use_fasta && $runtime == vm ]
+analysis_server/test/analysis/get_errors_test: Fail
+analysis_server/test/completion_test: Fail
+analysis_server/test/domain_completion_test: Fail
+analysis_server/test/edit/fixes_test: Fail
+analysis_server/test/integration/analysis/package_root_test: Pass, RuntimeError # Issue 33382
+analysis_server/test/services/completion/dart/keyword_contributor_test: Fail
+analysis_server/test/services/completion/dart/override_contributor_test: Fail
+analysis_server/test/services/completion/statement/statement_completion_test: Fail
+analysis_server/test/services/correction/fix_test: Fail
+analysis_server/test/services/refactoring/extract_local_test: Fail
+analyzer/test/generated/compile_time_error_code_driver_test: Fail
+analyzer/test/generated/compile_time_error_code_test: Fail
+analyzer/test/generated/declaration_resolver_test: Fail
+analyzer/test/generated/hint_code_driver_test: Fail
+analyzer/test/generated/hint_code_test: Fail
+analyzer/test/generated/invalid_code_driver_test: Fail
+analyzer/test/generated/non_error_resolver_driver_test: Fail
+analyzer/test/generated/non_error_resolver_test: Fail
+analyzer/test/generated/parser_test: Fail
+analyzer/test/generated/resolver_test: Fail
+analyzer/test/generated/utilities_test: Fail
+analyzer/test/src/context/context_test: Fail
+analyzer/test/src/dart/constant/evaluation_test: Fail
+analyzer/test/src/summary/prelinker_test: Fail
+analyzer/test/src/summary/summarize_ast_strong_test: Fail
+analyzer/test/src/summary/summarize_ast_test: Fail
+analyzer_plugin/test/src/utilities/completion/completion_target_test: Fail
+analyzer_plugin/test/src/utilities/completion/optype_test: Fail
+analyzer_plugin/test/src/utilities/visitors/local_declaration_visitor_test: Fail
+analyzer_plugin/test/utilities/completion/completion_target_test: Fail
+
 [ $builder_tag != dart2js_analyzer && $compiler == dart2js ]
 analysis_server/test/*: Skip # Issue 26813
 analyzer/test/*: Skip # Issue 26813
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 2007e17..3e2549b 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -1615,6 +1615,9 @@
     },
     {
       "builders": ["analyzer-analysis-server-linux"],
+      "meta": {
+        "description": "Analyze analyzer related packages."
+      },
       "steps": [
         {
           "name": "build dart",
@@ -1622,23 +1625,93 @@
           "arguments": ["create_sdk"]
         },
         {
-          "name": "Analyze analysis_server",
+          "name": "Analyze pkg/analysis_server/",
           "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
           "arguments": ["--no-hints","pkg/analysis_server"]
         },
         {
-          "name": "Analyze analysis_server",
+          "name": "Analyze pkg/analyzer/",
           "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
           "arguments": ["--no-hints","pkg/analyzer"]
         },
         {
-          "name": "Analyze analysis_server",
+          "name": "Analyze pkg/analyzer_plugin/",
           "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
           "arguments": ["--no-hints","pkg/analyzer_plugin"]
         }
       ]
     },
     {
+      "builders": ["analyzer-use-fasta-parser-linux"],
+      "meta": {
+        "description": "Run the analyzer using the Fasta parser."
+      },
+      "steps": [
+        {
+          "name": "build dart",
+          "script": "tools/build.py",
+          "arguments": ["create_sdk"]
+        },
+        {
+          "name": "analyze pkg/analysis_server/",
+          "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+          "arguments": [
+            "--no-hints",
+            "--use-fasta-parser",
+            "pkg/analysis_server"
+          ]
+        },
+        {
+          "name": "analyze pkg/analyzer/",
+          "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+          "arguments": [
+            "--no-hints",
+            "--use-fasta-parser",
+            "pkg/analyzer"
+          ]
+        },
+        {
+          "name": "analyze pkg/analyzer_cli/lib/",
+          "script": "out/ReleaseX64/dart-sdk/bin/dartanalyzer",
+          "arguments": [
+            "--no-hints",
+            "--use-fasta-parser",
+            "pkg/analyzer_cli/lib"
+          ]
+        },
+        {
+          "name": "run analyzer unit tests",
+          "arguments": [
+            "--builder-tag=analyzer_use_fasta",
+            "--compiler=none",
+            "--use-sdk",
+            "--vm-options=-DuseFastaParser=true",
+            "pkg/analyzer/"
+          ]
+        },
+        {
+          "name": "run analysis server plugin tests",
+          "arguments": [
+            "--builder-tag=analyzer_use_fasta",
+            "--compiler=none",
+            "--use-sdk",
+            "--vm-options=-DuseFastaParser=true",
+            "pkg/analyzer_plugin/"
+          ]
+        },
+        {
+          "name": "run analysis server unit tests",
+          "arguments": [
+            "--builder-tag=analyzer_use_fasta",
+            "--compiler=none",
+            "--use-sdk",
+            "--vm-options=-DuseFastaParser=true",
+            "pkg/analysis_server/"
+          ]
+        }
+      ]
+    },
+    {
       "builders": ["pkg-linux-release","pkg-win-release","pkg-mac-release"],
       "meta": {
         "description": "This configuration is used by the pkg builders."
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index 526de29..757ef01 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -1011,6 +1011,10 @@
     } else {
       arguments.add('--no-strong');
     }
+    if (_configuration.compiler == Compiler.dart2analyzer &&
+        _configuration.usesFasta) {
+      arguments.add('--use-fasta-parser');
+    }
 
     // Since this is not a real compilation, no artifacts are produced.
     return new CommandArtifact([
diff --git a/tools/testing/dart/configuration.dart b/tools/testing/dart/configuration.dart
index 4e1022f..e78b2d4 100644
--- a/tools/testing/dart/configuration.dart
+++ b/tools/testing/dart/configuration.dart
@@ -192,7 +192,9 @@
       Compiler.fasta,
     ];
     return fastaCompilers.contains(compiler) ||
-        compiler == Compiler.dart2js && !useDart2JSOldFrontend;
+        (compiler == Compiler.dart2js && !useDart2JSOldFrontend) ||
+        (compiler == Compiler.dart2analyzer &&
+            builderTag == 'analyzer_use_fasta');
   }
 
   /// The base directory named for this configuration, like:
diff --git a/tools/testing/dart/options.dart b/tools/testing/dart/options.dart
index 005516f..5493852 100644
--- a/tools/testing/dart/options.dart
+++ b/tools/testing/dart/options.dart
@@ -768,7 +768,7 @@
 If you specify only a runtime ("-r"), then an appropriate default compiler will
 be chosen for that runtime. Likewise, if you specify only a compiler ("-c"),
 then a matching runtime is chosen. If neither compiler nor runtime is selected,
-the test is run directly from source on the VM. 
+the test is run directly from source on the VM.
 
 Options:''');