Unverified Commit 208a418a authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

flutter drive --enable-software-rendering --skia-deterministic-rendering (#105161)

parent ff110fb9
...@@ -133,6 +133,19 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment ...@@ -133,6 +133,19 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
'this comma separated list of allowed prefixes.', 'this comma separated list of allowed prefixes.',
valueHelp: 'skia.gpu,skia.shaders', valueHelp: 'skia.gpu,skia.shaders',
) )
..addFlag('enable-software-rendering',
negatable: false,
help: 'Enable rendering using the Skia software backend. '
'This is useful when testing Flutter on emulators. By default, '
'Flutter will attempt to either use OpenGL or Vulkan and fall back '
'to software when neither is available.',
)
..addFlag('skia-deterministic-rendering',
negatable: false,
help: 'When combined with "--enable-software-rendering", this should provide completely '
'deterministic (i.e. reproducible) Skia rendering. This is useful for testing purposes '
'(e.g. when comparing screenshots).',
)
..addMultiOption('dart-entrypoint-args', ..addMultiOption('dart-entrypoint-args',
abbr: 'a', abbr: 'a',
help: 'Pass a list of arguments to the Dart entrypoint at application ' help: 'Pass a list of arguments to the Dart entrypoint at application '
...@@ -184,6 +197,8 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment ...@@ -184,6 +197,8 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
String get traceAllowlist => stringArgDeprecated('trace-allowlist'); String get traceAllowlist => stringArgDeprecated('trace-allowlist');
/// Create a debugging options instance for the current `run` or `drive` invocation. /// Create a debugging options instance for the current `run` or `drive` invocation.
@visibleForTesting
@protected
Future<DebuggingOptions> createDebuggingOptions(bool webMode) async { Future<DebuggingOptions> createDebuggingOptions(bool webMode) async {
final BuildInfo buildInfo = await getBuildInfo(); final BuildInfo buildInfo = await getBuildInfo();
final int browserDebugPort = featureFlags.isWebEnabled && argResults.wasParsed('web-browser-debug-port') final int browserDebugPort = featureFlags.isWebEnabled && argResults.wasParsed('web-browser-debug-port')
...@@ -268,19 +283,6 @@ class RunCommand extends RunCommandBase { ...@@ -268,19 +283,6 @@ class RunCommand extends RunCommandBase {
addMultidexOption(); addMultidexOption();
addIgnoreDeprecationOption(); addIgnoreDeprecationOption();
argParser argParser
..addFlag('enable-software-rendering',
negatable: false,
help: 'Enable rendering using the Skia software backend. '
'This is useful when testing Flutter on emulators. By default, '
'Flutter will attempt to either use OpenGL or Vulkan and fall back '
'to software when neither is available.',
)
..addFlag('skia-deterministic-rendering',
negatable: false,
help: 'When combined with "--enable-software-rendering", this should provide completely '
'deterministic (i.e. reproducible) Skia rendering. This is useful for testing purposes '
'(e.g. when comparing screenshots).',
)
..addFlag('await-first-frame-when-tracing', ..addFlag('await-first-frame-when-tracing',
defaultsTo: true, defaultsTo: true,
help: 'Whether to wait for the first frame when tracing startup ("--trace-startup"), ' help: 'Whether to wait for the first frame when tracing startup ("--trace-startup"), '
......
...@@ -208,7 +208,7 @@ void main() { ...@@ -208,7 +208,7 @@ void main() {
Pub: () => FakePub(), Pub: () => FakePub(),
}); });
testUsingContext('--enable-impeller flag propagates to debugging options', () async { testUsingContext('flags propagate to debugging options', () async {
final DriveCommand command = DriveCommand(fileSystem: fileSystem, logger: logger, platform: platform); final DriveCommand command = DriveCommand(fileSystem: fileSystem, logger: logger, platform: platform);
fileSystem.file('lib/main.dart').createSync(recursive: true); fileSystem.file('lib/main.dart').createSync(recursive: true);
fileSystem.file('test_driver/main_test.dart').createSync(recursive: true); fileSystem.file('test_driver/main_test.dart').createSync(recursive: true);
...@@ -216,12 +216,30 @@ void main() { ...@@ -216,12 +216,30 @@ void main() {
await expectLater(() => createTestCommandRunner(command).run(<String>[ await expectLater(() => createTestCommandRunner(command).run(<String>[
'drive', 'drive',
'--start-paused',
'--disable-service-auth-codes',
'--trace-skia',
'--trace-systrace',
'--verbose-system-logs',
'--null-assertions',
'--native-null-assertions',
'--enable-impeller', '--enable-impeller',
'--enable-software-rendering',
'--skia-deterministic-rendering',
]), throwsToolExit()); ]), throwsToolExit());
final DebuggingOptions options = await command.createDebuggingOptions(false); final DebuggingOptions options = await command.createDebuggingOptions(false);
expect(options.startPaused, true);
expect(options.disableServiceAuthCodes, true);
expect(options.traceSkia, true);
expect(options.traceSystrace, true);
expect(options.verboseSystemLogs, true);
expect(options.nullAssertions, true);
expect(options.nativeNullAssertions, true);
expect(options.enableImpeller, true); expect(options.enableImpeller, true);
expect(options.enableSoftwareRendering, true);
expect(options.skiaDeterministicRendering, true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: () => Cache.test(processManager: FakeProcessManager.any()), Cache: () => Cache.test(processManager: FakeProcessManager.any()),
FileSystem: () => MemoryFileSystem.test(), FileSystem: () => MemoryFileSystem.test(),
......
...@@ -721,16 +721,36 @@ void main() { ...@@ -721,16 +721,36 @@ void main() {
ProcessManager: () => FakeProcessManager.any(), ProcessManager: () => FakeProcessManager.any(),
}); });
testUsingContext('--enable-impeller flag propagates to debugging options', () async { testUsingContext('flags propagate to debugging options', () async {
final RunCommand command = RunCommand(); final RunCommand command = RunCommand();
await expectLater(() => createTestCommandRunner(command).run(<String>[ await expectLater(() => createTestCommandRunner(command).run(<String>[
'run', 'run',
'--start-paused',
'--disable-service-auth-codes',
'--use-test-fonts',
'--trace-skia',
'--trace-systrace',
'--verbose-system-logs',
'--null-assertions',
'--native-null-assertions',
'--enable-impeller', '--enable-impeller',
'--enable-software-rendering',
'--skia-deterministic-rendering',
]), throwsToolExit()); ]), throwsToolExit());
final DebuggingOptions options = await command.createDebuggingOptions(false); final DebuggingOptions options = await command.createDebuggingOptions(false);
expect(options.startPaused, true);
expect(options.disableServiceAuthCodes, true);
expect(options.useTestFonts, true);
expect(options.traceSkia, true);
expect(options.traceSystrace, true);
expect(options.verboseSystemLogs, true);
expect(options.nullAssertions, true);
expect(options.nativeNullAssertions, true);
expect(options.enableImpeller, true); expect(options.enableImpeller, true);
expect(options.enableSoftwareRendering, true);
expect(options.skiaDeterministicRendering, true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Cache: () => Cache.test(processManager: FakeProcessManager.any()), Cache: () => Cache.test(processManager: FakeProcessManager.any()),
FileSystem: () => MemoryFileSystem.test(), FileSystem: () => MemoryFileSystem.test(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment