[CFE] update_expectations.dart can also run multiple special suits

E.g. the below command should update both strong, weak, etc and
incremental, parser etc suites with any test containing ffi:

`out/ReleaseX64/dart pkg/front_end/tool/update_expectations.dart *ffi*`

In the future we should, I think, update the tool to be more like
`unit_test_suites.dart` and get rid of the option for package:testing
to generate a program and then run that.

Change-Id: I19edfe2198cbe86326396dc2c8a8f871c599588d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359061
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
diff --git a/pkg/front_end/tool/update_expectations.dart b/pkg/front_end/tool/update_expectations.dart
index 0c0c448..300998e 100644
--- a/pkg/front_end/tool/update_expectations.dart
+++ b/pkg/front_end/tool/update_expectations.dart
@@ -36,18 +36,32 @@
     // if the first compilation is a full compilation, i.e. not outline,
     // because comments are generated during body building and inference.
     '-DupdateComments=true',
-    '-DupdateExpectations=true'
+    '-DupdateExpectations=true',
+  ]);
+}
+
+Future<void> runAllSpecialSuites([List<String>? args]) async {
+  List<String> testingArguments = [];
+  for (String suite in specialSuites) {
+    List<String> tests = args == null
+        ? [suite]
+        : args.map((String arg) => '${suite}/$arg').toList();
+    testingArguments.addAll(tests);
+  }
+  await fasta.main([
+    'testing',
+    ...testingArguments,
+    '-DupdateExpectations=true',
   ]);
 }
 
 Future<void> main(List<String> args) async {
   if (args.isEmpty) {
     await runStandardSuites();
-    for (String suite in specialSuites) {
-      await fasta.main(['testing', suite, '-DupdateExpectations=true']);
-    }
+    await runAllSpecialSuites();
   } else {
     List<String> standardTests = <String>[];
+    List<String> wildcardSpecialTests = <String>[];
     for (String arg in args) {
       bool isSpecial = false;
       for (String suite in specialSuites) {
@@ -58,9 +72,13 @@
         }
       }
       if (!isSpecial) {
+        wildcardSpecialTests.add(arg);
         standardTests.add(arg);
       }
     }
+    if (wildcardSpecialTests.isNotEmpty) {
+      await runAllSpecialSuites(wildcardSpecialTests);
+    }
     if (standardTests.isNotEmpty) {
       await runStandardSuites(standardTests);
     }