Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
6990b8b2
Unverified
Commit
6990b8b2
authored
Mar 17, 2020
by
gaaclarke
Committed by
GitHub
Mar 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the "trace-whitelist" flag to run. (#52556)
parent
f149eec3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
47 deletions
+117
-47
android_device.dart
packages/flutter_tools/lib/src/android/android_device.dart
+2
-0
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+6
-0
device.dart
packages/flutter_tools/lib/src/device.dart
+3
-0
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+1
-0
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+1
-0
android_device_test.dart
...tools/test/general.shard/android/android_device_test.dart
+67
-47
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+37
-0
No files found.
packages/flutter_tools/lib/src/android/android_device.dart
View file @
6990b8b2
...
...
@@ -584,6 +584,8 @@ class AndroidDevice extends Device {
...<
String
>[
'--ez'
,
'skia-deterministic-rendering'
,
'true'
],
if
(
debuggingOptions
.
traceSkia
)
...<
String
>[
'--ez'
,
'trace-skia'
,
'true'
],
if
(
debuggingOptions
.
traceWhitelist
!=
null
)
...<
String
>[
'--ez'
,
'trace-whitelist'
,
debuggingOptions
.
traceWhitelist
],
if
(
debuggingOptions
.
traceSystrace
)
...<
String
>[
'--ez'
,
'trace-systrace'
,
'true'
],
if
(
debuggingOptions
.
endlessTraceBuffer
)
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
6990b8b2
...
...
@@ -102,6 +102,11 @@ class RunCommand extends RunCommandBase {
help:
'Enable tracing of Skia code. This is useful when debugging '
'the GPU thread. By default, Flutter will not log skia code.'
,
)
..
addOption
(
'trace-whitelist'
,
help:
'Filters out all trace events except those that are specified in '
'this comma separated list of whitelisted prefixes.'
,
valueHelp:
'foo,bar'
,
)
..
addFlag
(
'endless-trace-buffer'
,
negatable:
false
,
help:
'Enable tracing to the endless tracer. This is useful when '
...
...
@@ -360,6 +365,7 @@ class RunCommand extends RunCommandBase {
enableSoftwareRendering:
boolArg
(
'enable-software-rendering'
),
skiaDeterministicRendering:
boolArg
(
'skia-deterministic-rendering'
),
traceSkia:
boolArg
(
'trace-skia'
),
traceWhitelist:
stringArg
(
'trace-whitelist'
),
traceSystrace:
boolArg
(
'trace-systrace'
),
endlessTraceBuffer:
boolArg
(
'endless-trace-buffer'
),
dumpSkpOnShaderCompilation:
dumpSkpOnShaderCompilation
,
...
...
packages/flutter_tools/lib/src/device.dart
View file @
6990b8b2
...
...
@@ -550,6 +550,7 @@ class DebuggingOptions {
this
.
enableSoftwareRendering
=
false
,
this
.
skiaDeterministicRendering
=
false
,
this
.
traceSkia
=
false
,
this
.
traceWhitelist
,
this
.
traceSystrace
=
false
,
this
.
endlessTraceBuffer
=
false
,
this
.
dumpSkpOnShaderCompilation
=
false
,
...
...
@@ -576,6 +577,7 @@ class DebuggingOptions {
this
.
webRunHeadless
=
false
,
this
.
webBrowserDebugPort
,
this
.
cacheSkSL
=
false
,
this
.
traceWhitelist
,
})
:
debuggingEnabled
=
false
,
useTestFonts
=
false
,
startPaused
=
false
,
...
...
@@ -602,6 +604,7 @@ class DebuggingOptions {
final
bool
enableSoftwareRendering
;
final
bool
skiaDeterministicRendering
;
final
bool
traceSkia
;
final
String
traceWhitelist
;
final
bool
traceSystrace
;
final
bool
endlessTraceBuffer
;
final
bool
dumpSkpOnShaderCompilation
;
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
6990b8b2
...
...
@@ -273,6 +273,7 @@ class IOSDevice extends Device {
if
(
debuggingOptions
.
enableSoftwareRendering
)
'--enable-software-rendering'
,
if
(
debuggingOptions
.
skiaDeterministicRendering
)
'--skia-deterministic-rendering'
,
if
(
debuggingOptions
.
traceSkia
)
'--trace-skia'
,
if
(
debuggingOptions
.
traceWhitelist
!=
null
)
'--trace-whitelist="
${debuggingOptions.traceWhitelist}
"'
,
if
(
debuggingOptions
.
endlessTraceBuffer
)
'--endless-trace-buffer'
,
if
(
debuggingOptions
.
dumpSkpOnShaderCompilation
)
'--dump-skp-on-shader-compilation'
,
if
(
debuggingOptions
.
verboseSystemLogs
)
'--verbose-logging'
,
...
...
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
6990b8b2
...
...
@@ -405,6 +405,7 @@ class IOSSimulator extends Device {
if
(
debuggingOptions
.
disableServiceAuthCodes
)
'--disable-service-auth-codes'
,
if
(
debuggingOptions
.
skiaDeterministicRendering
)
'--skia-deterministic-rendering'
,
if
(
debuggingOptions
.
useTestFonts
)
'--use-test-fonts'
,
if
(
debuggingOptions
.
traceWhitelist
!=
null
)
'--trace-whitelist="
${debuggingOptions.traceWhitelist}
"'
,
'--observatory-port=
${debuggingOptions.hostVmServicePort ?? 0}
'
,
],
];
...
...
packages/flutter_tools/test/general.shard/android/android_device_test.dart
View file @
6990b8b2
...
...
@@ -64,38 +64,46 @@ void main() {
mockAndroidSdk
=
MockAndroidSdk
();
});
testUsingContext
(
'succeeds with --cache-sksl'
,
()
async
{
const
String
deviceId
=
'1234'
;
final
AndroidDevice
device
=
AndroidDevice
(
deviceId
,
modelID:
'TestModel'
);
final
Directory
sdkDir
=
MockAndroidSdk
.
createSdkDirectory
();
globals
.
config
.
setValue
(
'android-sdk'
,
sdkDir
.
path
);
final
File
adbExe
=
globals
.
fs
.
file
(
getAdbPath
(
androidSdk
));
void
_setupMockAndroidSdk
(
AndroidSdk
mockAndroidSdk
)
{
when
(
mockAndroidSdk
.
licensesAvailable
).
thenReturn
(
true
);
when
(
mockAndroidSdk
.
latestVersion
).
thenReturn
(
MockAndroidSdkVersion
());
}
void
_setupMockProcessManager
(
ProcessManager
mockProcessManager
,
String
deviceId
,
ProcessResult
getPropResult
)
{
final
File
adbExe
=
globals
.
fs
.
file
(
getAdbPath
(
androidSdk
));
when
(
mockProcessManager
.
run
(
<
String
>[
adbExe
.
path
,
'-s'
,
deviceId
,
'shell'
,
'getprop'
],
stdoutEncoding:
latin1
,
stderrEncoding:
latin1
,
)).
thenAnswer
((
_
)
async
{
return
ProcessResult
(
0
,
0
,
'[ro.build.version.sdk]: [24]'
,
''
)
;
return
getPropResult
;
});
when
(
mockProcessManager
.
run
(
any
,
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
)
)).
thenAnswer
((
_
)
async
{
when
(
mockProcessManager
.
run
(
any
,
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
)))
.
thenAnswer
((
_
)
async
{
return
ProcessResult
(
0
,
0
,
''
,
''
);
});
when
(
mockProcessManager
.
start
(
any
,
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
)
)).
thenAnswer
((
_
)
async
{
when
(
mockProcessManager
.
start
(
any
,
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
)))
.
thenAnswer
((
_
)
async
{
return
FakeProcess
();
});
}
testUsingContext
(
'succeeds with --cache-sksl'
,
()
async
{
const
String
deviceId
=
'1234'
;
final
AndroidDevice
device
=
AndroidDevice
(
deviceId
,
modelID:
'TestModel'
);
final
Directory
sdkDir
=
MockAndroidSdk
.
createSdkDirectory
();
globals
.
config
.
setValue
(
'android-sdk'
,
sdkDir
.
path
);
_setupMockAndroidSdk
(
mockAndroidSdk
);
_setupMockProcessManager
(
mockProcessManager
,
deviceId
,
ProcessResult
(
0
,
0
,
'[ro.build.version.sdk]: [24]'
,
''
));
final
LaunchResult
launchResult
=
await
device
.
startApp
(
mockApk
,
...
...
@@ -108,8 +116,9 @@ void main() {
);
expect
(
launchResult
.
started
,
isTrue
);
expect
(
verify
(
mockProcessManager
.
run
(
captureAny
)).
captured
.
last
.
join
(
','
),
contains
(<
String
>[
'--ez'
,
'cache-sksl'
,
'true'
].
join
(
','
)));
expect
(
verify
(
mockProcessManager
.
run
(
captureAny
)).
captured
.
last
.
join
(
','
),
contains
(<
String
>[
'--ez'
,
'cache-sksl'
,
'true'
].
join
(
','
)));
},
overrides:
<
Type
,
Generator
>{
AndroidSdk:
()
=>
mockAndroidSdk
,
FileSystem:
()
=>
MemoryFileSystem
(),
...
...
@@ -118,36 +127,15 @@ void main() {
testUsingContext
(
'can run a release build on x64'
,
()
async
{
const
String
deviceId
=
'1234'
;
final
AndroidDevice
device
=
AndroidDevice
(
deviceId
,
modelID:
'TestModel'
);
final
AndroidDevice
device
=
AndroidDevice
(
deviceId
,
modelID:
'TestModel'
);
final
Directory
sdkDir
=
MockAndroidSdk
.
createSdkDirectory
();
globals
.
config
.
setValue
(
'android-sdk'
,
sdkDir
.
path
);
final
File
adbExe
=
globals
.
fs
.
file
(
getAdbPath
(
androidSdk
));
when
(
mockAndroidSdk
.
licensesAvailable
).
thenReturn
(
true
);
when
(
mockAndroidSdk
.
latestVersion
).
thenReturn
(
MockAndroidSdkVersion
());
when
(
mockProcessManager
.
run
(
<
String
>[
adbExe
.
path
,
'-s'
,
deviceId
,
'shell'
,
'getprop'
],
stdoutEncoding:
latin1
,
stderrEncoding:
latin1
,
)).
thenAnswer
((
_
)
async
{
return
ProcessResult
(
0
,
0
,
'[ro.build.version.sdk]: [24]
\n
[ro.product.cpu.abi]: [x86_64]'
,
''
);
});
when
(
mockProcessManager
.
run
(
any
,
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
)
)).
thenAnswer
((
_
)
async
{
return
ProcessResult
(
0
,
0
,
''
,
''
);
});
when
(
mockProcessManager
.
start
(
any
,
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
)
)).
thenAnswer
((
_
)
async
{
return
FakeProcess
();
});
_setupMockAndroidSdk
(
mockAndroidSdk
);
_setupMockProcessManager
(
mockProcessManager
,
deviceId
,
ProcessResult
(
0
,
0
,
'[ro.build.version.sdk]: [24]'
,
''
));
final
LaunchResult
launchResult
=
await
device
.
startApp
(
mockApk
,
...
...
@@ -163,6 +151,38 @@ void main() {
FileSystem:
()
=>
MemoryFileSystem
(),
ProcessManager:
()
=>
mockProcessManager
,
});
testUsingContext
(
'test trace whitelist flag'
,
()
async
{
const
String
deviceId
=
'1234'
;
final
AndroidDevice
device
=
AndroidDevice
(
deviceId
,
modelID:
'TestModel'
);
final
Directory
sdkDir
=
MockAndroidSdk
.
createSdkDirectory
();
globals
.
config
.
setValue
(
'android-sdk'
,
sdkDir
.
path
);
_setupMockAndroidSdk
(
mockAndroidSdk
);
_setupMockProcessManager
(
mockProcessManager
,
deviceId
,
ProcessResult
(
0
,
0
,
'[ro.build.version.sdk]: [24]'
,
''
));
final
LaunchResult
launchResult
=
await
device
.
startApp
(
mockApk
,
prebuiltApplication:
true
,
debuggingOptions:
DebuggingOptions
.
disabled
(
const
BuildInfo
(
BuildMode
.
profile
,
null
,
treeShakeIcons:
false
),
traceWhitelist:
'foo'
,
),
platformArgs:
<
String
,
dynamic
>{},
);
expect
(
launchResult
.
started
,
isTrue
);
expect
(
verify
(
mockProcessManager
.
run
(
captureAny
)).
captured
.
last
.
join
(
','
),
contains
(<
String
>[
'--ez'
,
'trace-whitelist'
,
'foo'
].
join
(
','
)));
},
overrides:
<
Type
,
Generator
>{
AndroidSdk:
()
=>
mockAndroidSdk
,
FileSystem:
()
=>
MemoryFileSystem
(),
ProcessManager:
()
=>
mockProcessManager
,
});
});
});
...
...
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
6990b8b2
...
...
@@ -677,6 +677,43 @@ void main() {
expect
(
await
device
.
stopApp
(
mockApp
),
isFalse
);
});
testUsingContext
(
'trace whitelist flags'
,
()
async
{
final
IOSDevice
device
=
IOSDevice
(
'123'
,
name:
'iPhone 1'
,
fileSystem:
mockFileSystem
,
sdkVersion:
'13.3'
,
cpuArchitecture:
DarwinArch
.
arm64
,
platform:
mockPlatform
,
artifacts:
mockArtifacts
,
iosDeploy:
mockIosDeploy
,
);
when
(
mockIosDeploy
.
installApp
(
deviceId:
device
.
id
,
bundlePath:
anyNamed
(
'bundlePath'
),
launchArguments:
<
String
>[],
)).
thenAnswer
((
Invocation
invocation
)
=>
Future
<
int
>.
value
(
0
));
when
(
mockIosDeploy
.
runApp
(
deviceId:
device
.
id
,
bundlePath:
anyNamed
(
'bundlePath'
),
launchArguments:
anyNamed
(
'launchArguments'
),
)).
thenAnswer
((
Invocation
invocation
)
=>
Future
<
int
>.
value
(
0
));
await
device
.
startApp
(
mockApp
,
prebuiltApplication:
true
,
debuggingOptions:
DebuggingOptions
.
disabled
(
const
BuildInfo
(
BuildMode
.
release
,
null
,
treeShakeIcons:
false
),
traceWhitelist:
'foo'
),
platformArgs:
<
String
,
dynamic
>{},
);
final
VerificationResult
toVerify
=
verify
(
mockIosDeploy
.
runApp
(
deviceId:
device
.
id
,
bundlePath:
anyNamed
(
'bundlePath'
),
launchArguments:
captureAnyNamed
(
'launchArguments'
),
));
expect
(
toVerify
.
captured
[
0
],
contains
(
'--trace-whitelist="foo"'
));
await
device
.
stopApp
(
mockApp
);
});
testUsingContext
(
'succeeds with --cache-sksl'
,
()
async
{
final
IOSDevice
device
=
IOSDevice
(
'123'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment