Skip to content

Commit 37b367e

Browse files
authored
Allow specifying both Dart and non-Dart fixtures in engine unit-tests. (flutter#9113)
* Allow specifying both Dart and non-Dart fixtures in engine unittests. This fixes numerous issues in the way in which fixtures were managed in the engine unit-tests. * Instead of only being able to specify Dart fixtures, unit-tests may specify non-Dart fixtures as well. These are simply copied over to the fixtures directory known to the unit-test at runtime. * An issue where numerous Dart files could be given to the kernel snapshotter has been addressed. It was anticipated that such a (legal) invocation to the kernel snapshotter would produce a snapshot with the contents of all the Dart files added to the root library. This is incorrect and the behavior in this case is undefined. * Dart files referenced by the main Dart file are correctly tracked via a depfile. * The snapshotter arguments have been cleaned up to get rid of unused arguments (`—strong`) and the use of the VM product mode argument has been corrected to no longer depend on the Flutter product mode.
1 parent 28f2c05 commit 37b367e

File tree

10 files changed

+244
-134
lines changed

10 files changed

+244
-134
lines changed

flow/BUILD.gn

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ if (is_fuchsia) {
66
import("//build/fuchsia/sdk.gni")
77
}
88

9+
import("$flutter_root/testing/testing.gni")
10+
911
source_set("flow") {
1012
sources = [
1113
"compositor_context.cc",
@@ -100,6 +102,10 @@ source_set("flow") {
100102
}
101103
}
102104

105+
test_fixtures("flow_fixtures") {
106+
fixtures = []
107+
}
108+
103109
executable("flow_unittests") {
104110
testonly = true
105111

@@ -114,6 +120,7 @@ executable("flow_unittests") {
114120

115121
deps = [
116122
":flow",
123+
":flow_fixtures",
117124
"$flutter_root/fml",
118125
"//third_party/dart/runtime:libdart_jit", # for tracing
119126
"//third_party/googletest:gtest",

fml/BUILD.gn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# found in the LICENSE file.
44

55
import("//build/fuchsia/sdk.gni")
6+
import("$flutter_root/testing/testing.gni")
67

78
source_set("fml") {
89
sources = [
@@ -182,6 +183,10 @@ source_set("fml") {
182183
}
183184
}
184185

186+
test_fixtures("fml_fixtures") {
187+
fixtures = []
188+
}
189+
185190
executable("fml_unittests") {
186191
testonly = true
187192

@@ -208,6 +213,7 @@ executable("fml_unittests") {
208213
]
209214

210215
deps = [
216+
":fml_fixtures",
211217
"$flutter_root/fml",
212218
"$flutter_root/testing",
213219
"//third_party/dart/runtime:libdart_jit",

runtime/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ source_set("runtime") {
9696
}
9797

9898
test_fixtures("runtime_fixtures") {
99-
fixtures = [ "fixtures/runtime_test.dart" ]
99+
dart_main = "fixtures/runtime_test.dart"
100100
}
101101

102102
source_set("runtime_unittests_common") {

shell/common/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ shell_gpu_configuration("shell_unittests_gpu_configuration") {
147147
}
148148

149149
test_fixtures("shell_unittests_fixtures") {
150-
fixtures = [ "fixtures/shell_test.dart" ]
150+
dart_main = "fixtures/shell_test.dart"
151151
}
152152

153153
shell_host_executable("shell_unittests") {

shell/platform/common/cpp/client_wrapper/BUILD.gn

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

5+
import("$flutter_root/testing/testing.gni")
56
import("publish.gni")
67

78
_wrapper_includes = [
@@ -75,6 +76,10 @@ source_set("client_wrapper_library_stubs") {
7576
]
7677
}
7778

79+
test_fixtures("client_wrapper_fixtures") {
80+
fixtures = []
81+
}
82+
7883
executable("client_wrapper_unittests") {
7984
testonly = true
8085

@@ -91,6 +96,7 @@ executable("client_wrapper_unittests") {
9196

9297
deps = [
9398
":client_wrapper",
99+
":client_wrapper_fixtures",
94100
":client_wrapper_library_stubs",
95101
"$flutter_root/testing",
96102

shell/platform/darwin/BUILD.gn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
assert(is_mac || is_ios)
66

7+
import("$flutter_root/testing/testing.gni")
78
import("framework_shared.gni")
89

910
group("darwin") {
@@ -61,6 +62,10 @@ source_set("framework_shared") {
6162
public_configs = [ "$flutter_root:config" ]
6263
}
6364

65+
test_fixtures("flutter_channels_fixtures") {
66+
fixtures = []
67+
}
68+
6469
executable("flutter_channels_unittests") {
6570
testonly = true
6671

@@ -71,6 +76,7 @@ executable("flutter_channels_unittests") {
7176

7277
deps = [
7378
":flutter_channels",
79+
":flutter_channels_fixtures",
7480
"$flutter_root/testing",
7581
"//third_party/dart/runtime:libdart_jit",
7682
]

shell/platform/embedder/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ source_set("embedder") {
5757
}
5858

5959
test_fixtures("fixtures") {
60-
fixtures = [ "fixtures/main.dart" ]
60+
dart_main = "fixtures/main.dart"
6161
}
6262

6363
executable("embedder_unittests") {

shell/platform/glfw/client_wrapper/BUILD.gn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# found in the LICENSE file.
44

55
import("$flutter_root/shell/platform/common/cpp/client_wrapper/publish.gni")
6+
import("$flutter_root/testing/testing.gni")
67

78
_wrapper_includes = [
89
"include/flutter/flutter_window.h",
@@ -63,6 +64,10 @@ source_set("client_wrapper_library_stubs_glfw") {
6364
]
6465
}
6566

67+
test_fixtures("client_wrapper_glfw_fixtures") {
68+
fixtures = []
69+
}
70+
6671
executable("client_wrapper_glfw_unittests") {
6772
testonly = true
6873

@@ -73,6 +78,7 @@ executable("client_wrapper_glfw_unittests") {
7378

7479
deps = [
7580
":client_wrapper_glfw",
81+
":client_wrapper_glfw_fixtures",
7682
":client_wrapper_library_stubs_glfw",
7783
"$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper_library_stubs",
7884
"$flutter_root/testing",

testing/build/gen_fixtures_location_symbol.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)