| # Copyright 2020 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/rust/rustc_binary.gni") |
| import("//build/rust/rustc_test.gni") |
| import("//src/sys/build/components.gni") |
| |
| # Run all tests with: |
| # fx test //src/sys/build/tests |
| group("tests") { |
| deps = [ |
| ":echo-integration-test", |
| ":readfile-unittest", |
| ":return_zero_package", |
| ":twoplustwo-cpp-unittest", |
| ":twoplustwo-rust-unittest", |
| ] |
| testonly = true |
| } |
| |
| executable("return_zero") { |
| sources = [ "return_zero.cc" ] |
| testonly = true |
| } |
| |
| fuchsia_component("return_zero_component") { |
| manifest = "return_zero.cmx" |
| testonly = true |
| deps = [ ":return_zero" ] |
| } |
| |
| fuchsia_test_package("return_zero_package") { |
| package_name = "return-zero-package" |
| test_components = [ ":return_zero_component" ] |
| } |
| |
| executable("twoplustwo_cpp") { |
| sources = [ "two_plus_two.cc" ] |
| testonly = true |
| deps = [ |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| fuchsia_unittest_package("twoplustwo-cpp-unittest") { |
| executable_path = "bin/twoplustwo_cpp" |
| deps = [ ":twoplustwo_cpp" ] |
| } |
| |
| rustc_test("twoplustwo_rust") { |
| source_root = "two_plus_two.rs" |
| |
| sources = [ "two_plus_two.rs" ] |
| } |
| |
| fuchsia_unittest_package("twoplustwo-rust-unittest") { |
| executable_path = "bin/twoplustwo_rust" |
| deps = [ ":twoplustwo_rust" ] |
| } |
| |
| rustc_test("read_file_test") { |
| source_root = "read_file.rs" |
| |
| sources = [ "read_file.rs" ] |
| } |
| |
| resource("hello_world.txt") { |
| sources = [ "hello_world.txt" ] |
| outputs = [ "data/hello_world.txt" ] |
| } |
| |
| fuchsia_unittest_package("readfile-unittest") { |
| executable_path = "bin/read_file_test" |
| deps = [ |
| ":hello_world.txt", |
| ":read_file_test", |
| ] |
| } |
| |
| fuchsia_component("echo-server") { |
| manifest = "echo_server_go.cmx" |
| deps = [ "//garnet/examples/fidl/echo_server_go:echo_server_go_bin" ] |
| } |
| |
| rustc_test("echo_client_test") { |
| source_root = "echo_client.rs" |
| deps = [ |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/testing/fidl:placeholders-rustc", |
| "//third_party/rust_crates:anyhow", |
| ] |
| |
| sources = [ "echo_client.rs" ] |
| } |
| |
| fuchsia_component("echo-client-test") { |
| manifest = "echo_client_test.cmx" |
| deps = [ ":echo_client_test" ] |
| testonly = true |
| } |
| |
| fuchsia_test_package("echo-integration-test") { |
| test_components = [ |
| ":echo-client-test", |
| |
| # Demonstrate that you can include multiple tests in the same package |
| ":return_zero_component", |
| ] |
| deps = [ ":echo-server" ] |
| test_specs = { |
| environments = [ emu_env ] |
| } |
| } |