File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
test/general.shard/runner Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -330,6 +330,8 @@ class UserMessages {
330
330
'You are using a locally built engine (--local-engine) but have not specified --local-engine-host.\n '
331
331
'You may be building with a different engine than the one you are running with. '
332
332
'See https://github.com/flutter/flutter/issues/132245 for details.' ;
333
+ String get runnerHostEngineRequiresLocalEngine =>
334
+ 'You must specify --local-engine if you are using --local-engine-host.' ;
333
335
String runnerNoEngineBuild (String engineBuildPath) =>
334
336
'No Flutter engine build found at $engineBuildPath .' ;
335
337
String runnerNoWebSdk (String webSdkPath) => 'No Flutter web sdk found at $webSdkPath .' ;
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ class LocalEngineLocator {
50
50
String ? localWebSdk,
51
51
String ? packagePath,
52
52
}) async {
53
+ if (localHostEngine != null && localEngine == null ) {
54
+ throwToolExit (_userMessages.runnerHostEngineRequiresLocalEngine, exitCode: 2 );
55
+ }
56
+
53
57
engineSourcePath ?? = _platform.environment[kFlutterEngineEnvironmentVariableName];
54
58
if (engineSourcePath == null &&
55
59
localEngine == null &&
Original file line number Diff line number Diff line change @@ -482,6 +482,32 @@ void main() {
482
482
);
483
483
},
484
484
);
485
+
486
+ testWithoutContext ('fails if --local-engine-host is used without --local-engine' , () async {
487
+ final FileSystem fileSystem = MemoryFileSystem .test ();
488
+ final Directory localEngine = fileSystem.directory (
489
+ '$kArbitraryEngineRoot /src/out/android_debug_unopt_arm64/' ,
490
+ )..createSync (recursive: true );
491
+ fileSystem
492
+ .directory ('$kArbitraryEngineRoot /src/out/host_debug_unopt/' )
493
+ .createSync (recursive: true );
494
+
495
+ final BufferLogger logger = BufferLogger .test ();
496
+ final LocalEngineLocator localEngineLocator = LocalEngineLocator (
497
+ fileSystem: fileSystem,
498
+ flutterRoot: 'flutter/flutter' ,
499
+ logger: logger,
500
+ userMessages: UserMessages (),
501
+ platform: FakePlatform (environment: < String , String > {}),
502
+ );
503
+
504
+ await expectLater (
505
+ localEngineLocator.findEnginePath (localHostEngine: localEngine.path),
506
+ throwsToolExit (
507
+ message: 'You must specify --local-engine if you are using --local-engine-host.' ,
508
+ ),
509
+ );
510
+ });
485
511
}
486
512
487
513
Matcher matchesEngineBuildPaths ({String ? hostEngine, String ? targetEngine}) {
You can’t perform that action at this time.
0 commit comments