|
1 | | -# `flutter integration tests` |
| 1 | +# Flutter runner integration tests |
2 | 2 |
|
3 | | -## Configure and build fuchsia |
| 3 | +To run the Flutter runner integration tests locally, |
| 4 | +first start a Fuchsia package server: |
4 | 5 |
|
5 | 6 | ```shell |
6 | 7 | $ cd "$FUCHSIA_DIR" |
7 | | -$ fx set terminal.x64 |
8 | | -$ fx build |
| 8 | +$ fx serve |
9 | 9 | ``` |
10 | 10 |
|
11 | | -## Build the test |
12 | | - |
13 | | -You can specify the test's package target to build only the test package, with |
14 | | -its dependencies. This will also build the required runner. |
| 11 | +Then run the integration test: |
15 | 12 |
|
16 | 13 | ```shell |
17 | | -$ cd "$ENGINE_DIR/src" |
18 | | -$ ./flutter/tools/gn --fuchsia <flags> \ |
19 | | - # for example: --goma --fuchsia-cpu=x64 --runtime-mode=debug |
20 | | -$ ninja -C out/fuchsia_debug_x64 \ |
21 | | - flutter/shell/platform/fuchsia/flutter/tests/integration |
| 14 | +$ ENGINE_DIR/flutter/tools/fuchsia/devshell/run_integration_test.sh <integration_test_folder_name> --no-lto |
22 | 15 | ``` |
23 | 16 |
|
24 | | - |
25 | | -## Start an emulator |
| 17 | +For example, to run the `embedder` integration test: |
26 | 18 |
|
27 | 19 | ```shell |
28 | | -ffx emu start --net tap |
| 20 | +$ ENGINE_DIR/flutter/tools/fuchsia/devshell/run_integration_test.sh embedder --no-lto |
29 | 21 | ``` |
30 | 22 |
|
31 | | -NOTE: Do _not_ run the default package server. The instructions below describe |
32 | | -how to launch a flutter-specific package server. |
33 | | - |
34 | | -## Publish the test packages to the Fuchsia package server |
35 | | - |
36 | | -The tests currently specify the Fuchsia package server's standard domain, |
37 | | -`fuchsia.com`, as the server to use to resolve (locate and load) the test |
38 | | -packages. So, before running the test, the most recently built `.far` files |
39 | | -need to be published to the Fuchsia package repo: |
| 23 | +Command-line options: |
40 | 24 |
|
41 | | -```shell |
42 | | -$ fx pm publish -a -repo "$(cat $FUCHSIA_DIR/.fx-build-dir)/amber-files/" \ |
43 | | - -f "$FLUTTER_ENGINE_DIR"/src/out/fuchsia_*64/oot_flutter_jit_runner-0.far |
44 | | -$ fx pm publish -a -repo "$(cat $FUCHSIA_DIR/.fx-build-dir)/amber-files/" \ |
45 | | - -f "$FLUTTER_ENGINE_DIR"/src/out/fuchsia_*64/flutter-embedder-test-0.far |
46 | | -$ fx pm publish -a -repo "$(cat $FUCHSIA_DIR/.fx-build-dir)/amber-files/" \ |
47 | | - -f $(find "$FLUTTER_ENGINE_DIR"/src/out/fuchsia_*64 -name parent-view.far) |
48 | | -$ fx pm publish -a -repo "$(cat $FUCHSIA_DIR/.fx-build-dir)/amber-files/" \ |
49 | | - -f $(find "$FLUTTER_ENGINE_DIR"/src/out/fuchsia_*64 -name child-view.far) |
50 | | -``` |
| 25 | +* Pass `--unoptimized` to disable C++ compiler optimizations. |
| 26 | +* Add `--fuchsia-cpu x64` or `--fuchsia-cpu arm64` to target a particular architecture. |
| 27 | + The default is x64. |
| 28 | +* Add `--runtime-mode debug` or `--runtime-mode profile` to switch between JIT and AOT |
| 29 | + builds. These correspond to a vanilla Fuchsia build and a `--release` Fuchsia build |
| 30 | + respectively. The default is debug/JIT builds. |
| 31 | +* For Googlers, add the `--goma` argument when using goma, and add the `--xcode-symlinks` |
| 32 | + argument when using goma on macOS. |
| 33 | +* Remove `--no-lto` if you care about performance or binary size; unfortunately it results |
| 34 | + in a *much* slower build. |
51 | 35 |
|
52 | | -## Run the test |
| 36 | +## Iterating on tests |
53 | 37 |
|
54 | | -```shell |
55 | | -$ ffx test run fuchsia-pkg:://fuchsia.com/flutter-embedder-test#meta/flutter-embedder-test.cm |
56 | | -``` |
| 38 | +By default, `run_integration_test.sh` will build Fuchsia and start up a Fuchsia emulator |
| 39 | +to ensure that the test runs on the correct environment. |
57 | 40 |
|
58 | | -If, for example, you only make a change to the Dart code in `parent-view`, you |
59 | | -can rebuild only the parent-view package target, and republish it. |
| 41 | +However, this is slow for iterating on tests. Once you've run `run_integration_tests.sh` |
| 42 | +once, you don't need to build Fuchsia or start the emulator anymore, and can pass |
| 43 | +`--skip-fuchsia-build` and `--skip-fuchsia-emu` to skip those steps. |
60 | 44 |
|
61 | 45 | ```shell |
62 | | -$ ninja -C out/fuchsia_debug_x64 \ |
63 | | - flutter/shell/platform/fuchsia/flutter/tests/integration/embedder/parent-view:package |
64 | | -$ fx pm publish -a -repo "$(cat $FUCHSIA_DIR/.fx-build-dir)/amber-files/" \ |
65 | | - -f $(find "$FLUTTER_ENGINE_DIR"/src/out/fuchsia_*64 -name parent-view.far) |
| 46 | +$ ENGINE_DIR/flutter/tools/fuchsia/devshell/run_integration_test.sh embedder --no-lto --skip-fuchsia-build --skip-fuchsia-emu |
66 | 47 | ``` |
67 | | - |
68 | | -Then re-run the test as above. |
69 | | - |
70 | | -The tests use a flutter runner with "oot_" prefixed to its package name, to |
71 | | -avoid conflicting with any flutter_runner package in the base fuchsia image. |
72 | | -After making a change to the flutter_runner you can re-deploy it with: |
73 | | - |
74 | | -```shell |
75 | | -$ ninja -C out/fuchsia_debug_x64 \ |
76 | | - flutter/shell/platform/fuchsia/flutter:oot_flutter_jit_runner |
77 | | -$ fx pm publish -a -repo "$(cat $FUCHSIA_DIR/.fx-build-dir)/amber-files/" \ |
78 | | - -f $(find "$FLUTTER_ENGINE_DIR"/src/out/fuchsia_*64 -name oot_flutter_jit_runner.far) |
79 | | -``` |
80 | | - |
81 | | -Then re-run the test as above. |
82 | | - |
83 | | -From here, you can modify the Flutter test, rebuild flutter, and usually rerun |
84 | | -the test without rebooting, by repeating the commands above. |
0 commit comments