| # Copyright 2019 The Fuchsia 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("//build/components.gni") |
| import("//build/testing/environments.gni") |
| import("//tools/cmc/build/expect_includes.gni") |
| |
| config("rust-link-fake-time") { |
| rustflags = [ |
| "-Clink-args=--push-state", |
| "-Clink-args=--no-as-needed", |
| "-Clink-args=-Lnative=$target_out_dir", |
| "-Clink-args=-lfake_clock", |
| "-Clink-args=--pop-state", |
| ] |
| } |
| |
| shared_library("lib") { |
| output_name = "fake_clock" |
| testonly = true |
| sources = [ "fake_clock.cc" ] |
| |
| deps = [ |
| ":fake_clock_lib_includes", |
| "//sdk/lib/fdio", |
| "//src/lib/fake-clock/fidl:fidl_llcpp", |
| "//src/lib/fxl", |
| ] |
| |
| # TODO(fxbug.dev/69585): This target uses raw zx::channel with LLCPP which is deprecated. |
| # Please migrate to typed channel APIs (fidl::ClientEnd<T>, fidl::ServerEnd<T>). |
| # See linked bug for details. |
| configs += [ "//build/cpp:fidl-llcpp-deprecated-raw-channels" ] |
| public_configs = [ "//src/lib/fake-clock/lib:rust-link-fake-time" ] |
| } |
| |
| expect_includes("fake_clock_lib_includes") { |
| includes = [ |
| "client.shard.cmx", |
| "client.shard.cml", |
| ] |
| } |
| |
| executable("test_bin") { |
| testonly = true |
| output_name = "fake_clock_lib_test" |
| sources = [ "fake_clock_test.cc" ] |
| |
| deps = [ |
| ":lib", |
| "//garnet/public/lib/gtest", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/fake-clock/fidl", |
| "//src/lib/fxl", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/testing/loop_fixture", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| fuchsia_component("test_component") { |
| testonly = true |
| component_name = "fake_clock_lib_test" |
| manifest = "meta/fake_clock_lib_test.cmx" |
| deps = [ ":test_bin" ] |
| } |
| |
| fuchsia_test_package("fake_clock_lib_test") { |
| test_components = [ ":test_component" ] |
| deps = [ "//src/lib/fake-clock/svc" ] |
| test_specs = { |
| environments = [ emu_env ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":fake_clock_lib_test" ] |
| } |