blob: ebcb1d3c7457f07774c409d2ccce8e355e2c43c2 [file] [log] [blame]
# Copyright 2021 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/test.gni")
import("//build/testing/cc_test_executable.gni")
group("tests") {
testonly = true
deps = [ ":component_cpp_testing_realm_builder_tests" ]
}
source_set("test_utils") {
testonly = true
sources = [
"utils.cc",
"utils.h",
]
deps = [
"//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_hlcpp",
"//sdk/fidl/fuchsia.component.test:fuchsia.component.test_hlcpp",
"//sdk/fidl/fuchsia.io:fuchsia.io_hlcpp",
"//sdk/lib/sys/component/cpp/testing:cpp",
]
}
executable("echo_server_bin") {
testonly = true
sources = [ "echo_server.cc" ]
deps = [
"//sdk/lib/async:async-cpp",
"//sdk/lib/async-loop:async-loop-cpp",
"//sdk/lib/async-loop:async-loop-default",
"//sdk/lib/sys/cpp",
"//src/lib/fxl:fxl_cli",
"//src/testing/fidl:placeholders_hlcpp",
]
}
executable("echo_server_sc_bin") {
testonly = true
sources = [ "echo_server_sc.cc" ]
deps = [
":echo_server_config_lib",
"//sdk/lib/async:async-cpp",
"//sdk/lib/async-loop:async-loop-cpp",
"//sdk/lib/async-loop:async-loop-default",
"//sdk/lib/sys/cpp",
"//src/lib/fxl",
"//src/testing/fidl:placeholders_hlcpp",
]
}
cc_test_executable("realm_builder_test_bin") {
testonly = true
sources = [ "realm_builder_test.cc" ]
deps = [
":test_utils",
"//examples/fidl/fuchsia.examples:fuchsia.examples_cpp",
"//examples/fidl/fuchsia.examples:fuchsia.examples_hlcpp",
"//sdk/fidl/fuchsia.component:fuchsia.component_hlcpp",
"//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_hlcpp",
"//sdk/fidl/fuchsia.io:fuchsia.io_hlcpp",
"//sdk/fidl/fuchsia.logger:fuchsia.logger_hlcpp",
"//sdk/fidl/fuchsia.sys2:fuchsia.sys2_hlcpp",
"//sdk/lib/sys/component/cpp/testing:cpp",
"//sdk/lib/sys/cpp",
"//sdk/lib/syslog/cpp",
"//src/lib/fxl/test:gtest_main",
"//src/lib/testing/loop_fixture",
"//src/testing/fidl:placeholders_cpp",
"//src/testing/fidl:placeholders_hlcpp",
]
}
cc_test_executable("internal_test_bin") {
testonly = true
sources = [ "internal_test.cc" ]
deps = [
":test_utils",
"//sdk/fidl/fuchsia.component:fuchsia.component_hlcpp",
"//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_hlcpp",
"//sdk/fidl/fuchsia.component.test:fuchsia.component.test_hlcpp",
"//sdk/fidl/fuchsia.io:fuchsia.io_hlcpp",
"//sdk/lib/sys/component/cpp/testing:cpp",
"//sdk/lib/sys/cpp",
"//src/lib/fxl/test:gtest_main",
"//src/lib/testing/loop_fixture",
"//src/testing/fidl:placeholders_hlcpp",
]
}
fuchsia_component("echo_server") {
deps = [ ":echo_server_bin" ]
manifest = "meta/echo_server.cml"
testonly = true
}
fuchsia_component_manifest("echo_server_sc_manifest") {
testonly = true
component_name = "echo_server_sc"
manifest = "meta/echo_server_sc.cml"
}
fuchsia_component("echo_server_sc") {
testonly = true
cm_label = ":echo_server_sc_manifest"
deps = [ ":echo_server_sc_bin" ]
}
fuchsia_structured_config_cpp_elf_lib("echo_server_config_lib") {
testonly = true
cm_label = ":echo_server_sc_manifest"
}
fuchsia_structured_config_values("echo_server_default_config") {
testonly = true
cm_label = ":echo_server_sc_manifest"
values = {
my_flag = true
my_uint8 = 255
my_uint16 = 65535
my_uint32 = 4000000000
my_uint64 = 8000000000
my_int8 = -127
my_int16 = -32766
my_int32 = -2000000000
my_int64 = -4000000000
my_string = "hello"
my_vector_of_flag = [
true,
false,
]
my_vector_of_uint8 = [
1,
2,
]
my_vector_of_uint16 = [
2,
3,
]
my_vector_of_uint32 = [
3,
4,
]
my_vector_of_uint64 = [
4,
5,
]
my_vector_of_int8 = [
-1,
-2,
]
my_vector_of_int16 = [
-2,
-3,
]
my_vector_of_int32 = [
-3,
-4,
]
my_vector_of_int64 = [
-4,
-5,
]
my_vector_of_string = [
"foo",
"bar",
]
}
}
fuchsia_component("realm_builder_test") {
testonly = true
deps = [ ":realm_builder_test_bin" ]
manifest = "meta/realm_builder_test.cml"
}
fuchsia_component("pre_populated_realm") {
testonly = true
manifest = "meta/pre_populated_realm.cml"
}
fuchsia_unittest_component("internal_test") {
deps = [ ":internal_test_bin" ]
}
fuchsia_test_package("component_cpp_testing_realm_builder_tests") {
test_components = [
":realm_builder_test",
":internal_test",
]
deps = [
":echo_server",
":echo_server_default_config",
":echo_server_sc",
":pre_populated_realm",
"//sdk/lib/component/tests:echo_service_server",
]
}