Chinmay Garde 37b367e4d2
Allow specifying both Dart and non-Dart fixtures in engine unit-tests. (#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.
2019-05-28 19:11:47 -07:00

142 lines
3.4 KiB
Plaintext

# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//third_party/dart/runtime/bin/vmservice/vmservice_sources.gni")
import("$flutter_root/common/config.gni")
import("$flutter_root/testing/testing.gni")
source_set("test_font") {
sources = [
"test_font_data.cc",
"test_font_data.h",
]
deps = [
"//third_party/skia",
]
public_configs = [ "$flutter_root:config" ]
defines = []
if (flutter_runtime_mode == "debug" || current_toolchain == host_toolchain) {
# Though the test font data is small, we dont want to add to the binary size
# on the device (in profile and release modes). We only add the same on the
# host test shells and the debug device shell.
defines += [ "EMBED_TEST_FONT_DATA=1" ]
}
}
# Picks the libdart implementation based on the Flutter runtime mode.
group("libdart") {
public_deps = []
if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") {
public_deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
} else {
public_deps += [
"$flutter_root/lib/snapshot",
"//third_party/dart/runtime:libdart_jit",
]
}
}
source_set("runtime") {
sources = [
"dart_isolate.cc",
"dart_isolate.h",
"dart_service_isolate.cc",
"dart_service_isolate.h",
"dart_snapshot.cc",
"dart_snapshot.h",
"dart_vm.cc",
"dart_vm.h",
"dart_vm_data.cc",
"dart_vm_data.h",
"dart_vm_lifecycle.cc",
"dart_vm_lifecycle.h",
"embedder_resources.cc",
"embedder_resources.h",
"runtime_controller.cc",
"runtime_controller.h",
"runtime_delegate.cc",
"runtime_delegate.h",
"service_protocol.cc",
"service_protocol.h",
"start_up.cc",
"start_up.h",
]
deps = [
":test_font",
"$flutter_root/assets",
"$flutter_root/common",
"$flutter_root/flow",
"$flutter_root/fml",
"$flutter_root/lib/io",
"$flutter_root/lib/ui",
"$flutter_root/third_party/txt",
"//third_party/dart/runtime:dart_api",
"//third_party/dart/runtime/bin:dart_io_api",
"//third_party/skia",
"//third_party/tonic",
]
public_deps = [
"//third_party/rapidjson",
]
public_configs = [ "$flutter_root:config" ]
if (flutter_runtime_mode != "release" &&
flutter_runtime_mode != "dynamic_release" && !is_fuchsia) {
# Only link in Observatory in non-release modes on non-Fuchsia. Fuchsia
# instead puts Observatory into the runner's package.
deps += [
"//third_party/dart/runtime/observatory:embedded_observatory_archive",
]
}
}
test_fixtures("runtime_fixtures") {
dart_main = "fixtures/runtime_test.dart"
}
source_set("runtime_unittests_common") {
visibility = [ ":*" ]
testonly = true
sources = [
"runtime_test.cc",
"runtime_test.h",
]
public_deps = [
":libdart",
":runtime",
":runtime_fixtures",
"$flutter_root/common",
"$flutter_root/fml",
"$flutter_root/lib/snapshot",
"$flutter_root/shell/common",
"$flutter_root/testing:dart",
"//third_party/skia",
"//third_party/tonic",
]
}
executable("runtime_unittests") {
testonly = true
configs += [ "$flutter_root:export_dynamic_symbols" ]
sources = [
"dart_isolate_unittests.cc",
"dart_lifecycle_unittests.cc",
"dart_service_isolate_unittests.cc",
"dart_vm_unittests.cc",
]
deps = [
":runtime_unittests_common",
]
}