Ensure Xcode project is setup to start debugger (#136977)

Some users have their Xcode settings set to not debug (see example here https://github.com/flutter/flutter/issues/136197#issuecomment-1766834195). This will cause the [engine check for a debugger](22ce5c6a45/runtime/ptrace_check.cc (L56-L71)) to fail, which will cause an error and cause the app to crash.

This PR parses the scheme file to ensure the scheme is set to start a debugger and warn the user if it's not.

Fixes https://github.com/flutter/flutter/issues/136197.
This commit is contained in:
Victoria Ashworth
2023-10-25 12:08:57 -05:00
committed by GitHub
parent 9366170e84
commit 5dd2a4e0aa
11 changed files with 385 additions and 9 deletions

View File

@@ -0,0 +1,52 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/integration_tests.dart';
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.ios;
await task(() async {
await createFlavorsTest(environment: <String, String>{
'FORCE_XCODE_DEBUG': 'true',
}).call();
await createIntegrationTestFlavorsTest(environment: <String, String>{
'FORCE_XCODE_DEBUG': 'true',
}).call();
// test install and uninstall of flavors app
final TaskResult installTestsResult = await inDirectory(
'${flutterDirectory.path}/dev/integration_tests/flavors',
() async {
await flutter(
'install',
options: <String>['--flavor', 'paid'],
);
await flutter(
'install',
options: <String>['--flavor', 'paid', '--uninstall-only'],
);
final StringBuffer stderr = StringBuffer();
await evalFlutter(
'install',
canFail: true,
stderr: stderr,
options: <String>['--flavor', 'bogus'],
);
final String stderrString = stderr.toString();
if (!stderrString.contains('The Xcode project defines schemes: free, paid')) {
print(stderrString);
return TaskResult.failure('Should not succeed with bogus flavor');
}
return TaskResult.success(null);
},
);
return installTestsResult;
});
}

View File

@@ -22,19 +22,21 @@ TaskFunction createPlatformInteractionTest() {
).call;
}
TaskFunction createFlavorsTest() {
TaskFunction createFlavorsTest({Map<String, String>? environment}) {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/flavors',
'lib/main.dart',
extraOptions: <String>['--flavor', 'paid'],
environment: environment,
).call;
}
TaskFunction createIntegrationTestFlavorsTest() {
TaskFunction createIntegrationTestFlavorsTest({Map<String, String>? environment}) {
return IntegrationTest(
'${flutterDirectory.path}/dev/integration_tests/flavors',
'integration_test/integration_test.dart',
extraOptions: <String>['--flavor', 'paid'],
environment: environment,
).call;
}
@@ -219,6 +221,7 @@ class IntegrationTest {
this.extraOptions = const <String>[],
this.createPlatforms = const <String>[],
this.withTalkBack = false,
this.environment,
}
);
@@ -227,6 +230,7 @@ class IntegrationTest {
final List<String> extraOptions;
final List<String> createPlatforms;
final bool withTalkBack;
final Map<String, String>? environment;
Future<TaskResult> call() {
return inDirectory<TaskResult>(testDirectory, () async {
@@ -258,7 +262,7 @@ class IntegrationTest {
testTarget,
...extraOptions,
];
await flutter('test', options: options);
await flutter('test', options: options, environment: environment);
if (withTalkBack) {
await disableTalkBack();