blob: d292432e1172a2edf13aee98550f471b7e916527 [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/config.gni")
import("//src/hwinfo/hwinfo_config.gni")
import("//src/sys/build/components.gni")
###############################################################################
# EXECUTABLES
###############################################################################
executable("board_info_provider_unittest_exe") {
testonly = true
sources = [ "board_info_provider_unittest.cc" ]
deps = [
"//src/developer/forensics/feedback_data:constants",
"//src/developer/forensics/feedback_data/annotations:board_info_provider",
"//src/developer/forensics/testing:cobalt_test_fixture",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//src/developer/forensics/testing/stubs:board_info_provider",
"//src/developer/forensics/testing/stubs:cobalt",
"//src/lib/fxl",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-cpp",
"//zircon/public/lib/zx",
]
}
executable("channel_provider_unittest_exe") {
testonly = true
sources = [ "channel_provider_unittest.cc" ]
deps = [
"//sdk/lib/syslog/cpp",
"//src/developer/forensics/feedback_data:constants",
"//src/developer/forensics/feedback_data/annotations:channel_provider",
"//src/developer/forensics/feedback_data/annotations:types",
"//src/developer/forensics/testing:cobalt_test_fixture",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//src/developer/forensics/testing/stubs:channel_provider",
"//src/developer/forensics/testing/stubs:cobalt",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-cpp",
"//zircon/public/lib/fit",
"//zircon/public/lib/zx",
]
}
executable("config_unittest_exe") {
testonly = true
# "config_unittest" is rather generic for the default_output_dir that is set
# to root_out_dir so instead we write the binary to target_out_dir.
output_dir = target_out_dir
sources = [ "config_unittest.cc" ]
deps = [
"//src/developer/forensics/feedback_data:config",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/zx",
]
}
executable("data_provider_unittest_exe") {
testonly = true
sources = [ "data_provider_unittest.cc" ]
deps = [
"//garnet/public/lib/fostr/fidl/fuchsia.math",
"//sdk/fidl/fuchsia.feedback",
"//sdk/fidl/fuchsia.math",
"//sdk/fidl/fuchsia.sys",
"//sdk/lib/fidl/cpp",
"//src/developer/forensics/feedback_data:constants",
"//src/developer/forensics/feedback_data:data_provider",
"//src/developer/forensics/feedback_data:device_id_provider",
"//src/developer/forensics/feedback_data:integrity_reporter",
"//src/developer/forensics/feedback_data/annotations:types",
"//src/developer/forensics/feedback_data/attachments:types",
"//src/developer/forensics/testing:cobalt_test_fixture",
"//src/developer/forensics/testing:gmatchers",
"//src/developer/forensics/testing:gpretty_printers",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//src/developer/forensics/testing/stubs:cobalt",
"//src/developer/forensics/testing/stubs:scenic",
"//src/developer/forensics/utils:archive",
"//src/lib/fsl",
"//src/lib/fxl",
"//src/lib/timekeeper:testing",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//third_party/rapidjson",
"//zircon/public/lib/zx",
]
}
executable("data_register_unittest_exe") {
testonly = true
sources = [ "data_register_unittest.cc" ]
deps = [
"//sdk/fidl/fuchsia.feedback",
"//src/developer/forensics/feedback_data:data_register",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
}
executable("datastore_unittest_exe") {
testonly = true
sources = [ "datastore_unittest.cc" ]
deps = [
"//sdk/fidl/fuchsia.hwinfo",
"//sdk/fidl/fuchsia.intl",
"//src/developer/forensics/feedback_data:constants",
"//src/developer/forensics/feedback_data:datastore",
"//src/developer/forensics/feedback_data:device_id_provider",
"//src/developer/forensics/feedback_data/annotations:types",
"//src/developer/forensics/feedback_data/attachments:types",
"//src/developer/forensics/feedback_data/system_log_recorder:reader",
"//src/developer/forensics/testing:cobalt_test_fixture",
"//src/developer/forensics/testing:gmatchers",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//src/developer/forensics/testing/stubs:board_info_provider",
"//src/developer/forensics/testing/stubs:channel_provider",
"//src/developer/forensics/testing/stubs:cobalt",
"//src/developer/forensics/testing/stubs:inspect",
"//src/developer/forensics/testing/stubs:last_reboot_info_provider",
"//src/developer/forensics/testing/stubs:logger",
"//src/developer/forensics/testing/stubs:product_info_provider",
"//src/developer/forensics/utils:logs",
"//src/developer/forensics/utils:time",
"//src/lib/files",
"//src/lib/fxl",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-cpp",
"//zircon/public/lib/fit",
"//zircon/public/lib/zx",
]
}
executable("device_id_provider_unittest_exe") {
testonly = true
sources = [ "device_id_provider_unittest.cc" ]
deps = [
"//src/developer/forensics/feedback_data:device_id_provider",
"//src/developer/forensics/feedback_data/annotations:types",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/utils:errors",
"//src/lib/files:files",
"//src/lib/uuid:uuid",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
}
executable("feedback_data_integration_test_exe") {
testonly = true
sources = [ "feedback_data_integration_test.cc" ]
deps = [
":zx_object_util",
"//garnet/public/lib/fostr/fidl/fuchsia.feedback",
"//sdk/fidl/fuchsia.cobalt",
"//sdk/fidl/fuchsia.cobalt.test",
"//sdk/fidl/fuchsia.feedback",
"//sdk/fidl/fuchsia.hwinfo",
"//sdk/fidl/fuchsia.logger",
"//sdk/fidl/fuchsia.sys",
"//sdk/fidl/fuchsia.update.channel",
"//sdk/lib/fidl/cpp",
"//sdk/lib/inspect/contrib/cpp:archive_reader",
"//sdk/lib/sys/cpp",
"//sdk/lib/sys/cpp/testing:integration",
"//sdk/lib/syslog/cpp",
"//src/developer/forensics/feedback_data:constants",
"//src/developer/forensics/testing:gmatchers",
"//src/developer/forensics/testing/fakes:cobalt",
"//src/developer/forensics/utils:archive",
"//src/developer/forensics/utils/cobalt",
"//src/lib/fsl",
"//src/lib/fxl/test:gtest_main",
"//src/lib/uuid:uuid",
"//src/ui/lib/escher/test/common:gtest_vulkan",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//third_party/rapidjson",
"//zircon/public/lib/zx",
]
}
executable("main_service_unittest_exe") {
testonly = true
# "main_service_unittest" is rather generic for the default_output_dir that
# is set to root_out_dir so instead we write the binary to target_out_dir.
output_dir = target_out_dir
sources = [ "main_service_unittest.cc" ]
deps = [
"//sdk/lib/inspect/testing/cpp",
"//sdk/lib/syslog/cpp",
"//src/developer/forensics/feedback_data:main_service",
"//src/developer/forensics/testing:cobalt_test_fixture",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//src/developer/forensics/testing/stubs:cobalt",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/system/ulib/inspect",
]
}
executable("inspect_exe") {
testonly = true
sources = [ "inspect_exe.cc" ]
deps = [
"//sdk/lib/sys/cpp",
"//sdk/lib/sys/inspect/cpp",
"//src/lib/fxl",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
]
}
executable("inspect_ptr_unittest_exe") {
testonly = true
sources = [ "inspect_ptr_unittest.cc" ]
deps = [
"//sdk/lib/sys/cpp/testing:integration",
"//src/developer/forensics/feedback_data/attachments:attachment_providers",
"//src/developer/forensics/feedback_data/attachments:types",
"//src/developer/forensics/testing:gpretty_printers",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//src/developer/forensics/testing/stubs:inspect",
"//src/developer/forensics/utils:errors",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
}
executable("integrity_reporter_unittest_exe") {
testonly = true
sources = [ "integrity_reporter_unittest.cc" ]
deps = [
"//sdk/lib/syslog/cpp",
"//src/developer/forensics/feedback_data:integrity_reporter",
"//src/developer/forensics/feedback_data/annotations:types",
"//src/developer/forensics/feedback_data/attachments:types",
"//src/developer/forensics/utils:errors",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//third_party/rapidjson",
"//zircon/public/lib/fit",
]
}
executable("kernel_log_ptr_integration_test_exe") {
testonly = true
sources = [ "kernel_log_ptr_integration_test.cc" ]
deps = [
"//sdk/fidl/fuchsia.boot:fuchsia.boot_c",
"//sdk/lib/sys/cpp/testing:integration",
"//src/developer/forensics/feedback_data/attachments:attachment_providers",
"//src/developer/forensics/feedback_data/attachments:types",
"//src/developer/forensics/utils:errors",
"//src/lib/fxl",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/zx",
]
}
executable("last_reboot_info_provider_unittest_exe") {
testonly = true
# "last_reboot_info_provider_unittest" is also used by last-reboot.
output_dir = target_out_dir
sources = [ "last_reboot_info_provider_unittest.cc" ]
deps = [
"//src/developer/forensics/feedback_data:constants",
"//src/developer/forensics/feedback_data/annotations:last_reboot_info_provider",
"//src/developer/forensics/feedback_data/annotations:types",
"//src/developer/forensics/testing:cobalt_test_fixture",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//src/developer/forensics/testing/stubs:cobalt",
"//src/developer/forensics/testing/stubs:last_reboot_info_provider",
"//src/developer/forensics/utils:time",
"//src/lib/fxl",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-cpp",
]
}
executable("product_info_provider_unittest_exe") {
testonly = true
sources = [ "product_info_provider_unittest.cc" ]
deps = [
"//src/developer/forensics/feedback_data:constants",
"//src/developer/forensics/feedback_data/annotations:product_info_provider",
"//src/developer/forensics/testing:cobalt_test_fixture",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//src/developer/forensics/testing/stubs:cobalt",
"//src/developer/forensics/testing/stubs:product_info_provider",
"//src/developer/forensics/utils:errors",
"//src/lib/fxl",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-cpp",
"//zircon/public/lib/zx",
]
}
executable("screenshot_ptr_unittest_exe") {
testonly = true
sources = [ "screenshot_ptr_unittest.cc" ]
deps = [
"//sdk/fidl/fuchsia.ui.scenic",
"//src/developer/forensics/feedback_data/attachments:attachment_providers",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//src/developer/forensics/testing/stubs:scenic",
"//src/lib/fxl",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-cpp",
"//zircon/public/lib/zx",
]
}
executable("system_log_ptr_unittest_exe") {
testonly = true
sources = [ "system_log_ptr_unittest.cc" ]
deps = [
"//garnet/public/lib/fostr/fidl/fuchsia.mem",
"//src/developer/forensics/feedback_data/attachments:attachment_providers",
"//src/developer/forensics/feedback_data/attachments:types",
"//src/developer/forensics/testing:gmatchers",
"//src/developer/forensics/testing:gpretty_printers",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//src/developer/forensics/testing/stubs:logger",
"//src/developer/forensics/utils:errors",
"//src/lib/fxl",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-cpp",
"//zircon/public/lib/zx",
]
}
executable("system_log_recorder_unittest_exe") {
testonly = true
sources = [ "system_log_recorder_unittest.cc" ]
deps = [
"//src/developer/forensics/feedback_data/attachments:types",
"//src/developer/forensics/feedback_data/system_log_recorder:reader",
"//src/developer/forensics/feedback_data/system_log_recorder:src",
"//src/developer/forensics/feedback_data/system_log_recorder/encoding:decoder",
"//src/developer/forensics/feedback_data/system_log_recorder/encoding:identity_decoder",
"//src/developer/forensics/feedback_data/system_log_recorder/encoding:identity_encoder",
"//src/developer/forensics/feedback_data/system_log_recorder/encoding:production",
"//src/developer/forensics/testing:gmatchers",
"//src/developer/forensics/testing:gpretty_printers",
"//src/developer/forensics/testing:gtest_with_syslog_main",
"//src/developer/forensics/testing:unit_test_fixture",
"//src/developer/forensics/testing/stubs:logger",
"//src/developer/forensics/utils:errors",
"//src/lib/files",
"//src/lib/fxl",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-cpp",
"//zircon/public/lib/zx",
]
}
###############################################################################
# SOURCES
###############################################################################
source_set("zx_object_util") {
sources = [
"zx_object_util.cc",
"zx_object_util.h",
]
public_deps = [
"//sdk/lib/syslog/cpp",
"//zircon/public/lib/zx",
]
}
###############################################################################
# RESOURCES
###############################################################################
resource("main_service_unittest_config") {
sources = [ "configs/main_service_unittest.json" ]
# main_service.cc expects a config at /pkg/data/config.json
outputs = [ "data/config.json" ]
}
resource("test_configs") {
sources = [
"configs/bad_schema_duplicated_attachment_key.json",
"configs/bad_schema_missing_required_field.json",
"configs/bad_schema_spurious_field.json",
"configs/valid.json",
"configs/valid_empty_list.json",
]
outputs = [ "data/configs/{{source_file_part}}" ]
}
resource("test_image") {
sources =
[ "//src/developer/forensics/testing/resources/checkerboard_100.png" ]
outputs = [ "data/checkerboard_100.png" ]
}
###############################################################################
# CONFIGS
###############################################################################
hwinfo_config_validate("fake_hwinfo_product_config_validate") {
type = "product"
config = "configs/hwinfo_product_config.json"
}
hwinfo_config_validate("fake_hwinfo_board_config_validate") {
type = "board"
config = "configs/hwinfo_board_config.json"
}
config_data("fake_hwinfo_product_config") {
for_pkg = "fake_hwinfo"
sources = [ rebase_path("configs/hwinfo_product_config.json") ]
outputs = [ "product_config.json" ]
deps = [ ":fake_hwinfo_product_config_validate" ]
}
config_data("fake_hwinfo_board_config") {
for_pkg = "fake_hwinfo"
sources = [ rebase_path("configs/hwinfo_board_config.json") ]
outputs = [ "board_config.json" ]
deps = [ ":fake_hwinfo_board_config_validate" ]
}
config_data("fake_hwinfo_factory_config") {
for_pkg = "fake_factory_store_providers"
sources = [ "configs/hwinfo_factory_config.json" ]
outputs = [ "fuchsia.factory.MiscFactoryStoreProvider.config" ]
}
###############################################################################
# COMPONENTS
###############################################################################
fuchsia_component("board_info_provider_unittest") {
testonly = true
manifest = "meta/board_info_provider_unittest.cmx"
deps = [ ":board_info_provider_unittest_exe" ]
}
fuchsia_component("channel_provider_unittest") {
testonly = true
manifest = "meta/channel_provider_unittest.cmx"
deps = [ ":channel_provider_unittest_exe" ]
}
fuchsia_component("config_unittest") {
testonly = true
manifest = "meta/config_unittest.cmx"
deps = [
":config_unittest_exe",
":test_configs",
]
}
fuchsia_component("data_provider_unittest") {
testonly = true
manifest = "meta/data_provider_unittest.cmx"
deps = [
":data_provider_unittest_exe",
":test_image",
]
}
fuchsia_component("data_register_unittest") {
testonly = true
manifest = "meta/data_register_unittest.cmx"
deps = [ ":data_register_unittest_exe" ]
}
fuchsia_component("datastore_unittest") {
testonly = true
manifest = "meta/datastore_unittest.cmx"
deps = [ ":datastore_unittest_exe" ]
}
fuchsia_component("device_id_provider_unittest") {
testonly = true
manifest = "meta/device_id_provider_unittest.cmx"
deps = [ ":device_id_provider_unittest_exe" ]
}
fuchsia_component("feedback_data_integration_test") {
testonly = true
manifest = "meta/feedback_data_integration_test.cmx"
deps = [ ":feedback_data_integration_test_exe" ]
}
fuchsia_component("inspect_ptr_unittest") {
testonly = true
manifest = "meta/inspect_ptr_unittest.cmx"
deps = [ ":inspect_ptr_unittest_exe" ]
}
fuchsia_component("inspect_test_app") {
testonly = true
manifest = "meta/inspect_test_app.cmx"
deps = [ ":inspect_exe" ]
}
fuchsia_component("integrity_reporter_unittest") {
testonly = true
manifest = "meta/integrity_reporter_unittest.cmx"
deps = [ ":integrity_reporter_unittest_exe" ]
}
fuchsia_component("kernel_log_ptr_integration_test") {
testonly = true
manifest = "meta/kernel_log_ptr_integration_test.cmx"
deps = [ ":kernel_log_ptr_integration_test_exe" ]
}
fuchsia_component("last_reboot_info_provider_unittest") {
testonly = true
manifest = "meta/last_reboot_info_provider_unittest.cmx"
deps = [ ":last_reboot_info_provider_unittest_exe" ]
}
fuchsia_component("main_service_unittest") {
testonly = true
manifest = "meta/main_service_unittest.cmx"
deps = [
":main_service_unittest_config",
":main_service_unittest_exe",
]
}
fuchsia_component("product_info_provider_unittest") {
testonly = true
manifest = "meta/product_info_provider_unittest.cmx"
deps = [ ":product_info_provider_unittest_exe" ]
}
fuchsia_component("screenshot_ptr_unittest") {
testonly = true
manifest = "meta/screenshot_ptr_unittest.cmx"
deps = [ ":screenshot_ptr_unittest_exe" ]
}
fuchsia_component("system_log_ptr_unittest") {
testonly = true
manifest = "meta/system_log_ptr_unittest.cmx"
deps = [ ":system_log_ptr_unittest_exe" ]
}
fuchsia_component("system_log_recorder_unittest") {
testonly = true
manifest = "meta/system_log_recorder_unittest.cmx"
deps = [ ":system_log_recorder_unittest_exe" ]
}
###############################################################################
# PACKAGES
###############################################################################
fuchsia_test_package("feedback-data-tests") {
test_components = [
":board_info_provider_unittest",
":channel_provider_unittest",
":config_unittest",
":data_provider_unittest",
":data_register_unittest",
":datastore_unittest",
":device_id_provider_unittest",
":feedback_data_integration_test",
":inspect_ptr_unittest",
":integrity_reporter_unittest",
":kernel_log_ptr_integration_test",
":last_reboot_info_provider_unittest",
":main_service_unittest",
":product_info_provider_unittest",
":screenshot_ptr_unittest",
":system_log_ptr_unittest",
":system_log_recorder_unittest",
]
deps = [
# needed for feedback_data_integration_test
":inspect_test_app",
]
}
###############################################################################
# GROUPS
###############################################################################
group("tests") {
testonly = true
deps = [
":fake_hwinfo_board_config",
":fake_hwinfo_product_config",
":feedback-data-tests",
# Packages for the components that we are injecting in the integration tests.
"//garnet/bin/sysmem_connector",
"//src/cobalt/bin/testing/mock_cobalt",
"//src/developer/forensics/feedback_data:feedback_agent",
"//src/developer/forensics/testing/fakes:fake-last-reboot-info-provider",
"//src/diagnostics/archivist",
"//src/graphics/bin/vulkan_loader",
"//src/hwinfo:tests",
"//src/sys/pkg/bin/system-update-checker",
]
}