[infra] Make --keep-generated-files work with -n option

Makes the --keep-generated-files flag an option for the test.py command
only, not part of a named configuration passed in with the -n flag
and defined in tools/bots/test_matrix.json.

Change-Id: If67c2848cf6fc15e4cb7167ce23eeb3eb9bd1684
Reviewed-on: https://dart-review.googlesource.com/c/85705
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: William Hesse <whesse@google.com>
diff --git a/pkg/smith/lib/configuration.dart b/pkg/smith/lib/configuration.dart
index 9bd0e37..ea0b8d1 100644
--- a/pkg/smith/lib/configuration.dart
+++ b/pkg/smith/lib/configuration.dart
@@ -259,7 +259,6 @@
         useAnalyzerCfe: boolOption("use-cfe"),
         useAnalyzerFastaParser: boolOption("analyzer-use-fasta-parser"),
         useBlobs: boolOption("use-blobs"),
-        keepGeneratedFiles: boolOption("keep-generated-files"),
         useDart2JSWithKernel: boolOption("dart2js-with-kernel"),
         useDart2JSOldFrontEnd: boolOption("dart2js-old-frontend"),
         useFastStartup: boolOption("fast-startup"),
@@ -315,9 +314,6 @@
   // TODO(rnystrom): What is this?
   final bool useBlobs;
 
-  // Keep generated files (instead of deleting them).
-  final bool keepGeneratedFiles;
-
   // TODO(rnystrom): Remove these when Dart 1.0 is no longer supported.
   final bool useDart2JSWithKernel;
   final bool useDart2JSOldFrontEnd;
@@ -343,7 +339,6 @@
       bool useAnalyzerCfe,
       bool useAnalyzerFastaParser,
       bool useBlobs,
-      bool keepGeneratedFiles,
       bool useDart2JSWithKernel,
       bool useDart2JSOldFrontEnd,
       bool useFastStartup,
@@ -362,7 +357,6 @@
         useAnalyzerCfe = useAnalyzerCfe ?? false,
         useAnalyzerFastaParser = useAnalyzerFastaParser ?? false,
         useBlobs = useBlobs ?? false,
-        keepGeneratedFiles = keepGeneratedFiles ?? false,
         useDart2JSWithKernel = useDart2JSWithKernel ?? false,
         useDart2JSOldFrontEnd = useDart2JSOldFrontEnd ?? false,
         useFastStartup = useFastStartup ?? false,
@@ -390,7 +384,6 @@
       useAnalyzerCfe == other.useAnalyzerCfe &&
       useAnalyzerFastaParser == other.useAnalyzerFastaParser &&
       useBlobs == other.useBlobs &&
-      keepGeneratedFiles == other.keepGeneratedFiles &&
       useDart2JSWithKernel == other.useDart2JSWithKernel &&
       useDart2JSOldFrontEnd == other.useDart2JSOldFrontEnd &&
       useFastStartup == other.useFastStartup &&
@@ -425,8 +418,7 @@
       (useFastStartup ? 2048 : 0) ^
       (useHotReload ? 4096 : 0) ^
       (useHotReloadRollback ? 8192 : 0) ^
-      (useSdk ? 16384 : 0) ^
-      (keepGeneratedFiles ? 32768 : 0);
+      (useSdk ? 16384 : 0);
 
   String toString() {
     var buffer = new StringBuffer();
@@ -452,7 +444,6 @@
     if (useAnalyzerCfe) fields.add("use-cfe");
     if (useAnalyzerFastaParser) fields.add("analyzer-use-fasta-parser");
     if (useBlobs) fields.add("use-blobs");
-    if (keepGeneratedFiles) fields.add("keep-generated-files");
     if (useDart2JSWithKernel) fields.add("dart2js-with-kernel");
     if (useDart2JSOldFrontEnd) fields.add("dart2js-old-frontend");
     if (useFastStartup) fields.add("fast-startup");
@@ -516,10 +507,6 @@
     if (useBlobs || other.useBlobs) {
       fields.add("useBlobs $useBlobs ${other.useBlobs}");
     }
-    if (keepGeneratedFiles || other.keepGeneratedFiles) {
-      fields.add(
-          "keepGeneratedFiles $keepGeneratedFiles ${other.keepGeneratedFiles}");
-    }
     if (useDart2JSWithKernel || other.useDart2JSWithKernel) {
       fields.add("useDart2JSWithKernel "
           "$useDart2JSWithKernel ${other.useDart2JSWithKernel}");
diff --git a/tools/testing/dart/configuration.dart b/tools/testing/dart/configuration.dart
index 53f95df..ed7903e 100644
--- a/tools/testing/dart/configuration.dart
+++ b/tools/testing/dart/configuration.dart
@@ -58,6 +58,7 @@
       this.testServerCrossOriginPort,
       this.testDriverErrorPort,
       this.localIP,
+      this.keepGeneratedFiles,
       this.dart2jsOptions,
       String packages,
       this.packageRoot,
@@ -112,7 +113,6 @@
   bool get useAnalyzerCfe => configuration.useAnalyzerCfe;
   bool get useAnalyzerFastaParser => configuration.useAnalyzerFastaParser;
   bool get useBlobs => configuration.useBlobs;
-  bool get keepGeneratedFiles => configuration.keepGeneratedFiles;
   bool get useSdk => configuration.useSdk;
   bool get useFastStartup => configuration.useFastStartup;
   bool get useEnableAsserts => configuration.enableAsserts;
@@ -140,6 +140,7 @@
   final int testServerCrossOriginPort;
   final int testDriverErrorPort;
   final String localIP;
+  final bool keepGeneratedFiles;
 
   /// Extra dart2js options passed to the testing script.
   final List<String> dart2jsOptions;
diff --git a/tools/testing/dart/options.dart b/tools/testing/dart/options.dart
index 3bea2d7..7bd82b8 100644
--- a/tools/testing/dart/options.dart
+++ b/tools/testing/dart/options.dart
@@ -650,7 +650,6 @@
                     useAnalyzerFastaParser:
                         data["analyzer_use_fasta_parser"] as bool,
                     useBlobs: data["use_blobs"] as bool,
-                    keepGeneratedFiles: data["keep_generated_files"] as bool,
                     useSdk: data["use_sdk"] as bool,
                     useFastStartup: data["fast_startup"] as bool,
                     useDart2JSWithKernel: data["dart2js_with_kernel"] as bool,
@@ -693,6 +692,7 @@
                 dartPath: data["dart"] as String,
                 dartPrecompiledPath: data["dart_precompiled"] as String,
                 flutterPath: data["flutter"] as String,
+                keepGeneratedFiles: data["keep_generated_files"] as bool,
                 taskCount: data["tasks"] as int,
                 shardCount: data["shards"] as int,
                 shard: data["shard"] as int,