blob: d85680abc0d01f739865b2b3f95ac2a8f3206a3f [file] [log] [blame]
# 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/config.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
###############################################################################
# GROUPS
###############################################################################
group("tests") {
testonly = true
public_deps = [
":crash-reports-tests",
":invalid_override_config",
":valid_override_config",
# To run the Crashpad tests.
"//third_party/crashpad:crashpad_test",
# Packages for the components that we are injecting in the integration tests.
"//src/cobalt/bin/testing/mock_cobalt",
"//src/connectivity/network/netstack",
"//src/developer/feedback/crash_reports:fake-crash-reports",
"//src/developer/feedback/crash_reports:fake-crash-reports-invalid-override-config",
"//src/developer/feedback/crash_reports:fake-crash-reports-valid-override-config",
"//src/developer/feedback/testing/fakes:fake-device-id-provider",
"//src/developer/feedback/testing/fakes:fake_data_provider",
"//src/diagnostics/archivist",
"//src/sys/pkg/bin/system-update-checker",
"//src/sys/timekeeper",
]
}
###############################################################################
# PACKAGES
###############################################################################
test_package("crash-reports-tests") {
tests = [
{
name = "crash_reporter_unittest"
},
{
# Binary name on the host. We prefix it with "crash_reports" to reduce collisions.
name = "crash_reports_config_unittest"
# Component and binary name on the target. Confined to the package so no risk of collisions.
dest = "config_unittest"
},
{
# Binary name on the host. We prefix it with "crash_reports" to reduce collisions.
name = "crash_reports_database_unittest"
# Component and binary name on the target. Confined to the package so no risk of collisions.
dest = "database_unittest"
},
{
# Binary name on the host. We prefix it with "crash_reports" to reduce collisions.
name = "crash_reports_inspect_manager_unittest"
# Component and binary name on the target. Confined to the package so no risk of collisions.
dest = "inspect_manager_unittest"
},
{
name = "crash_reports_integration_test"
},
{
# Binary name on the host. Shared across all integration test components.
name = "crash_reports_integration_test"
# Component and binary name on the target. Specific to each integration test component.
dest = "crash_reports_integration_test_invalid_override_config"
},
{
# Binary name on the host. Shared across all integration test components.
name = "crash_reports_integration_test"
# Component and binary name on the target. Specific to each integration test component.
dest = "crash_reports_integration_test_valid_override_config"
},
{
# Binary name on the host. We prefix it with "crash_reports" to reduce collisions.
name = "crash_reports_main_service_unittest"
# Component and binary name on the target. Confined to the package so no risk of collisions.
dest = "main_service_unittest"
},
{
name = "privacy_settings_ptr_unittest"
},
{
name = "queue_unittest"
},
]
resources = [
# needed for config_unittest
{
path = "configs/valid_upload_disabled.json"
dest = "valid_config_upload_disabled.json"
},
# needed for config_unittest
{
path = "configs/valid_upload_enabled.json"
dest = "valid_config_upload_enabled.json"
},
# needed for config_unittest
{
path = "configs/valid_upload_read_from_privacy_settings.json"
dest = "valid_config_upload_read_from_privacy_settings.json"
},
# needed for config_unittest
{
path = "configs/valid_upload_disabled_spurious_server.json"
dest = "valid_config_upload_disabled_spurious_server.json"
},
# needed for config_unittest
{
path = "configs/bad_schema_spurious_field.json"
dest = "bad_schema_spurious_field_config.json"
},
# needed for config_unittest
{
path = "configs/bad_schema_missing_required_field.json"
dest = "bad_schema_missing_required_field_config.json"
},
# needed for config_unittest
{
path = "configs/bad_schema_missing_server_upload_enabled.json"
dest = "bad_schema_missing_server_upload_enabled_config.json"
},
# needed for config_unittest
{
path = "configs/bad_schema_missing_server_upload_read_from_privacy_settings.json"
dest = "bad_schema_missing_server_upload_read_from_privacy_settings_config.json"
},
# needed for config_unittest
{
path = "configs/bad_schema_invalid_upload_policy.json"
dest = "bad_schema_invalid_upload_policy_config.json"
},
]
deps = [
":config_unittest",
":crash_reporter_unittest",
":crash_reports_integration_test",
":database_unittest",
":inspect_manager_unittest",
":main_service_unittest",
":privacy_settings_ptr_unittest",
":queue_unittest",
]
}
###############################################################################
# EXECUTABLES
###############################################################################
executable("config_unittest") {
testonly = true
output_name = "crash_reports_config_unittest"
sources = [ "config_unittest.cc" ]
deps = [
"//src/developer/feedback/crash_reports:config",
"//src/developer/feedback/testing:gtest_with_syslog_main",
"//third_party/googletest:gtest",
]
}
executable("crash_reporter_unittest") {
testonly = true
sources = [
"crash_reporter_unittest.cc",
"stub_crash_server.cc",
"stub_crash_server.h",
]
deps = [
"//sdk/fidl/fuchsia.feedback",
"//sdk/fidl/fuchsia.settings",
"//sdk/lib/fidl/cpp",
"//sdk/lib/inspect/testing/cpp",
"//src/developer/feedback/crash_reports:constants",
"//src/developer/feedback/crash_reports:crash_reporter",
"//src/developer/feedback/crash_reports/info:info",
"//src/developer/feedback/testing:cobalt_test_fixture",
"//src/developer/feedback/testing:gtest_with_syslog_main",
"//src/developer/feedback/testing:unit_test_fixture",
"//src/developer/feedback/testing/fakes:privacy_settings",
"//src/developer/feedback/testing/stubs:channel_provider",
"//src/developer/feedback/testing/stubs:cobalt",
"//src/developer/feedback/testing/stubs:data_provider",
"//src/developer/feedback/testing/stubs:device_id_provider",
"//src/developer/feedback/testing/stubs:network_reachability_provider",
"//src/developer/feedback/testing/stubs:utc_provider",
"//src/developer/feedback/utils/cobalt",
"//src/lib/fsl",
"//src/lib/syslog/cpp",
"//src/lib/timekeeper:testing",
"//src/sys/timekeeper:fuchsia.time",
"//third_party/crashpad/util",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/zx",
"//zircon/system/fidl/fuchsia-mem",
]
}
executable("crash_reports_integration_test") {
testonly = true
sources = [ "crash_reports_integration_test.cc" ]
deps = [
"//sdk/fidl/fuchsia.feedback",
"//sdk/lib/sys/cpp",
"//src/developer/feedback/testing/fakes:cobalt",
"//src/developer/feedback/utils/cobalt",
"//src/lib/fsl",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/zx",
"//zircon/system/fidl/fuchsia-mem",
]
}
executable("main_service_unittest") {
testonly = true
output_name = "crash_reports_main_service_unittest"
sources = [ "main_service_unittest.cc" ]
deps = [
"//sdk/lib/inspect/testing/cpp",
"//src/developer/feedback/crash_reports:constants",
"//src/developer/feedback/crash_reports:main_service",
"//src/developer/feedback/crash_reports/info",
"//src/developer/feedback/testing:cobalt_test_fixture",
"//src/developer/feedback/testing:gtest_with_syslog_main",
"//src/developer/feedback/testing:unit_test_fixture",
"//src/developer/feedback/testing/stubs:cobalt",
"//src/developer/feedback/testing/stubs:device_id_provider",
"//src/developer/feedback/testing/stubs:network_reachability_provider",
"//src/developer/feedback/testing/stubs:utc_provider",
"//src/lib/syslog/cpp",
"//src/lib/timekeeper:testing",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/zx",
]
}
executable("database_unittest") {
testonly = true
output_name = "crash_reports_database_unittest"
sources = [
"crashpad_database_gremlin.cc",
"crashpad_database_gremlin.h",
"database_unittest.cc",
]
deps = [
"//sdk/lib/inspect/testing/cpp",
"//src/developer/feedback/crash_reports:database",
"//src/developer/feedback/crash_reports/info:info",
"//src/developer/feedback/testing:cobalt_test_fixture",
"//src/developer/feedback/testing:gtest_with_syslog_main",
"//src/developer/feedback/testing:unit_test_fixture",
"//src/developer/feedback/testing/stubs:cobalt",
"//src/developer/feedback/utils/cobalt",
"//src/lib/fsl",
"//src/lib/syslog/cpp",
"//src/lib/timekeeper:testing",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
}
executable("inspect_manager_unittest") {
testonly = true
output_name = "crash_reports_inspect_manager_unittest"
sources = [ "inspect_manager_unittest.cc" ]
deps = [
"//sdk/lib/inspect/testing/cpp",
"//src/developer/feedback/crash_reports:constants",
"//src/developer/feedback/crash_reports/info:inspect_manager",
"//src/developer/feedback/testing:gtest_with_syslog_main",
"//src/lib/fxl",
"//src/lib/syslog/cpp",
"//src/lib/timekeeper:testing",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/zx",
]
}
executable("privacy_settings_ptr_unittest") {
testonly = true
sources = [ "privacy_settings_ptr_unittest.cc" ]
deps = [
"//garnet/public/lib/fostr/fidl/fuchsia.settings",
"//sdk/fidl/fuchsia.settings",
"//src/developer/feedback/crash_reports:privacy_settings_ptr",
"//src/developer/feedback/testing:gtest_with_syslog_main",
"//src/developer/feedback/testing:unit_test_fixture",
"//src/developer/feedback/testing/fakes:privacy_settings",
"//src/lib/files",
"//src/lib/fxl",
"//third_party/googletest:gtest",
"//zircon/public/lib/zx",
]
}
executable("queue_unittest") {
testonly = true
sources = [
"queue_unittest.cc",
"stub_crash_server.cc",
"stub_crash_server.h",
]
deps = [
"//sdk/lib/inspect/testing/cpp",
"//src/developer/feedback/crash_reports:constants",
"//src/developer/feedback/crash_reports:queue",
"//src/developer/feedback/crash_reports/info:info",
"//src/developer/feedback/testing:cobalt_test_fixture",
"//src/developer/feedback/testing:gtest_with_syslog_main",
"//src/developer/feedback/testing:unit_test_fixture",
"//src/developer/feedback/testing/stubs:cobalt",
"//src/developer/feedback/testing/stubs:network_reachability_provider",
"//src/lib/fsl:fsl",
"//src/lib/timekeeper:testing",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
}
###############################################################################
# CONFIGS
###############################################################################
config_data("invalid_override_config") {
for_pkg = "fake-crash-reports-invalid-override-config"
sources = [ "configs/invalid_override.json" ]
outputs = [ "override_config.json" ]
}
config_data("valid_override_config") {
for_pkg = "fake-crash-reports-valid-override-config"
sources = [ "configs/valid_override.json" ]
outputs = [ "override_config.json" ]
}