Skip to content

Commit 2565128

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[infra] Shard Mac AOT builders.
Use a combination of gen_snapshot's new ability to generate dylibs directly and the copy of llvm in buildtools to avoid using XCode, which is not available in shards. Add definitions for debug builders now that they can complete without timing out. Cq-Include-Trybots: luci.dart.try:vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try Change-Id: I79924128f11aafab4cd74ea6e9ab5848c64557da Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431700 Reviewed-by: Tess Strickland <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent 4fb105e commit 2565128

File tree

3 files changed

+71
-105
lines changed

3 files changed

+71
-105
lines changed

runtime/tests/vm/dart/use_flag_test_helper.dart

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import 'dart:convert';
66
import 'dart:io';
7+
import 'dart:ffi';
78

89
import 'package:expect/config.dart';
910
import 'package:expect/expect.dart';
@@ -68,23 +69,40 @@ final checkedInDartVM = path.join(
6869
// Lazily initialize 'lipo' so that tests that don't use it on platforms
6970
// that don't have it don't fail.
7071
late final lipo = () {
71-
final path = "/usr/bin/lipo";
72-
if (File(path).existsSync()) {
73-
return path;
72+
final clangBuildTools = clangBuildToolsDir;
73+
if (clangBuildTools != null) {
74+
final lipoPath = path.join(clangBuildTools, "llvm-lipo");
75+
if (File(lipoPath).existsSync()) {
76+
return lipoPath;
77+
}
78+
throw 'Could not find lipo binary at $lipoPath';
7479
}
75-
throw 'Could not find lipo binary at $path';
80+
throw 'Could not find lipo binary';
7681
}();
7782

7883
final isSimulator = path.basename(buildDir).contains('SIM');
7984

8085
String? get clangBuildToolsDir {
8186
String archDir;
82-
if (Platform.isLinux) {
83-
archDir = 'linux-x64';
84-
} else if (Platform.isMacOS) {
85-
archDir = 'mac-x64';
86-
} else {
87-
return null;
87+
switch (Abi.current()) {
88+
case Abi.linuxX64:
89+
archDir = 'linux-x64';
90+
break;
91+
case Abi.linuxArm64:
92+
archDir = 'linux-arm64';
93+
break;
94+
case Abi.macosX64:
95+
archDir = 'mac-x64';
96+
break;
97+
case Abi.macosArm64:
98+
archDir = 'mac-arm64';
99+
break;
100+
case Abi.windowsX64:
101+
case Abi.windowsArm64: // We don't have a proper host win-arm64 toolchain.
102+
archDir = 'win-x64';
103+
break;
104+
default:
105+
return null;
88106
}
89107
var clangDir = path.join(sdkDir, 'buildtools', archDir, 'clang', 'bin');
90108
return Directory(clangDir).existsSync() ? clangDir : null;
@@ -104,45 +122,44 @@ Future<void> assembleSnapshot(
104122
String cc = 'gcc';
105123
String shared = '-shared';
106124

107-
if (buildDir.endsWith('SIMRISCV64')) {
108-
cc = 'riscv64-linux-gnu-gcc';
109-
} else if (isSimulator) {
110-
// For other simulators, depend on buildtools existing.
111-
final clangBuildTools = clangBuildToolsDir;
112-
if (clangBuildTools != null) {
113-
cc = path.join(clangBuildTools, 'clang');
114-
} else {
115-
throw 'Cannot assemble for ${path.basename(buildDir)} '
116-
'without //buildtools on ${Platform.operatingSystem}';
117-
}
118-
} else if (Platform.isMacOS) {
119-
cc = 'clang';
125+
final clangBuildTools = clangBuildToolsDir;
126+
if (clangBuildTools != null) {
127+
cc = path.join(clangBuildTools, Platform.isWindows ? 'clang.exe' : 'clang');
128+
} else {
129+
throw 'Cannot assemble for ${path.basename(buildDir)} '
130+
'without //buildtools on ${Platform.operatingSystem}';
120131
}
121132

122-
if (buildDir.endsWith('SIMARM')) {
123-
ccFlags.add('--target=armv7-linux-gnueabihf');
124-
} else if (buildDir.endsWith('SIMARM64')) {
125-
ccFlags.add('--target=aarch64-linux-gnu');
126-
} else if (buildDir.endsWith('SIMRISCV64')) {
127-
ccFlags.add('--target=riscv64-linux-gnu');
128-
} else if (Platform.isMacOS) {
133+
if (Platform.isMacOS) {
129134
shared = '-dynamiclib';
130135
// Tell Mac linker to give up generating eh_frame from dwarf.
131136
ldFlags.add('-Wl,-no_compact_unwind');
137+
if (buildDir.endsWith('ARM64')) {
138+
ccFlags.add('--target=arm64-apple-darwin');
139+
} else {
140+
ccFlags.add('--target=x86_64-apple-darwin');
141+
}
142+
} else if (Platform.isLinux) {
143+
if (buildDir.endsWith('ARM')) {
144+
ccFlags.add('--target=armv7-linux-gnueabihf');
145+
} else if (buildDir.endsWith('ARM64')) {
146+
ccFlags.add('--target=aarch64-linux-gnu');
147+
} else if (buildDir.endsWith('X64')) {
148+
ccFlags.add('--target=x86_64-linux-gnu');
149+
} else if (buildDir.endsWith('RISCV64')) {
150+
ccFlags.add('--target=riscv64-linux-gnu');
151+
}
132152
}
133153

134-
if (buildDir.endsWith('X64') || buildDir.endsWith('SIMARM64')) {
135-
ccFlags.add('-m64');
136-
}
137154
if (debug) {
138155
ccFlags.add('-g');
139156
}
140157

141158
await run(cc, <String>[
142159
...ccFlags,
143160
...ldFlags,
161+
'-nostdlib',
144162
shared,
145-
if (!Platform.isMacOS) '-nostdlib',
146163
'-o',
147164
snapshotPath,
148165
assemblyPath,

tests/ffi/native_assets/helpers.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,13 @@ Future<void> runGenSnapshot({
256256
// `computeAssembleCommand`.
257257
if (Platform.isMacOS) {
258258
await runProcess(
259-
executable: 'clang',
259+
executable: Abi.current() == Abi.macosArm64
260+
? 'buildtools/mac-arm64/clang/bin/clang'
261+
: 'buildtools/mac-x64/clang/bin/clang',
260262
arguments: [
261263
'-Wl,-undefined,error',
262264
'-Wl,-no_compact_unwind',
265+
'-nostdlib',
263266
'-dynamiclib',
264267
'-o',
265268
outputUri.toFilePath(),

tools/bots/test_matrix.json

Lines changed: 16 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,11 @@
132132
"pkg/",
133133
"samples/",
134134
"tools/",
135-
"buildtools/linux-arm64/clang/bin/llvm",
136-
"buildtools/linux-arm64/clang/bin/llvm-nm",
137-
"buildtools/linux-arm64/clang/bin/llvm-strip",
138-
"buildtools/linux-arm64/clang/bin/llvm-symbolizer",
139-
"buildtools/linux-x64/clang/bin/llvm",
140-
"buildtools/linux-x64/clang/bin/llvm-nm",
141-
"buildtools/linux-x64/clang/bin/llvm-strip",
142-
"buildtools/linux-x64/clang/bin/llvm-symbolizer",
143-
"buildtools/mac-arm64/clang/bin/llvm",
144-
"buildtools/mac-arm64/clang/bin/llvm-nm",
145-
"buildtools/mac-arm64/clang/bin/llvm-strip",
146-
"buildtools/mac-arm64/clang/bin/llvm-symbolizer",
135+
"buildtools/linux-arm64/clang/bin/",
136+
"buildtools/linux-x64/clang/bin/",
137+
"buildtools/mac-arm64/clang/bin/",
147138
"buildtools/mac-arm64/clang/lib/clang/21/lib/darwin/",
148-
"buildtools/mac-x64/clang/bin/llvm",
149-
"buildtools/mac-x64/clang/bin/llvm-nm",
150-
"buildtools/mac-x64/clang/bin/llvm-strip",
151-
"buildtools/mac-x64/clang/bin/llvm-symbolizer",
139+
"buildtools/mac-x64/clang/bin/",
152140
"buildtools/mac-x64/clang/lib/clang/21/lib/darwin/",
153141
"buildtools/win-x64/clang/bin/llvm-symbolizer.exe",
154142
"third_party/android_tools/sdk/platform-tools/adb",
@@ -313,9 +301,14 @@
313301
"enable-asserts": true
314302
}
315303
},
316-
"vm-aot-(linux|mac|fuchsia)-(debug|product|release)-(x64|x64c|arm64|arm64c)": {
304+
"vm-aot-(linux|fuchsia)-(debug|product|release)-(x64|x64c|arm64|arm64c)": {
317305
"options": {}
318306
},
307+
"vm-aot-mac-(debug|product|release)-(x64|x64c|arm64|arm64c)": {
308+
"options": {
309+
"gen-snapshot-format" : "macho-dylib"
310+
}
311+
},
319312
"vm-aot-win-(debug|product|release)-(x64|x64c|arm64|arm64c)": {
320313
"options": {
321314
"gen-snapshot-format" : "elf"
@@ -1075,6 +1068,11 @@
10751068
"vm-aot-linux-debug-x64c",
10761069
"vm-aot-linux-product-x64",
10771070
"vm-aot-linux-release-simarm64",
1071+
"vm-aot-mac-debug-arm64",
1072+
"vm-aot-mac-debug-x64",
1073+
"vm-aot-mac-product-arm64",
1074+
"vm-aot-mac-release-arm64",
1075+
"vm-aot-mac-release-x64",
10781076
"vm-aot-win-debug-x64",
10791077
"vm-aot-win-debug-x64c",
10801078
"vm-aot-win-product-x64"
@@ -1087,6 +1085,7 @@
10871085
"name": "build dart",
10881086
"script": "tools/build.py",
10891087
"arguments": [
1088+
"--codesigning-identity=-",
10901089
"runtime",
10911090
"dartaotruntime"
10921091
]
@@ -1138,59 +1137,6 @@
11381137
}
11391138
]
11401139
},
1141-
{
1142-
"builders": [
1143-
"vm-aot-mac-release-arm64",
1144-
"vm-aot-mac-release-x64"
1145-
],
1146-
"meta": {
1147-
"description": "This configuration is used by the VM AOT builders. Without shards because shards are missing XCode. Includes VM service testing."
1148-
},
1149-
"steps": [
1150-
{
1151-
"name": "build dart",
1152-
"script": "tools/build.py",
1153-
"arguments": [
1154-
"--codesigning-identity=-",
1155-
"runtime",
1156-
"dartaotruntime"
1157-
]
1158-
},
1159-
{
1160-
"name": "vm tests",
1161-
"arguments": [
1162-
"-nvm-aot-${system}-${mode}-${arch}",
1163-
"--default-suites",
1164-
"pkg/pkg/vm_service/"
1165-
]
1166-
}
1167-
]
1168-
},
1169-
{
1170-
"builders": [
1171-
"vm-aot-mac-product-arm64"
1172-
],
1173-
"meta": {
1174-
"description": "This configuration is used by the VM AOT builders. Without shards because shards are missing XCode."
1175-
},
1176-
"steps": [
1177-
{
1178-
"name": "build dart",
1179-
"script": "tools/build.py",
1180-
"arguments": [
1181-
"--codesigning-identity=-",
1182-
"runtime",
1183-
"dartaotruntime"
1184-
]
1185-
},
1186-
{
1187-
"name": "vm tests",
1188-
"arguments": [
1189-
"-nvm-aot-${system}-${mode}-${arch}"
1190-
]
1191-
}
1192-
]
1193-
},
11941140
{
11951141
"builders": [
11961142
"vm-aot-dwarf-linux-product-x64"

0 commit comments

Comments
 (0)