From 45e11715db3e7c5ac19f1d52aaeed7a9da4adcbd Mon Sep 17 00:00:00 2001 From: Alexander Thomas Date: Mon, 7 Jun 2021 14:04:32 +0000 Subject: [PATCH] [infra] Initial support for native arm64 builds on macOS Change-Id: Ia17f0839c87923deb877259069cab0d702d27aa6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202483 Commit-Queue: Alexander Thomas Reviewed-by: William Hesse --- DEPS | 17 +++++- tools/bots/aot_smoke_tests.dart | 104 -------------------------------- tools/bots/dart_aot_test.dart | 11 ---- tools/bots/dart_sdk.py | 2 +- tools/bots/test_matrix.json | 28 ++------- 5 files changed, 19 insertions(+), 143 deletions(-) delete mode 100755 tools/bots/aot_smoke_tests.dart delete mode 100755 tools/bots/dart_aot_test.dart diff --git a/DEPS b/DEPS index cff4d030e0a..75c1df60fcc 100644 --- a/DEPS +++ b/DEPS @@ -497,14 +497,25 @@ deps = { Var("dart_root") + "/third_party/pkg/yaml": Var("dart_git") + "yaml.git" + "@" + Var("yaml_rev"), - Var("dart_root") + "/buildtools/" + Var("host_os") + "-" + Var("host_cpu") + "/clang": { + Var("dart_root") + "/buildtools/" + Var("host_os") + "-x64/clang": { "packages": [ { - "package": "fuchsia/third_party/clang/${{platform}}", + "package": "fuchsia/third_party/clang/" + Var("host_os") + "-amd64", "version": "git_revision:" + Var("clang_revision"), }, ], - "condition": "(host_os == 'linux' or host_os == 'mac') and (host_cpu == 'x64' or host_cpu == 'arm64')", + # TODO(https://fxbug.dev/73385): Use arm64 toolchain on arm64 when it exists. + "condition": "host_cpu == x64 and (host_os == linux or host_os == mac) or host_cpu == arm64 and host_os == mac", + "dep_type": "cipd", + }, + Var("dart_root") + "/buildtools/linux-arm64/clang": { + "packages": [ + { + "package": "fuchsia/third_party/clang/linux-arm64", + "version": "git_revision:" + Var("clang_revision"), + }, + ], + "condition": "host_os == 'linux' and host_cpu == 'arm64'", "dep_type": "cipd", }, diff --git a/tools/bots/aot_smoke_tests.dart b/tools/bots/aot_smoke_tests.dart deleted file mode 100755 index 406fb087a0a..00000000000 --- a/tools/bots/aot_smoke_tests.dart +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env dart -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// Smoke test runner for Dart AOT (dart2native, dartaotruntime). -// aot_smoke_tests.dart and dart_aot_test.dart together form the test that the -// AOT toolchain is compiled and included correctly in the SDK. -// This tests that the AOT tools can both successfully compile Dart -> AOT and -// run the resulting AOT blob with the AOT runtime. - -import 'dart:io'; - -import 'package:path/path.dart' as path; -import 'package:test/test.dart'; - -final String newline = Platform.isWindows ? '\r\n' : '\n'; -final String executableSuffix = Platform.isWindows ? ".exe" : ""; -final String sdkBinDir = path.dirname(Platform.executable); -final String dartaotruntime = - path.join(sdkBinDir, 'dartaotruntime${executableSuffix}'); -final String dart = path.join(sdkBinDir, 'dart${executableSuffix}'); - -Future withTempDir(Future fun(String dir)) async { - final Directory tempDir = Directory.systemTemp.createTempSync(); - try { - await fun(tempDir.path); - } finally { - tempDir.deleteSync(recursive: true); - } -} - -void main(List args) { - test("Dart native: Can compile and run AOT snapshot", () async { - await withTempDir((String tmp) async { - final String testCode = path.join('tools', 'bots', 'dart_aot_test.dart'); - final String tmpAot = path.join(tmp, 'dart_aot_test.aot'); - - { - final ProcessResult result = await Process.run( - dart, ['compile', 'aot-snapshot', testCode, '--output', tmpAot]); - expect(result.stderr, ''); - expect(result.exitCode, 0); - } - - { - const String testStr = 'Dart AOT'; - final ProcessResult result = - await Process.run(dartaotruntime, [tmpAot, testStr]); - expect(result.stderr, ''); - expect(result.exitCode, 0); - expect(result.stdout, 'Hello, ${testStr}.${newline}'); - } - }); - }); - - test("Dart native: Can compile and run exe", () async { - await withTempDir((String tmp) async { - final String testCode = path.join('tools', 'bots', 'dart_aot_test.dart'); - final String tmpExe = path.join(tmp, 'dart_aot_test.exe'); - - { - final ProcessResult result = await Process.run( - dart, ['compile', 'exe', testCode, '--output', tmpExe]); - expect(result.stderr, ''); - expect(result.exitCode, 0); - } - - { - const String testStr = 'Dart AOT'; - final ProcessResult result = await Process.run(tmpExe, [testStr]); - expect(result.stderr, ''); - expect(result.exitCode, 0); - expect(result.stdout, 'Hello, ${testStr}.${newline}'); - } - }); - }); - - test("Dart native: Returns non-zero on missing file.", () async { - await withTempDir((String tmp) async { - final String testCode = path.join(tmp, 'does_not_exist.dart'); - final String tmpExe = path.join(tmp, 'dart_aot_test.exe'); - - { - final ProcessResult result = await Process.run( - dart, ['compile', 'exe', testCode, '--output', tmpExe]); - expect(result.exitCode, isNonZero); - } - }); - }); - - test("Dart native: Returns non-zero on non-file.", () async { - await withTempDir((String tmp) async { - final String testCode = tmp; // This is a directory, not a file. - final String tmpExe = path.join(tmp, 'dart_aot_test.exe'); - - { - final ProcessResult result = await Process.run( - dart, ['compile', 'exe', testCode, '--output', tmpExe]); - expect(result.exitCode, isNonZero); - } - }); - }); -} diff --git a/tools/bots/dart_aot_test.dart b/tools/bots/dart_aot_test.dart deleted file mode 100755 index 9449b274c2a..00000000000 --- a/tools/bots/dart_aot_test.dart +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env dart -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// Test program for Dart AOT (dart compile, dartaotruntime). - -void main(List args) async { - final String who = !args.isEmpty ? args[0] : '世界'; - print('Hello, ${who}.'); -} diff --git a/tools/bots/dart_sdk.py b/tools/bots/dart_sdk.py index d87632021c3..67f983af672 100755 --- a/tools/bots/dart_sdk.py +++ b/tools/bots/dart_sdk.py @@ -24,7 +24,7 @@ def BuildArchitectures(): if BUILD_OS == 'linux': return ['ia32', 'x64', 'arm', 'arm64'] elif BUILD_OS == 'macos': - return ['x64'] + return BUILD_ARCHITECTURE else: return ['ia32', 'x64'] diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json index 1d078c026b7..6058679b88e 100644 --- a/tools/bots/test_matrix.json +++ b/tools/bots/test_matrix.json @@ -1833,6 +1833,7 @@ "vm-kernel-linux-debug-x64c", "vm-kernel-mac-product-x64", "vm-kernel-mac-product-x64c", + "vm-kernel-mac-release-arm64", "vm-kernel-mac-release-x64", "vm-kernel-mac-release-x64c", "vm-kernel-mac-debug-x64", @@ -2838,13 +2839,6 @@ "name": "upload sdk", "script": "tools/bots/dart_sdk.py" }, - { - "name": "run AOT and Exe smoke tests", - "script": "out/ReleaseX64/dart-sdk/bin/dart", - "arguments": [ - "tools/bots/aot_smoke_tests.dart" - ] - }, { "name": "build api docs", "script": "tools/bots/dart_sdk.py", @@ -2856,7 +2850,8 @@ }, { "builders": [ - "dart-sdk-mac" + "dart-sdk-mac", + "dart-sdk-mac-arm64" ], "meta": { "description": "This configuration is used by the sdk-builders for MacOS." @@ -2866,7 +2861,6 @@ "name": "build dart", "script": "tools/build.py", "arguments": [ - "--arch=x64", "--mode=release", "--check-clean", "create_sdk" @@ -2878,13 +2872,6 @@ { "name": "upload sdk", "script": "tools/bots/dart_sdk.py" - }, - { - "name": "run AOT and Exe smoke tests", - "script": "xcodebuild/ReleaseX64/dart-sdk/bin/dart", - "arguments": [ - "tools/bots/aot_smoke_tests.dart" - ] } ] }, @@ -2909,13 +2896,6 @@ { "name": "upload sdk", "script": "tools/bots/dart_sdk.py" - }, - { - "name": "run AOT and Exe smoke tests", - "script": "out/ReleaseX64/dart-sdk/bin/dart.exe", - "arguments": [ - "tools/bots/aot_smoke_tests.dart" - ] } ] }, @@ -3628,7 +3608,7 @@ { "name": "analyze flutter/plugins", "script": "tools/bots/flutter/analyze_flutter_plugins.sh" - } + } ] }, {