| # 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("//src/sys/build/components.gni") |
| |
| ############################################################################### |
| # EXECUTABLES |
| ############################################################################### |
| 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/crash_reports:config", |
| "//src/developer/forensics/testing:gtest_with_syslog_main", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| executable("crash_register_unittest_exe") { |
| testonly = true |
| |
| sources = [ "crash_register_unittest.cc" ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.feedback", |
| "//sdk/lib/inspect/testing/cpp", |
| "//src/developer/forensics/crash_reports:crash_register", |
| "//src/developer/forensics/crash_reports/info", |
| "//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", |
| "//src/lib/timekeeper:testing", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/async-cpp", |
| "//zircon/public/lib/fit", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| executable("crash_reporter_unittest_exe") { |
| testonly = true |
| |
| sources = [ |
| "crash_reporter_unittest.cc", |
| "stub_crash_server.cc", |
| "stub_crash_server.h", |
| ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.feedback", |
| "//sdk/fidl/fuchsia.mem", |
| "//sdk/fidl/fuchsia.settings", |
| "//sdk/fidl/fuchsia.time", |
| "//sdk/lib/fidl/cpp", |
| "//sdk/lib/inspect/testing/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//src/developer/forensics/crash_reports:constants", |
| "//src/developer/forensics/crash_reports:crash_reporter", |
| "//src/developer/forensics/crash_reports/info:info", |
| "//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/fakes:privacy_settings", |
| "//src/developer/forensics/testing/stubs:channel_provider", |
| "//src/developer/forensics/testing/stubs:cobalt", |
| "//src/developer/forensics/testing/stubs:data_provider", |
| "//src/developer/forensics/testing/stubs:device_id_provider", |
| "//src/developer/forensics/testing/stubs:network_reachability_provider", |
| "//src/developer/forensics/testing/stubs:utc_provider", |
| "//src/developer/forensics/utils/cobalt", |
| "//src/lib/fsl", |
| "//src/lib/timekeeper:testing", |
| "//third_party/crashpad/util", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| executable("crash_reports_integration_test_exe") { |
| testonly = true |
| |
| sources = [ "crash_reports_integration_test.cc" ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.feedback", |
| "//sdk/fidl/fuchsia.mem", |
| "//sdk/lib/sys/cpp", |
| "//src/developer/forensics/testing/fakes:cobalt", |
| "//src/developer/forensics/utils/cobalt", |
| "//src/lib/fsl", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| "//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/fidl/fuchsia.feedback", |
| "//sdk/lib/inspect/testing/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//src/developer/forensics/crash_reports:constants", |
| "//src/developer/forensics/crash_reports:main_service", |
| "//src/developer/forensics/crash_reports/info", |
| "//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:device_id_provider", |
| "//src/developer/forensics/testing/stubs:network_reachability_provider", |
| "//src/developer/forensics/testing/stubs:utc_provider", |
| "//src/lib/timekeeper:testing", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| executable("database_unittest_exe") { |
| testonly = true |
| |
| # "database_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 = [ |
| "crashpad_database_gremlin.cc", |
| "crashpad_database_gremlin.h", |
| "database_unittest.cc", |
| ] |
| |
| deps = [ |
| "//sdk/lib/inspect/testing/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//src/developer/forensics/crash_reports:database", |
| "//src/developer/forensics/crash_reports/info:info", |
| "//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/utils/cobalt", |
| "//src/lib/fsl", |
| "//src/lib/timekeeper:testing", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| executable("inspect_manager_unittest_exe") { |
| testonly = true |
| |
| # "inspect_manager_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 = [ "inspect_manager_unittest.cc" ] |
| |
| deps = [ |
| "//sdk/lib/inspect/testing/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//src/developer/forensics/crash_reports:constants", |
| "//src/developer/forensics/crash_reports:errors", |
| "//src/developer/forensics/crash_reports/info:inspect_manager", |
| "//src/developer/forensics/testing:gtest_with_syslog_main", |
| "//src/lib/fxl", |
| "//src/lib/timekeeper:testing", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| executable("privacy_settings_ptr_unittest_exe") { |
| testonly = true |
| |
| sources = [ "privacy_settings_ptr_unittest.cc" ] |
| |
| deps = [ |
| "//garnet/public/lib/fostr/fidl/fuchsia.settings", |
| "//sdk/fidl/fuchsia.settings", |
| "//src/developer/forensics/crash_reports:privacy_settings_ptr", |
| "//src/developer/forensics/testing:gtest_with_syslog_main", |
| "//src/developer/forensics/testing:unit_test_fixture", |
| "//src/developer/forensics/testing/fakes:privacy_settings", |
| "//src/lib/files", |
| "//src/lib/fxl", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| executable("queue_unittest_exe") { |
| testonly = true |
| |
| sources = [ |
| "queue_unittest.cc", |
| "stub_crash_server.cc", |
| "stub_crash_server.h", |
| ] |
| |
| deps = [ |
| "//sdk/lib/inspect/testing/cpp", |
| "//src/developer/forensics/crash_reports:constants", |
| "//src/developer/forensics/crash_reports:queue", |
| "//src/developer/forensics/crash_reports/info", |
| "//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:network_reachability_provider", |
| "//src/lib/fsl:fsl", |
| "//src/lib/timekeeper:testing", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| executable("store_unittest_exe") { |
| testonly = true |
| |
| # "store_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. |
| sources = [ "store_unittest.cc" ] |
| |
| deps = [ |
| "//sdk/lib/syslog/cpp", |
| "//src/developer/forensics/crash_reports:store", |
| "//src/developer/forensics/testing:gtest_with_syslog_main", |
| "//src/developer/forensics/utils:sized_data", |
| "//src/lib/files", |
| "//third_party/googletest:gtest", |
| "//third_party/rapidjson", |
| ] |
| } |
| |
| ############################################################################### |
| # RESOURCES |
| ############################################################################### |
| resource("test_configs") { |
| sources = [ |
| "configs/bad_schema_invalid_upload_policy.json", |
| "configs/bad_schema_missing_required_field.json", |
| "configs/bad_schema_missing_server_upload_enabled.json", |
| "configs/bad_schema_missing_server_upload_read_from_privacy_settings.json", |
| "configs/bad_schema_spurious_field.json", |
| "configs/valid_upload_disabled.json", |
| "configs/valid_upload_disabled_spurious_server.json", |
| "configs/valid_upload_enabled.json", |
| "configs/valid_upload_read_from_privacy_settings.json", |
| ] |
| |
| outputs = [ "data/configs/{{source_file_part}}" ] |
| } |
| |
| ############################################################################### |
| # 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" ] |
| } |
| |
| ############################################################################### |
| # COMPONENTS |
| ############################################################################### |
| fuchsia_component("config_unittest") { |
| testonly = true |
| |
| manifest = "meta/config_unittest.cmx" |
| |
| deps = [ |
| ":config_unittest_exe", |
| ":test_configs", |
| ] |
| } |
| |
| fuchsia_component("crash_register_unittest") { |
| testonly = true |
| |
| manifest = "meta/crash_register_unittest.cmx" |
| |
| deps = [ ":crash_register_unittest_exe" ] |
| } |
| |
| fuchsia_component("crash_reporter_unittest") { |
| testonly = true |
| |
| manifest = "meta/crash_reporter_unittest.cmx" |
| |
| deps = [ ":crash_reporter_unittest_exe" ] |
| } |
| |
| fuchsia_component("crash_reports_integration_test") { |
| testonly = true |
| |
| manifest = "meta/crash_reports_integration_test.cmx" |
| |
| deps = [ ":crash_reports_integration_test_exe" ] |
| } |
| |
| fuchsia_component("crash_reports_integration_test_invalid_override_config") { |
| testonly = true |
| |
| manifest = "meta/crash_reports_integration_test_invalid_override_config.cmx" |
| |
| deps = [ |
| ":crash_reports_integration_test_exe", |
| ":invalid_override_config", |
| ] |
| } |
| |
| fuchsia_component("crash_reports_integration_test_valid_override_config") { |
| testonly = true |
| |
| manifest = "meta/crash_reports_integration_test_valid_override_config.cmx" |
| |
| deps = [ |
| ":crash_reports_integration_test_exe", |
| ":valid_override_config", |
| ] |
| } |
| |
| fuchsia_component("database_unittest") { |
| testonly = true |
| |
| manifest = "meta/database_unittest.cmx" |
| |
| deps = [ ":database_unittest_exe" ] |
| } |
| |
| fuchsia_component("inspect_manager_unittest") { |
| testonly = true |
| |
| manifest = "meta/inspect_manager_unittest.cmx" |
| |
| deps = [ ":inspect_manager_unittest_exe" ] |
| } |
| |
| fuchsia_component("main_service_unittest") { |
| testonly = true |
| |
| manifest = "meta/main_service_unittest.cmx" |
| |
| deps = [ ":main_service_unittest_exe" ] |
| } |
| |
| fuchsia_component("privacy_settings_ptr_unittest") { |
| testonly = true |
| |
| manifest = "meta/privacy_settings_ptr_unittest.cmx" |
| |
| deps = [ ":privacy_settings_ptr_unittest_exe" ] |
| } |
| |
| fuchsia_component("queue_unittest") { |
| testonly = true |
| |
| manifest = "meta/queue_unittest.cmx" |
| |
| deps = [ ":queue_unittest_exe" ] |
| } |
| |
| fuchsia_component("store_unittest") { |
| testonly = true |
| |
| manifest = "meta/store_unittest.cmx" |
| |
| deps = [ ":store_unittest_exe" ] |
| } |
| |
| ############################################################################### |
| # PACKAGES |
| ############################################################################### |
| fuchsia_test_package("crash-reports-tests") { |
| test_components = [ |
| ":config_unittest", |
| ":crash_register_unittest", |
| ":crash_reporter_unittest", |
| ":crash_reports_integration_test", |
| ":crash_reports_integration_test_invalid_override_config", |
| ":crash_reports_integration_test_valid_override_config", |
| ":database_unittest", |
| ":inspect_manager_unittest", |
| ":main_service_unittest", |
| ":privacy_settings_ptr_unittest", |
| ":queue_unittest", |
| ":store_unittest", |
| ] |
| } |
| |
| ############################################################################### |
| # GROUPS |
| ############################################################################### |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":crash-reports-tests", |
| |
| # 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/forensics/crash_reports:fake-crash-reports", |
| "//src/developer/forensics/crash_reports:fake-crash-reports-invalid-override-config", |
| "//src/developer/forensics/crash_reports:fake-crash-reports-valid-override-config", |
| "//src/developer/forensics/testing/fakes:fake-data-provider", |
| "//src/developer/forensics/testing/fakes:fake-device-id-provider", |
| "//src/diagnostics/archivist", |
| "//src/sys/pkg/bin/system-update-checker", |
| "//src/sys/timekeeper", |
| ] |
| } |