[infra] Fix batch mode crashes uploading crash dumps.

Batch mode crashes were treated as if they exited -10 (SIGUSR1 on Linux),
however these are all Dart unhandled exceptions, and no crash dumps were
produced. Exit 253 instead, which dart2js uses to signify an internal
compiler error, which is considered a crash but inhibits uploading crash
reports.

Change-Id: I3779ec1c511c1bcd31967254d3e0cee9a347a9bd
Reviewed-on: https://dart-review.googlesource.com/c/87440
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: William Hesse <whesse@google.com>
diff --git a/tools/testing/dart/command_output.dart b/tools/testing/dart/command_output.dart
index ed4a653..a392933 100644
--- a/tools/testing/dart/command_output.dart
+++ b/tools/testing/dart/command_output.dart
@@ -66,14 +66,15 @@
     // dart2js exits with code 253 in case of unhandled exceptions.
     // The dart binary exits with code 253 in case of an API error such
     // as an invalid snapshot file.
+    // The batch mode can also exit 253 (unhandledCompilerExceptionExitCode).
     // In either case an exit code of 253 is considered a crash.
-    if (exitCode == 253) return true;
+    if (exitCode == unhandledCompilerExceptionExitCode) return true;
     if (exitCode == parseFailExitCode) return false;
     if (hasTimedOut) return false;
     if (io.Platform.isWindows) {
       // The VM uses std::abort to terminate on asserts.
       // std::abort terminates with exit code 3 on Windows.
-      if (exitCode == 3 || exitCode == browserCrashExitCode) return true;
+      if (exitCode == 3) return true;
 
       // When VM is built with Crashpad support we get STATUS_FATAL_APP_EXIT
       // for all crashes that Crashpad has intercepted.
@@ -92,7 +93,7 @@
   }
 
   bool get hasCoreDump {
-    // dart2js crashes don't produce crashdumps.
+    // Unhandled dart exceptions don't produce crashdumps.
     return hasCrashed && exitCode != 253;
   }
 
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index 17e0b60..2081403 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -31,7 +31,7 @@
 import 'test_suite.dart';
 import 'utils.dart';
 
-const int browserCrashExitCode = -10;
+const int unhandledCompilerExceptionExitCode = 253;
 const int parseFailExitCode = 245;
 const int slowTimeoutMultiplier = 4;
 const int extraSlowTimeoutMultiplier = 8;
@@ -712,7 +712,7 @@
 
     var outcome = _status.split(" ")[2];
     var exitCode = 0;
-    if (outcome == "CRASH") exitCode = browserCrashExitCode;
+    if (outcome == "CRASH") exitCode = unhandledCompilerExceptionExitCode;
     if (outcome == "PARSE_FAIL") exitCode = parseFailExitCode;
     if (outcome == "FAIL" || outcome == "TIMEOUT") exitCode = 1;
     var output = createCommandOutput(