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 {
330330 'You are using a locally built engine (--local-engine) but have not specified --local-engine-host.\n '
331331 'You may be building with a different engine than the one you are running with. '
332332 '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.' ;
333335 String runnerNoEngineBuild (String engineBuildPath) =>
334336 'No Flutter engine build found at $engineBuildPath .' ;
335337 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 {
5050 String ? localWebSdk,
5151 String ? packagePath,
5252 }) async {
53+ if (localHostEngine != null && localEngine == null ) {
54+ throwToolExit (_userMessages.runnerHostEngineRequiresLocalEngine, exitCode: 2 );
55+ }
56+
5357 engineSourcePath ?? = _platform.environment[kFlutterEngineEnvironmentVariableName];
5458 if (engineSourcePath == null &&
5559 localEngine == null &&
Original file line number Diff line number Diff line change @@ -482,6 +482,32 @@ void main() {
482482 );
483483 },
484484 );
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+ });
485511}
486512
487513Matcher matchesEngineBuildPaths ({String ? hostEngine, String ? targetEngine}) {
You can’t perform that action at this time.
0 commit comments