forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 1
How to add a simple Flutter device lab drive perf test
liyuqian edited this page Jun 27, 2019
·
1 revision
Do the following to add a blah
perf test to the Flutter device lab:
-
Modify dev/devicelab/manifest.yaml to add a new entry
blah
- Always mark the new test to be flaky
-
Create your test file
dev/devicelab/bin/tasks/blah.dart
- Write a
main
function inblah.dart
that runs a task using something likeawait task(createBlahPerfTest())
. See https://github.com/flutter/flutter/blob/master/dev/devicelab/bin/tasks/cull_opacity_perf__timeline_summary.dart for a full example.
- Write a
-
In dev/devicelab/lib/tasks/perf_tests.dart, add a new function
createBlahPerfTest
- Specify the path, drive test file, and the output name. There are many examples to follow in dev/devicelab/lib/tasks/perf_tests.dart
- The meat of the test is usually in the drvier test file. See, for example, https://github.com/flutter/flutter/blob/master/dev/benchmarks/macrobenchmarks/test_driver/cull_opacity_perf_test.dart and https://github.com/flutter/flutter/blob/master/dev/benchmarks/complex_layout/test_driver/scroll_perf_test.dart
To test the device lab test blah
locally, run
cd dev/devicelab
dart bin/run.dart -t blah
Alternatively, you can also run the drive test locally. For example:
cd dev/benchmarks/macrobenchmarks && flutter drive --profile test_driver/cull_opacity_perf.dart
or
cd dev/benchmarks/complex_layout && flutter drive --profile test_driver/scroll_perf.dart