Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 85fa818

Browse files
authored
Add Dart JIT runner integration test (#36420)
1 parent 44b15d6 commit 85fa818

File tree

22 files changed

+395
-59
lines changed

22 files changed

+395
-59
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ allowed_hosts = [
109109
]
110110

111111
deps = {
112-
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'c9c2b77c9520903741ccda2fe12f773408a76c94',
112+
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'b7ef254d8cec53bdad39cdb4a284af1d0a79dbdb',
113113

114114
# Fuchsia compatibility
115115
#

shell/platform/fuchsia/dart_runner/BUILD.gn

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ if (enable_unittests) {
333333
group("tests") {
334334
testonly = true
335335

336-
deps = [ ":dart_runner_tests" ]
336+
deps = [
337+
":dart_runner_tests",
338+
"tests/startup_integration_test",
339+
]
337340
}
338341
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Dart Runner Tests
2+
3+
Contains tests for the Dart Runner and their corresponding utility code
4+
5+
### Running the Tests
6+
<!-- TODO(erkln): Replace steps once test runner script is updated to run Dart runner tests -->
7+
- The tests can be run using the Fuchsia emulator
8+
```
9+
fx set workstation_eng.qemu-x64
10+
ffx emu start --headless
11+
```
12+
- Start up the package server
13+
```
14+
fx serve
15+
```
16+
- Prepare the BUILD files
17+
```
18+
$ENGINE_DIR/flutter/tools/gn --fuchsia --no-lto
19+
```
20+
- Build the Fuchsia binary with the test directory as the target (ie. `flutter/shell/platform/fuchsia/dart_runner/tests/startup_integration_test`)
21+
```
22+
ninja -C $ENGINE_DIR/out/fuchsia_debug_x64 flutter/shell/platform/fuchsia/dart_runner/tests/startup_integration_test
23+
```
24+
- Deploy/publish test FAR files to Fuchsia
25+
```
26+
$FUCHSIA_DIR/.jiri_root/bin/fx pm publish -a -repo $FUCHSIA_DIR/$(cat $FUCHSIA_DIR/.fx-build-dir)/amber-files -f $ENGINE_DIR/out/fuchsia_debug_x64/dart-jit-runner-integration-test-0.far
27+
```
28+
29+
Note that some tests may have components that also need to be deployed/published (ie. `dart_jit_echo_server` also needs to be published for the Dart JIT integration test to run successfully)
30+
31+
```
32+
$FUCHSIA_DIR/.jiri_root/bin/fx pm publish -a -repo $FUCHSIA_DIR/$(cat $FUCHSIA_DIR/.fx-build-dir)/amber-files -f $ENGINE_DIR/out/fuchsia_debug_x64/gen/flutter/shell/platform/fuchsia/dart_runner/tests/startup_integration_test/dart_jit_runner/dart_jit_echo_server/dart_jit_echo_server/dart_jit_echo_server.far
33+
```
34+
- Run the test
35+
```
36+
ffx test run "fuchsia-pkg://fuchsia.com/dart-jit-runner-integration-test#meta/dart-jit-runner-integration-test.cm"
37+
```
38+
39+
Notes:
40+
- To find the FAR files, `ls` into the output directory provided to the `ninja` command
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2013 The Flutter Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
import("//build/fuchsia/sdk.gni")
6+
import("//flutter/tools/fuchsia/fidl/fidl.gni")
7+
8+
fidl("echo") {
9+
name = "flutter.example.echo"
10+
meta = "//flutter/shell/platform/fuchsia/dart_runner/tests/fidl/flutter.example.echo/meta.json"
11+
sources = [ "echo.fidl" ]
12+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Echo FIDL
2+
3+
This FIDL protocol allows the Dart integration tests to communicate with a Dart Echo server (a test Dart component that echoes back a request).
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2019 The Fuchsia Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
library flutter.example.echo;
6+
7+
const MAX_STRING_LENGTH uint64 = 32;
8+
9+
@discoverable
10+
protocol Echo {
11+
/// Returns the input.
12+
EchoString(struct {
13+
value string:<MAX_STRING_LENGTH, optional>;
14+
}) -> (struct {
15+
response string:<MAX_STRING_LENGTH, optional>;
16+
});
17+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"deps": [],
3+
"name": "flutter.example.echo",
4+
"root": "fidl/flutter.example.echo",
5+
"sources": [
6+
"../../../flutter/shell/platform/fuchsia/dart_runner/tests/fidl/flutter.example.echo/echo.fidl"
7+
],
8+
"type": "fidl_library"
9+
}

shell/platform/fuchsia/dart_runner/tests/startup_integration_test/BUILD.gn

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
44

5-
group("tests") {
5+
import("//build/fuchsia/sdk.gni")
6+
7+
group("startup_integration_test") {
68
testonly = true
7-
deps = [ "hello_world:hello_world_dart" ]
9+
deps = [ "dart_jit_runner:tests" ]
810
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2013 The Flutter Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
import("//build/fuchsia/sdk.gni")
6+
7+
import("//flutter/tools/fuchsia/dart/dart_component.gni")
8+
import("//flutter/tools/fuchsia/fidl/fidl.gni")
9+
import("//flutter/tools/fuchsia/fuchsia_archive.gni")
10+
11+
group("tests") {
12+
testonly = true
13+
deps = [ ":dart-jit-runner-integration-test" ]
14+
}
15+
16+
executable("dart-jit-runner-integration-test-bin") {
17+
testonly = true
18+
19+
output_name = "dart-jit-runner-integration-test"
20+
21+
sources = [ "dart-jit-runner-integration-test.cc" ]
22+
23+
# This is needed for //third_party/googletest for linking zircon symbols.
24+
libs = [ "$fuchsia_sdk_path/arch/$target_cpu/sysroot/lib/libzircon.so" ]
25+
26+
deps = [
27+
"$fuchsia_sdk_root/fidl:fuchsia.logger",
28+
"$fuchsia_sdk_root/fidl:fuchsia.tracing.provider",
29+
"$fuchsia_sdk_root/pkg:async",
30+
"$fuchsia_sdk_root/pkg:async-loop-testing",
31+
"$fuchsia_sdk_root/pkg:fidl_cpp",
32+
"$fuchsia_sdk_root/pkg:sys_component_cpp_testing",
33+
"$fuchsia_sdk_root/pkg:zx",
34+
"dart_jit_echo_server:package",
35+
"//flutter/fml",
36+
"//flutter/shell/platform/fuchsia/dart_runner/tests/fidl/flutter.example.echo:echo",
37+
"//third_party/googletest:gtest",
38+
"//third_party/googletest:gtest_main",
39+
]
40+
}
41+
42+
fuchsia_test_archive("dart-jit-runner-integration-test") {
43+
deps = [
44+
":dart-jit-runner-integration-test-bin",
45+
"dart_jit_echo_server:package",
46+
]
47+
48+
binary = "$target_name"
49+
cml_file = rebase_path("meta/$target_name.cml")
50+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# dart_jit_runner
2+
3+
Contains the integration test for the Dart JIT runner. The Dart Echo server is launched with a JIT runner.

0 commit comments

Comments
 (0)