blob: 826f4e327d366bee1f892093bc42eb391fd501dc [file] [log] [blame]
# 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")
config("rust-link-fake-time") {
_dir = rebase_path(get_label_info(":lib($shlib_toolchain)", "root_out_dir"),
root_build_dir)
_lib = "$_dir/link_stub/libfake_clock.so"
rustflags = [
# Use --no-as-needed to ensure libfake_clock.so is not dropped by
# --as-needed analysis if it occurs later in the link arguments.
"-Clink-args=--push-state",
"-Clink-args=--no-as-needed",
"-Clink-arg=$_lib",
"-Clink-args=--pop-state",
]
}
shared_library("lib") {
output_name = "fake_clock"
testonly = true
sources = [ "fake_clock.cc" ]
deps = [
"//sdk/lib/component/incoming/cpp",
"//sdk/lib/syslog/cpp",
"//src/lib/fake-clock/fidl:fidl_cpp_wire",
"//src/lib/fake-clock/named-timer:named-timer-headers",
]
public_configs = [ "//src/lib/fake-clock/lib:rust-link-fake-time" ]
}
executable("test_bin") {
testonly = true
output_name = "fake_clock_lib_test"
sources = [ "fake_clock_test.cc" ]
deps = [
":lib",
"//sdk/lib/sys/cpp",
"//src/lib/fake-clock/fidl:fidl_hlcpp",
"//src/lib/fxl",
"//src/lib/fxl/test:gtest_main",
"//src/lib/testing/loop_fixture",
"//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.cml"
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" ]
}