| # 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/components.gni") |
| |
| # We don't have gunit in-tree, so this main function will replace all gunit |
| # flags with gtest flags and run the tests using gtest framework. |
| source_set("gunit_main") { |
| testonly = true |
| |
| sources = [ "gunit_main.cc" ] |
| |
| deps = [ |
| "//src/lib/fxl", |
| "//src/lib/fxl/test:test_settings", |
| ] |
| |
| public_deps = [ "//third_party/googletest:gtest" ] |
| } |
| |
| executable("echo_gtest_client") { |
| testonly = true |
| sources = [ "echo_test.cc" ] |
| |
| deps = [ |
| "//examples/components/routing/fidl:echo_hlcpp", |
| "//sdk/lib/fidl/cpp", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/fxl/test:gtest_main", |
| "//zircon/system/ulib/async-default", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| fuchsia_component("echo_gtest_client_component") { |
| testonly = true |
| manifest = "meta/echo_gtest_client.cml" |
| component_name = "echo_gtest_client" |
| deps = [ ":echo_gtest_client" ] |
| } |
| |
| # Generates two executables. One for gtest and other for gunit. |
| template("executable_gtest_gunit") { |
| gtest_target = "gtest_${target_name}" |
| gunit_target = "gunit_${target_name}" |
| |
| executable(gtest_target) { |
| forward_variables_from(invoker, "*") |
| |
| if (!defined(deps)) { |
| deps = [] |
| } |
| deps += [ "//src/lib/fxl/test:gtest_main" ] |
| } |
| |
| executable(gunit_target) { |
| forward_variables_from(invoker, "*") |
| |
| if (!defined(deps)) { |
| deps = [] |
| } |
| deps += [ ":gunit_main" ] |
| } |
| } |
| |
| executable("death_gtest") { |
| testonly = true |
| sources = [ "death_test.cc" ] |
| |
| deps = [ |
| "//sdk/lib/syslog/cpp", |
| "//src/lib/fxl/test:gtest_main", |
| ] |
| } |
| |
| fuchsia_component("death_gtest_component") { |
| testonly = true |
| manifest = "meta/death_gtest.cml" |
| component_name = "death_gtest" |
| deps = [ ":death_gtest" ] |
| } |
| |
| executable_gtest_gunit("runner_no_tests") { |
| testonly = true |
| sources = [ "empty_test_file.cc" ] |
| |
| deps = [ "//src/lib/testing/loop_fixture" ] |
| } |
| |
| fuchsia_component("empty_test_component") { |
| testonly = true |
| manifest = "meta/empty_test.cml" |
| component_name = "empty_test" |
| deps = [ ":gtest_runner_no_tests" ] |
| } |
| |
| executable_gtest_gunit("runner_sample_tests") { |
| testonly = true |
| sources = [ "sample_tests.cc" ] |
| |
| deps = [ "//src/lib/testing/loop_fixture" ] |
| } |
| |
| fuchsia_component("gtest_runner_sample_tests_component") { |
| testonly = true |
| manifest = "meta/sample_tests.cml" |
| component_name = "sample_tests" |
| deps = [ ":gtest_runner_sample_tests" ] |
| } |
| |
| executable("gtest_runner_test_with_custom_args") { |
| testonly = true |
| sources = [ "gtest_with_custom_args.cc" ] |
| |
| deps = [ "//src/lib/testing/loop_fixture" ] |
| } |
| |
| executable("gunit_runner_test_with_custom_args") { |
| testonly = true |
| sources = [ "gunit_with_custom_args.cc" ] |
| |
| deps = [ "//src/lib/testing/loop_fixture" ] |
| } |
| |
| fuchsia_component("gtest_runner_test_with_custom_args_component") { |
| testonly = true |
| manifest = "meta/test_with_custom_args.cml" |
| component_name = "test_with_custom_args" |
| deps = [ ":gtest_runner_test_with_custom_args" ] |
| } |
| |
| executable_gtest_gunit("runner_test_with_environ") { |
| testonly = true |
| sources = [ "test_with_environ.cc" ] |
| |
| deps = [ "//src/lib/testing/loop_fixture" ] |
| } |
| |
| fuchsia_component("gtest_runner_test_with_environ_component") { |
| testonly = true |
| manifest = "meta/test_with_environ.cml" |
| component_name = "test_with_environ" |
| deps = [ ":gtest_runner_test_with_environ" ] |
| } |
| |
| executable_gtest_gunit("huge_runner_example") { |
| testonly = true |
| sources = [ "huge_gtest.cc" ] |
| } |
| |
| fuchsia_component("huge_gtest_component") { |
| testonly = true |
| manifest = "meta/huge_gtest.cml" |
| component_name = "huge_gtest" |
| deps = [ ":gtest_huge_runner_example" ] |
| } |
| |
| executable("concurrency_test_driver_gtest") { |
| testonly = true |
| sources = [ "concurrency_test_driver.cc" ] |
| |
| deps = [ |
| "//examples/components/routing/fidl:echo_hlcpp", |
| "//sdk/lib/fidl/cpp", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/fxl/test:gtest_main", |
| "//zircon/system/ulib/async-default", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| fuchsia_component("concurrency_test_driver_component") { |
| testonly = true |
| manifest = "meta/concurrency-test-driver.cml" |
| component_name = "concurrency-test-driver" |
| deps = [ ":concurrency_test_driver_gtest" ] |
| } |
| |
| group("gtest_all_bins") { |
| testonly = true |
| deps = [ |
| ":death_gtest", |
| ":echo_gtest_client", |
| ":gtest_huge_runner_example", |
| ":gtest_runner_no_tests", |
| ":gtest_runner_sample_tests", |
| ":gtest_runner_test_with_custom_args", |
| ":gtest_runner_test_with_environ", |
| ] |
| } |
| |
| group("gunit_all_bins") { |
| testonly = true |
| deps = [ |
| ":gunit_huge_runner_example", |
| ":gunit_runner_no_tests", |
| ":gunit_runner_sample_tests", |
| ":gunit_runner_test_with_custom_args", |
| ":gunit_runner_test_with_environ", |
| ] |
| } |
| |
| fuchsia_component("echo_test_realm") { |
| testonly = true |
| manifest = "meta/echo_test_realm.cml" |
| } |
| |
| fuchsia_component("concurrency_test_component") { |
| testonly = true |
| component_name = "concurrency-test" |
| manifest = "meta/concurrency-test.cml" |
| } |
| |
| fuchsia_package("gtest-runner-example-tests") { |
| testonly = true |
| deps = [ |
| ":concurrency_test_component", |
| ":concurrency_test_driver_component", |
| ":death_gtest_component", |
| ":echo_gtest_client_component", |
| ":echo_test_realm", |
| ":empty_test_component", |
| ":gtest_runner_sample_tests_component", |
| ":gtest_runner_test_with_custom_args_component", |
| ":gtest_runner_test_with_environ_component", |
| ":huge_gtest_component", |
| "//src/sys/component_manager/testing/echo_server", |
| "//src/sys/test_runners:echo_server_for_concurrency_test", |
| ] |
| } |