| # Copyright 2018 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/package.gni") |
| import("//build/test.gni") |
| import("//build/test/test_package.gni") |
| import("//build/testing/environments.gni") |
| import("//build/testing/host_test_data.gni") |
| |
| source_set("fostr") { |
| sources = [ |
| "fidl_types.cc", |
| "fidl_types.h", |
| "hex_dump.cc", |
| "hex_dump.h", |
| "indent.h", |
| "zx_types.cc", |
| "zx_types.h", |
| ] |
| |
| if (is_fuchsia) { |
| public_deps = [ |
| "//sdk/lib/fidl/cpp", |
| "//zircon/public/lib/zx", |
| ] |
| } else { |
| public_deps = [ "//sdk/lib/fidl/cpp:cpp_base" ] |
| } |
| |
| deps = [ ":fostr_shared" ] |
| |
| public_configs = [ "//garnet/public:config" ] |
| } |
| |
| shared_library("fostr_shared") { |
| sources = [ |
| "indent.cc", |
| "indent.h", |
| ] |
| } |
| |
| if (is_host) { |
| host_test_data("fostr_shared_test_data") { |
| if (is_linux) { |
| sources = [ "$root_out_dir/libfostr_shared.so" ] |
| } else if (is_mac) { |
| sources = [ "$root_out_dir/libfostr_shared.dylib" ] |
| } |
| deps = [ ":fostr_shared($host_toolchain)" ] |
| } |
| } |
| |
| test("tests") { |
| output_name = "fostr_unittests" |
| |
| sources = [ |
| "test/fidl_types_unittests.cc", |
| "test/hex_dump_unittests.cc", |
| "test/indent_unittests.cc", |
| "test/zx_types_unittests.cc", |
| ] |
| |
| deps = [ |
| ":fostr", |
| "//garnet/public/lib/fostr/fidl/fuchsia.example.fostr", |
| "//src/lib/fsl", |
| |
| # TODO(FIDL-623): Remove dependency on fuchsia.sys. We should instead be |
| # using the fuchsia.example.fostr library to avoid changes in unrelated code |
| # to break tests here. |
| "//sdk/fidl/fuchsia.sys", |
| "//sdk/lib/fidl/cpp", |
| "//src/lib/fxl/test:gtest_main", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/async-loop-default", |
| "//zircon/system/fidl/fuchsia-boot:fuchsia-boot_c", |
| ] |
| } |
| |
| test_package("tests_package") { |
| package_name = "fostr_unittests" |
| |
| deps = [ ":tests" ] |
| |
| tests = [ |
| { |
| name = "fostr_unittests" |
| environments = basic_envs |
| }, |
| ] |
| } |