Skip to content

Commit a3d1e1a

Browse files
mkustermannCommit Queue
authored andcommitted
[test_runner] Default to host architecture instead of X64 in test runner
When running the test runner without a specified architecture, it should default to the host architecture instead of hard-coded x64. This matters especially on all new Macs as those are arm64 Change-Id: I6cde0ff7d42aaf7eed31649b39b26d00198197c6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426463 Reviewed-by: Alexander Thomas <[email protected]> Commit-Queue: Martin Kustermann <[email protected]>
1 parent a2cb747 commit a3d1e1a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pkg/smith/lib/configuration.dart

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ class Configuration {
240240
var sanitizer = enumOption("sanitizer", Sanitizer.names, Sanitizer.find);
241241

242242
// Fill in any missing values using defaults when possible.
243-
architecture ??= Architecture.x64;
243+
architecture ??= Architecture.host;
244244
system ??= System.host;
245245
nnbdMode ??= NnbdMode.strong;
246246
sanitizer ??= Sanitizer.none;
@@ -765,6 +765,19 @@ class Architecture extends NamedEnum {
765765

766766
static final Architecture host = _computeHost();
767767
static Architecture _computeHost() {
768+
if (!const bool.hasEnvironment('dart.library.ffi')){
769+
// We're inside a test which very likely uses the `isXConfiguration`
770+
// getters from `package:expect/config.dart` which makes us
771+
// try to guess the [Configuration]`s architecture if it wasn't passed as
772+
// part of `const String.fromEnvironment("test_runner.configuration")`.
773+
//
774+
// A web app runs inside a browser doesn't have an architecture. Strictly
775+
// speaking we should *not* ask for "whats the current architecture" if
776+
// we are running on the web, as there's no answer.
777+
//
778+
// For now, fake it by returning x64 on the web.
779+
return Architecture.x64;
780+
}
768781
String? arch;
769782
if (Platform.isWindows) {
770783
arch = Platform.environment["PROCESSOR_ARCHITECTURE"];

0 commit comments

Comments
 (0)