Skip to content

Commit 760f8cf

Browse files
committed
fix: address flutter_tools test failures
- build_test.dart: GenSnapshot now requires a `fileSystem` parameter (added by this branch for the analyze_snapshot probe path); pass `MemoryFileSystem.test()` to the test constructor. - macos_test.dart: the DD pass is gated on SHOREBIRD_DD_MAX_BYTES, which isn't set in the test environment, so neither arm64 nor x86_64 has an extra async hop before gen_snapshot. With concurrent Future.wait the archs now reach gen_snapshot in iteration order (arm64 first, x86_64 second). Update the expected command sequence and the explanatory comment to match.
1 parent d13559f commit 760f8cf

2 files changed

Lines changed: 34 additions & 31 deletions

File tree

packages/flutter_tools/test/general.shard/base/build_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ void main() {
6363
artifacts: artifacts,
6464
logger: logger,
6565
processManager: processManager,
66+
fileSystem: MemoryFileSystem.test(),
6667
);
6768
});
6869

packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -889,64 +889,66 @@ flavors:
889889
.createSync(recursive: true);
890890

891891
final build = environment.buildDir.path;
892-
// Because arm64 goes through an async _computeDDTable() check (even
893-
// though it returns immediately when analyze_snapshot is absent), x86_64
894-
// reaches gen_snapshot first when both run concurrently via Future.wait.
895-
// After that first yield, the two builds interleave at each await point.
892+
// Both archs go through the same code path now (the DD-pass is gated on
893+
// SHOREBIRD_DD_MAX_BYTES which isn't set in this test), so neither
894+
// architecture has an extra async hop. With concurrent Future.wait, the
895+
// archs reach gen_snapshot in iteration order: arm64 first
896+
// (`kDarwinArchs = 'arm64 x86_64'`), x86_64 second. They then
897+
// interleave at each subsequent await point in the same order.
896898
processManager.addCommands(<FakeCommand>[
897-
// x86_64 gen_snapshot runs first (arm64 is still in _computeDDTable).
899+
// arm64 gen_snapshot runs first (iteration order).
898900
FakeCommand(
899901
command: <String>[
900-
'Artifact.genSnapshotX64.TargetPlatform.darwin.release',
902+
'Artifact.genSnapshotArm64.TargetPlatform.darwin.release',
901903
'--deterministic',
902904
...linkInfoArgsFor(build),
903905
'--snapshot_kind=app-aot-assembly',
904-
'--assembly=${environment.buildDir.childFile('x86_64/snapshot_assembly.S').path}',
906+
'--assembly=${environment.buildDir.childFile('arm64/snapshot_assembly.S').path}',
905907
environment.buildDir.childFile('app.dill').path,
906908
],
907909
),
908-
// arm64 gen_snapshot runs next.
910+
// x86_64 gen_snapshot runs next.
909911
FakeCommand(
910912
command: <String>[
911-
'Artifact.genSnapshotArm64.TargetPlatform.darwin.release',
913+
'Artifact.genSnapshotX64.TargetPlatform.darwin.release',
912914
'--deterministic',
913915
...linkInfoArgsFor(build),
914916
'--snapshot_kind=app-aot-assembly',
915-
'--assembly=${environment.buildDir.childFile('arm64/snapshot_assembly.S').path}',
917+
'--assembly=${environment.buildDir.childFile('x86_64/snapshot_assembly.S').path}',
916918
environment.buildDir.childFile('app.dill').path,
917919
],
918920
),
919-
// From here on the two builds interleave: x86_64 then arm64 at each step.
921+
// From here on the two builds interleave: arm64 then x86_64 at each step.
920922
FakeCommand(
921923
command: <String>[
922924
'xcrun',
923925
'cc',
924926
'-arch',
925-
'x86_64',
927+
'arm64',
926928
'-c',
927-
environment.buildDir.childFile('x86_64/snapshot_assembly.S').path,
929+
environment.buildDir.childFile('arm64/snapshot_assembly.S').path,
928930
'-o',
929-
environment.buildDir.childFile('x86_64/snapshot_assembly.o').path,
931+
environment.buildDir.childFile('arm64/snapshot_assembly.o').path,
930932
],
931933
),
932934
FakeCommand(
933935
command: <String>[
934936
'xcrun',
935937
'cc',
936938
'-arch',
937-
'arm64',
939+
'x86_64',
938940
'-c',
939-
environment.buildDir.childFile('arm64/snapshot_assembly.S').path,
941+
environment.buildDir.childFile('x86_64/snapshot_assembly.S').path,
940942
'-o',
941-
environment.buildDir.childFile('arm64/snapshot_assembly.o').path,
943+
environment.buildDir.childFile('x86_64/snapshot_assembly.o').path,
942944
],
943945
),
944946
FakeCommand(
945947
command: <String>[
946948
'xcrun',
947949
'clang',
948950
'-arch',
949-
'x86_64',
951+
'arm64',
950952
'-dynamiclib',
951953
'-Xlinker',
952954
'-rpath',
@@ -960,16 +962,16 @@ flavors:
960962
'-install_name',
961963
'@rpath/App.framework/App',
962964
'-o',
963-
environment.buildDir.childFile('x86_64/App.framework/App').path,
964-
environment.buildDir.childFile('x86_64/snapshot_assembly.o').path,
965+
environment.buildDir.childFile('arm64/App.framework/App').path,
966+
environment.buildDir.childFile('arm64/snapshot_assembly.o').path,
965967
],
966968
),
967969
FakeCommand(
968970
command: <String>[
969971
'xcrun',
970972
'clang',
971973
'-arch',
972-
'arm64',
974+
'x86_64',
973975
'-dynamiclib',
974976
'-Xlinker',
975977
'-rpath',
@@ -983,46 +985,46 @@ flavors:
983985
'-install_name',
984986
'@rpath/App.framework/App',
985987
'-o',
986-
environment.buildDir.childFile('arm64/App.framework/App').path,
987-
environment.buildDir.childFile('arm64/snapshot_assembly.o').path,
988+
environment.buildDir.childFile('x86_64/App.framework/App').path,
989+
environment.buildDir.childFile('x86_64/snapshot_assembly.o').path,
988990
],
989991
),
990992
FakeCommand(
991993
command: <String>[
992994
'xcrun',
993995
'dsymutil',
994996
'-o',
995-
environment.buildDir.childFile('x86_64/App.framework.dSYM').path,
996-
environment.buildDir.childFile('x86_64/App.framework/App').path,
997+
environment.buildDir.childFile('arm64/App.framework.dSYM').path,
998+
environment.buildDir.childFile('arm64/App.framework/App').path,
997999
],
9981000
),
9991001
FakeCommand(
10001002
command: <String>[
10011003
'xcrun',
10021004
'dsymutil',
10031005
'-o',
1004-
environment.buildDir.childFile('arm64/App.framework.dSYM').path,
1005-
environment.buildDir.childFile('arm64/App.framework/App').path,
1006+
environment.buildDir.childFile('x86_64/App.framework.dSYM').path,
1007+
environment.buildDir.childFile('x86_64/App.framework/App').path,
10061008
],
10071009
),
10081010
FakeCommand(
10091011
command: <String>[
10101012
'xcrun',
10111013
'strip',
10121014
'-x',
1013-
environment.buildDir.childFile('x86_64/App.framework/App').path,
1015+
environment.buildDir.childFile('arm64/App.framework/App').path,
10141016
'-o',
1015-
environment.buildDir.childFile('x86_64/App.framework/App').path,
1017+
environment.buildDir.childFile('arm64/App.framework/App').path,
10161018
],
10171019
),
10181020
FakeCommand(
10191021
command: <String>[
10201022
'xcrun',
10211023
'strip',
10221024
'-x',
1023-
environment.buildDir.childFile('arm64/App.framework/App').path,
1025+
environment.buildDir.childFile('x86_64/App.framework/App').path,
10241026
'-o',
1025-
environment.buildDir.childFile('arm64/App.framework/App').path,
1027+
environment.buildDir.childFile('x86_64/App.framework/App').path,
10261028
],
10271029
),
10281030
FakeCommand(

0 commit comments

Comments
 (0)