Add more supported simulator debugging options and improve tests (#114628)
* add debugging options to simulator, test more debugging flags, add tests for other launch arguements * refactor iOS launch arguments to use one function for both simulator and physical devices * treat dart flags differently between physical and simulator * Simplify some flags between devices. Change --disable-service-auth-codes to not always be included for physical devices, only if disableServiceAuthCodes is true. Change --disable-observatory-publication to be used for simulator devices too. Change --enable-checked-mode & --verify-entry-points to be used if debuggingEnabled is true regardless of device type. Chnage --trace-startup to be used for simulator devices too. * fix ios release mode with buildable app startApp test * determine observatory-port from deviceVmServicePort and hostVmServicePort * add comments and remove hasObservatoryPort
This commit is contained in:
committed by
GitHub
parent
d3dcd7d532
commit
3a656b16cb
@@ -466,6 +466,205 @@ void main() {
|
||||
expect(deserialized.enableImpeller, original.enableImpeller);
|
||||
});
|
||||
});
|
||||
|
||||
group('Get iOS launch arguments from DebuggingOptions', () {
|
||||
testWithoutContext('Get launch arguments for physical device with debugging enabled with all launch arguments', () {
|
||||
final DebuggingOptions original = DebuggingOptions.enabled(
|
||||
BuildInfo.debug,
|
||||
startPaused: true,
|
||||
disableServiceAuthCodes: true,
|
||||
disablePortPublication: true,
|
||||
dartFlags: '--foo',
|
||||
useTestFonts: true,
|
||||
enableSoftwareRendering: true,
|
||||
skiaDeterministicRendering: true,
|
||||
traceSkia: true,
|
||||
traceAllowlist: 'foo',
|
||||
traceSkiaAllowlist: 'skia.a,skia.b',
|
||||
traceSystrace: true,
|
||||
endlessTraceBuffer: true,
|
||||
dumpSkpOnShaderCompilation: true,
|
||||
cacheSkSL: true,
|
||||
purgePersistentCache: true,
|
||||
verboseSystemLogs: true,
|
||||
nullAssertions: true,
|
||||
enableImpeller: true,
|
||||
deviceVmServicePort: 0,
|
||||
hostVmServicePort: 1,
|
||||
);
|
||||
|
||||
final List<String> launchArguments = original.getIOSLaunchArguments(
|
||||
EnvironmentType.physical,
|
||||
'/test',
|
||||
<String, dynamic>{
|
||||
'trace-startup': true,
|
||||
},
|
||||
);
|
||||
|
||||
expect(
|
||||
launchArguments.join(' '),
|
||||
<String>[
|
||||
'--enable-dart-profiling',
|
||||
'--disable-service-auth-codes',
|
||||
'--disable-observatory-publication',
|
||||
'--start-paused',
|
||||
'--dart-flags="--foo,--null_assertions"',
|
||||
'--use-test-fonts',
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
'--enable-software-rendering',
|
||||
'--trace-systrace',
|
||||
'--skia-deterministic-rendering',
|
||||
'--trace-skia',
|
||||
'--trace-allowlist="foo"',
|
||||
'--trace-skia-allowlist="skia.a,skia.b"',
|
||||
'--endless-trace-buffer',
|
||||
'--dump-skp-on-shader-compilation',
|
||||
'--verbose-logging',
|
||||
'--cache-sksl',
|
||||
'--purge-persistent-cache',
|
||||
'--route=/test',
|
||||
'--trace-startup',
|
||||
'--enable-impeller',
|
||||
'--observatory-port=0',
|
||||
].join(' '),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('Get launch arguments for physical device with debugging enabled with no launch arguments', () {
|
||||
final DebuggingOptions original = DebuggingOptions.enabled(
|
||||
BuildInfo.debug,
|
||||
);
|
||||
|
||||
final List<String> launchArguments = original.getIOSLaunchArguments(
|
||||
EnvironmentType.physical,
|
||||
null,
|
||||
<String, Object?>{},
|
||||
);
|
||||
|
||||
expect(
|
||||
launchArguments.join(' '),
|
||||
<String>[
|
||||
'--enable-dart-profiling',
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
].join(' '),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('Get launch arguments for physical device with debugging disabled with available launch arguments', () {
|
||||
final DebuggingOptions original = DebuggingOptions.disabled(
|
||||
BuildInfo.debug,
|
||||
traceAllowlist: 'foo',
|
||||
cacheSkSL: true,
|
||||
enableImpeller: true,
|
||||
);
|
||||
|
||||
final List<String> launchArguments = original.getIOSLaunchArguments(
|
||||
EnvironmentType.physical,
|
||||
'/test',
|
||||
<String, dynamic>{
|
||||
'trace-startup': true,
|
||||
},
|
||||
);
|
||||
|
||||
expect(
|
||||
launchArguments.join(' '),
|
||||
<String>[
|
||||
'--enable-dart-profiling',
|
||||
'--trace-allowlist="foo"',
|
||||
'--cache-sksl',
|
||||
'--route=/test',
|
||||
'--trace-startup',
|
||||
'--enable-impeller',
|
||||
].join(' '),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('Get launch arguments for simulator device with debugging enabled with all launch arguments', () {
|
||||
final DebuggingOptions original = DebuggingOptions.enabled(
|
||||
BuildInfo.debug,
|
||||
startPaused: true,
|
||||
disableServiceAuthCodes: true,
|
||||
disablePortPublication: true,
|
||||
dartFlags: '--foo',
|
||||
useTestFonts: true,
|
||||
enableSoftwareRendering: true,
|
||||
skiaDeterministicRendering: true,
|
||||
traceSkia: true,
|
||||
traceAllowlist: 'foo',
|
||||
traceSkiaAllowlist: 'skia.a,skia.b',
|
||||
traceSystrace: true,
|
||||
endlessTraceBuffer: true,
|
||||
dumpSkpOnShaderCompilation: true,
|
||||
cacheSkSL: true,
|
||||
purgePersistentCache: true,
|
||||
verboseSystemLogs: true,
|
||||
nullAssertions: true,
|
||||
enableImpeller: true,
|
||||
deviceVmServicePort: 0,
|
||||
hostVmServicePort: 1,
|
||||
);
|
||||
|
||||
final List<String> launchArguments = original.getIOSLaunchArguments(
|
||||
EnvironmentType.simulator,
|
||||
'/test',
|
||||
<String, dynamic>{
|
||||
'trace-startup': true,
|
||||
},
|
||||
);
|
||||
|
||||
expect(
|
||||
launchArguments.join(' '),
|
||||
<String>[
|
||||
'--enable-dart-profiling',
|
||||
'--disable-service-auth-codes',
|
||||
'--disable-observatory-publication',
|
||||
'--start-paused',
|
||||
'--dart-flags=--foo,--null_assertions',
|
||||
'--use-test-fonts',
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
'--enable-software-rendering',
|
||||
'--trace-systrace',
|
||||
'--skia-deterministic-rendering',
|
||||
'--trace-skia',
|
||||
'--trace-allowlist="foo"',
|
||||
'--trace-skia-allowlist="skia.a,skia.b"',
|
||||
'--endless-trace-buffer',
|
||||
'--dump-skp-on-shader-compilation',
|
||||
'--verbose-logging',
|
||||
'--cache-sksl',
|
||||
'--purge-persistent-cache',
|
||||
'--route=/test',
|
||||
'--trace-startup',
|
||||
'--enable-impeller',
|
||||
'--observatory-port=1',
|
||||
].join(' '),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('Get launch arguments for simulator device with debugging enabled with no launch arguments', () {
|
||||
final DebuggingOptions original = DebuggingOptions.enabled(
|
||||
BuildInfo.debug,
|
||||
);
|
||||
|
||||
final List<String> launchArguments = original.getIOSLaunchArguments(
|
||||
EnvironmentType.simulator,
|
||||
null,
|
||||
<String, Object?>{},
|
||||
);
|
||||
|
||||
expect(
|
||||
launchArguments.join(' '),
|
||||
<String>[
|
||||
'--enable-dart-profiling',
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
].join(' '),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
class TestDeviceManager extends DeviceManager {
|
||||
|
||||
@@ -205,7 +205,6 @@ void main() {
|
||||
'--args',
|
||||
const <String>[
|
||||
'--enable-dart-profiling',
|
||||
'--disable-service-auth-codes',
|
||||
].join(' '),
|
||||
])
|
||||
);
|
||||
|
||||
@@ -38,7 +38,7 @@ const FakeCommand kLaunchReleaseCommand = FakeCommand(
|
||||
'--justlaunch',
|
||||
// These args are the default on DebuggingOptions.
|
||||
'--args',
|
||||
'--enable-dart-profiling --disable-service-auth-codes',
|
||||
'--enable-dart-profiling',
|
||||
],
|
||||
environment: <String, String>{
|
||||
'PATH': '/usr/bin:null',
|
||||
@@ -56,7 +56,7 @@ const FakeCommand kLaunchDebugCommand = FakeCommand(command: <String>[
|
||||
'--no-wifi',
|
||||
'--justlaunch',
|
||||
'--args',
|
||||
'--enable-dart-profiling --disable-service-auth-codes --enable-checked-mode --verify-entry-points',
|
||||
'--enable-dart-profiling --enable-checked-mode --verify-entry-points',
|
||||
], environment: <String, String>{
|
||||
'PATH': '/usr/bin:null',
|
||||
'DYLD_LIBRARY_PATH': '/path/to/libraries',
|
||||
@@ -81,7 +81,7 @@ FakeCommand attachDebuggerCommand({
|
||||
'--debug',
|
||||
'--no-wifi',
|
||||
'--args',
|
||||
'--enable-dart-profiling --disable-service-auth-codes --enable-checked-mode --verify-entry-points',
|
||||
'--enable-dart-profiling --enable-checked-mode --verify-entry-points',
|
||||
],
|
||||
completer: completer,
|
||||
environment: const <String, String>{
|
||||
@@ -285,12 +285,15 @@ void main() {
|
||||
'--disable-observatory-publication',
|
||||
'--start-paused',
|
||||
'--dart-flags="--foo,--null_assertions"',
|
||||
'--use-test-fonts',
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
'--enable-software-rendering',
|
||||
'--trace-systrace',
|
||||
'--skia-deterministic-rendering',
|
||||
'--trace-skia',
|
||||
'--trace-allowlist="foo"',
|
||||
'--trace-skia-allowlist="skia.a,skia.b"',
|
||||
'--endless-trace-buffer',
|
||||
'--dump-skp-on-shader-compilation',
|
||||
'--verbose-logging',
|
||||
@@ -335,9 +338,12 @@ void main() {
|
||||
disableServiceAuthCodes: true,
|
||||
disablePortPublication: true,
|
||||
dartFlags: '--foo',
|
||||
useTestFonts: true,
|
||||
enableSoftwareRendering: true,
|
||||
skiaDeterministicRendering: true,
|
||||
traceSkia: true,
|
||||
traceAllowlist: 'foo',
|
||||
traceSkiaAllowlist: 'skia.a,skia.b',
|
||||
traceSystrace: true,
|
||||
endlessTraceBuffer: true,
|
||||
dumpSkpOnShaderCompilation: true,
|
||||
@@ -354,6 +360,143 @@ void main() {
|
||||
expect(await device.stopApp(iosApp), false);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
});
|
||||
|
||||
testWithoutContext('startApp using route', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
'script',
|
||||
'-t',
|
||||
'0',
|
||||
'/dev/null',
|
||||
'HostArtifact.iosDeploy',
|
||||
'--id',
|
||||
'123',
|
||||
'--bundle',
|
||||
'/',
|
||||
'--debug',
|
||||
'--no-wifi',
|
||||
'--args',
|
||||
<String>[
|
||||
'--enable-dart-profiling',
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
// The --route argument below is determined by what is passed into
|
||||
// route argument to startApp.
|
||||
'--route=/animation',
|
||||
].join(' '),
|
||||
],
|
||||
environment: const <String, String>{
|
||||
'PATH': '/usr/bin:null',
|
||||
'DYLD_LIBRARY_PATH': '/path/to/libraries',
|
||||
},
|
||||
stdout: '(lldb) run\nsuccess',
|
||||
),
|
||||
]);
|
||||
final IOSDevice device = setUpIOSDevice(
|
||||
sdkVersion: '13.3',
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
);
|
||||
final IOSApp iosApp = PrebuiltIOSApp(
|
||||
projectBundleId: 'app',
|
||||
bundleName: 'Runner',
|
||||
uncompressedBundle: fileSystem.currentDirectory,
|
||||
applicationPackage: fileSystem.currentDirectory,
|
||||
);
|
||||
final FakeDeviceLogReader deviceLogReader = FakeDeviceLogReader();
|
||||
|
||||
device.portForwarder = const NoOpDevicePortForwarder();
|
||||
device.setLogReader(iosApp, deviceLogReader);
|
||||
|
||||
// Start writing messages to the log reader.
|
||||
Timer.run(() {
|
||||
deviceLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:1234');
|
||||
});
|
||||
|
||||
final LaunchResult launchResult = await device.startApp(iosApp,
|
||||
prebuiltApplication: true,
|
||||
debuggingOptions: DebuggingOptions.enabled(
|
||||
BuildInfo.debug,
|
||||
),
|
||||
platformArgs: <String, dynamic>{},
|
||||
route: '/animation',
|
||||
);
|
||||
|
||||
expect(launchResult.started, true);
|
||||
expect(await device.stopApp(iosApp), false);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
});
|
||||
|
||||
testWithoutContext('startApp using trace-startup', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
'script',
|
||||
'-t',
|
||||
'0',
|
||||
'/dev/null',
|
||||
'HostArtifact.iosDeploy',
|
||||
'--id',
|
||||
'123',
|
||||
'--bundle',
|
||||
'/',
|
||||
'--debug',
|
||||
'--no-wifi',
|
||||
'--args',
|
||||
<String>[
|
||||
'--enable-dart-profiling',
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
// The --trace-startup argument below is determined by what is passed into
|
||||
// platformArgs argument to startApp.
|
||||
'--trace-startup',
|
||||
].join(' '),
|
||||
],
|
||||
environment: const <String, String>{
|
||||
'PATH': '/usr/bin:null',
|
||||
'DYLD_LIBRARY_PATH': '/path/to/libraries',
|
||||
},
|
||||
stdout: '(lldb) run\nsuccess',
|
||||
),
|
||||
]);
|
||||
final IOSDevice device = setUpIOSDevice(
|
||||
sdkVersion: '13.3',
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
);
|
||||
final IOSApp iosApp = PrebuiltIOSApp(
|
||||
projectBundleId: 'app',
|
||||
bundleName: 'Runner',
|
||||
uncompressedBundle: fileSystem.currentDirectory,
|
||||
applicationPackage: fileSystem.currentDirectory,
|
||||
);
|
||||
final FakeDeviceLogReader deviceLogReader = FakeDeviceLogReader();
|
||||
|
||||
device.portForwarder = const NoOpDevicePortForwarder();
|
||||
device.setLogReader(iosApp, deviceLogReader);
|
||||
|
||||
// Start writing messages to the log reader.
|
||||
Timer.run(() {
|
||||
deviceLogReader.addLine('The Dart VM service is listening on http://127.0.0.1:1234');
|
||||
});
|
||||
|
||||
final LaunchResult launchResult = await device.startApp(iosApp,
|
||||
prebuiltApplication: true,
|
||||
debuggingOptions: DebuggingOptions.enabled(
|
||||
BuildInfo.debug,
|
||||
),
|
||||
platformArgs: <String, dynamic>{
|
||||
'trace-startup': true,
|
||||
},
|
||||
);
|
||||
|
||||
expect(launchResult.started, true);
|
||||
expect(await device.stopApp(iosApp), false);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
});
|
||||
}
|
||||
|
||||
IOSDevice setUpIOSDevice({
|
||||
|
||||
@@ -1027,14 +1027,23 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text'''
|
||||
final DebuggingOptions mockOptions = DebuggingOptions.enabled(
|
||||
mockInfo,
|
||||
enableSoftwareRendering: true,
|
||||
traceSystrace: true,
|
||||
startPaused: true,
|
||||
disableServiceAuthCodes: true,
|
||||
skiaDeterministicRendering: true,
|
||||
useTestFonts: true,
|
||||
traceSkia: true,
|
||||
traceAllowlist: 'foo,bar',
|
||||
traceSkiaAllowlist: 'skia.a,skia.b',
|
||||
endlessTraceBuffer: true,
|
||||
dumpSkpOnShaderCompilation: true,
|
||||
verboseSystemLogs: true,
|
||||
cacheSkSL: true,
|
||||
purgePersistentCache: true,
|
||||
dartFlags: '--baz',
|
||||
nullAssertions: true,
|
||||
enableImpeller: true,
|
||||
hostVmServicePort: 0,
|
||||
);
|
||||
|
||||
await device.startApp(package, prebuiltApplication: true, debuggingOptions: mockOptions);
|
||||
@@ -1043,13 +1052,20 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text'''
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
'--enable-software-rendering',
|
||||
'--trace-systrace',
|
||||
'--start-paused',
|
||||
'--disable-service-auth-codes',
|
||||
'--skia-deterministic-rendering',
|
||||
'--use-test-fonts',
|
||||
'--trace-skia',
|
||||
'--trace-allowlist="foo,bar"',
|
||||
'--trace-skia-allowlist="skia.a,skia.b"',
|
||||
'--dart-flags=--baz',
|
||||
'--endless-trace-buffer',
|
||||
'--dump-skp-on-shader-compilation',
|
||||
'--verbose-logging',
|
||||
'--cache-sksl',
|
||||
'--purge-persistent-cache',
|
||||
'--dart-flags=--baz,--null_assertions',
|
||||
'--enable-impeller',
|
||||
'--observatory-port=0',
|
||||
]));
|
||||
|
||||
Reference in New Issue
Block a user