anchor.diff:              "as baseline instead of $commit for $builder");
           inexactBuilds[builder] = buildSearchResult.commit;
         }
  -      final buildNumber = buildSearchResult.build;
  +      final buildNumber = buildSearchResult.build.toString();
         print("Downloading results from builder $builder build $buildNumber...");
  -      await cpGsutil(
  -          buildFileCloudPath(builder, buildNumber.toString(), "results.json"),
  +      await cpGsutil(buildFileCloudPath(builder, buildNumber, "results.json"),
             "${outDirectory.path}/previous.json");
  -      await cpGsutil(
  -          buildFileCloudPath(builder, buildNumber.toString(), "flaky.json"),
  -          "${outDirectory.path}/flaky.json");
  +      if (!options["report-flakes"]) {
  +        await cpGsutil(buildFileCloudPath(builder, buildNumber, "flaky.json"),
  +            "${outDirectory.path}/flaky.json");
  +      }
         print("Downloaded baseline results from builder $builder");
         // Merge the results for the builders.
  -      if (2 <= builders.length) {
  +      if (builders.length > 1) {
           mergedResults
               .addAll(await loadResultsMap("${outDirectory.path}/previous.json"));
  -        mergedFlaky
  -            .addAll(await loadResultsMap("${outDirectory.path}/flaky.json"));
  +        if (!options["report-flakes"]) {
  +          mergedFlaky
  +              .addAll(await loadResultsMap("${outDirectory.path}/flaky.json"));
  +        }
         }
       }
   
       // Write out the merged results for the builders.
  -    if (2 <= builders.length) {
  +    if (builders.length > 1) {
         await new File("${outDirectory.path}/previous.json").writeAsString(
             mergedResults.values.map((data) => jsonEncode(data) + "\n").join(""));
  +    }
  +
  +    // Ensure that there is a flaky.json even if it wasn't downloaded.
  +    if (builders.length > 1 || options["report-flakes"]) {
         await new File("${outDirectory.path}/flaky.json").writeAsString(
             mergedFlaky.values.map((data) => jsonEncode(data) + "\n").join(""));
       }
  
positive.code:       "--silent-failures",
        "--write-results",
        "--write-logs",
      ]..addAll(options.rest);
      print("".padLeft(80, "="));
      print("Running tests");
      print("".padLeft(80, "="));
      await runProcessInheritStdio("python", ["tools/test.py"]..addAll(arguments),
          runInShell: Platform.isWindows);
  
      // Find the list of tests to deflake.
      final deflakeListOutput = await runProcess(Platform.resolvedExecutable, [
        "tools/bots/compare_results.dart",
        "--changed",
        "--failing",
        "--passing",
        "--flakiness-data=${outDirectory.path}/flaky.json",
        "${outDirectory.path}/previous.json",
        "${outDirectory.path}/results.json",
      ]);
      final deflakeListPath = "${outDirectory.path}/deflake.list";
      final deflakeListFile = new File(deflakeListPath);
      await deflakeListFile.writeAsString(deflakeListOutput.stdout);
  
      // Deflake the changed tests.
      final deflakingResultsPaths = <String>[];
      for (int i = 1;
          deflakeListOutput.stdout != "" && i <= deflakingCount;
          i++) {
        print("".padLeft(80, "="));
        print("Running deflaking iteration $i");
        print("".padLeft(80, "="));
        final deflakeDirectory = new Directory("${outDirectory.path}/$i");
        await deflakeDirectory.create();
        final deflakeArguments = <String>[
          "--named-configuration=$localConfiguration",
          "--output-directory=${deflakeDirectory.path}",
          "--clean-exit",
          "--silent-failures",
          "--write-results",
          "--test-list=$deflakeListPath",
        ]..addAll(options.rest);
        await runProcessInheritStdio(
            "python", ["tools/test.py"]..addAll(deflakeArguments),
            runInShell: Platform.isWindows);
        deflakingResultsPaths.add("${deflakeDirectory.path}/results.json");
      }
  
      // Update the flakiness information based on what we've learned.
      print("Updating flakiness information...");
      await runProcess(
          Platform.resolvedExecutable,
          [
            "tools/bots/update_flakiness.dart",
            "--input=${outDirectory.path}/flaky.json",
            "--output=${outDirectory.path}/flaky.json",
            "${outDirectory.path}/results.json",
          ]..addAll(deflakingResultsPaths));
  
      // Write out the final comparison.
      print("".padLeft(80, "="));
  
negative.code: void main(List<String> args) async {
    final parser = new ArgParser();
    parser.addOption("builder",
        abbr: "b", help: "Run tests like on the given builder");
    parser.addOption("branch",
        abbr: "B",
        help: "Select the builders building this branch",
        defaultsTo: "master");
    parser.addOption("commit", abbr: "C", help: "Compare with this commit");
    parser.addFlag("deflake",
        help: "Re-run failing newly tests $deflakingCount times.");
    parser.addFlag("report-flakes",
        help: "Report test failures for tests known to be flaky.\n"
            "This ignores all flakiness data from CI but flakes\n"
            "detected by --deflake will remain hidden");
    parser.addFlag("list-configurations",
        help: "Output list of configurations.", negatable: false);
    parser.addOption("named-configuration",
  