| # 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 = [ |
| "//sdk/lib/syslog/cpp", |
| "//src/developer/forensics/crash_reports:config", |
| "//src/developer/forensics/testing:gtest_with_syslog_main", |
| "//src/lib/files", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| executable("crash_register_unittest_exe") { |
| testonly = true |
| |
| sources = [ "crash_register_unittest.cc" ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.feedback", |
| "//src/developer/forensics/crash_reports:crash_register", |
| "//src/developer/forensics/crash_reports/info", |
| "//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/files", |
| "//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/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: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("crash_server_unittest_exe") { |
| testonly = true |
| |
| # "crash_server_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 = [ "crash_server_unittest.cc" ] |
| |
| deps = [ |
| "//sdk/lib/sys/cpp/testing:unit", |
| "//src/developer/forensics/crash_reports:crash_server", |
| "//src/developer/forensics/testing:gtest_with_syslog_main", |
| "//src/developer/forensics/testing/stubs:loader", |
| "//src/lib/testing/loop_fixture", |
| "//src/lib/timekeeper:testing", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| 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/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: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("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/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/developer/forensics/testing:unit_test_fixture", |
| "//src/lib/fxl", |
| "//src/lib/timekeeper:testing", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| executable("network_watcher_unittest_exe") { |
| testonly = true |
| |
| # "network_watcher_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 = [ "network_watcher_unittest.cc" ] |
| |
| deps = [ |
| "//src/developer/forensics/crash_reports:network_watcher", |
| "//src/developer/forensics/testing:gtest_with_syslog_main", |
| "//src/developer/forensics/testing:unit_test_fixture", |
| "//src/developer/forensics/testing/stubs:network_reachability_provider", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| 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 = [ |
| "//src/developer/forensics/crash_reports:constants", |
| "//src/developer/forensics/crash_reports:queue", |
| "//src/developer/forensics/crash_reports/info", |
| "//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("report_util_unittest_exe") { |
| testonly = true |
| |
| sources = [ "report_util_unittest.cc" ] |
| |
| deps = [ |
| "//src/developer/forensics/crash_reports:report_util", |
| "//src/developer/forensics/testing:gtest_with_syslog_main", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| executable("sized_data_reader_unittest_exe") { |
| testonly = true |
| |
| sources = [ "sized_data_reader_unittest.cc" ] |
| |
| deps = [ |
| ":test_data", |
| "//src/developer/forensics/crash_reports:sized_data_reader", |
| "//src/lib/files", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/crashpad/util", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| executable("snapshot_manager_unittest_exe") { |
| testonly = true |
| |
| sources = [ "snapshot_manager_unittest.cc" ] |
| |
| deps = [ |
| "//src/developer/forensics/crash_reports:errors", |
| "//src/developer/forensics/crash_reports:snapshot_manager", |
| "//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:data_provider", |
| "//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/testing:unit_test_fixture", |
| "//src/developer/forensics/utils:sized_data", |
| "//src/developer/forensics/utils:storage_size", |
| "//src/lib/files", |
| "//src/lib/timekeeper:testing", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| |
| # TODO(fxbug.dev/57392): Move it back to //third_party once unification completes. |
| "//zircon/third_party/rapidjson", |
| ] |
| } |
| |
| executable("store_metadata_unittest_exe") { |
| testonly = true |
| |
| # "store_metadata_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_metadata_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:storage_size", |
| "//src/lib/files", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| ############################################################################### |
| # RESOURCES |
| ############################################################################### |
| resource("test_data") { |
| sources = [ "resources/test_data.zip" ] |
| |
| outputs = [ "data/test_data.zip" ] |
| } |
| |
| ############################################################################### |
| # CONFIGS |
| ############################################################################### |
| config_data("invalid_override_config") { |
| for_pkg = "copy-forensics-invalid-crash-reports-override-config" |
| |
| sources = [ "configs/invalid_override.json" ] |
| |
| outputs = [ "crash_reports/override_config.json" ] |
| } |
| |
| config_data("valid_override_config") { |
| for_pkg = "copy-forensics-valid-crash-reports-override-config" |
| |
| sources = [ "configs/valid_override.json" ] |
| |
| outputs = [ "crash_reports/override_config.json" ] |
| } |
| |
| ############################################################################### |
| # COMPONENTS |
| ############################################################################### |
| fuchsia_component("config_unittest") { |
| testonly = true |
| |
| manifest = "meta/config_unittest.cmx" |
| |
| deps = [ ":config_unittest_exe" ] |
| } |
| |
| 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("crash_server_unittest") { |
| testonly = true |
| |
| manifest = "meta/crash_server_unittest.cmx" |
| |
| deps = [ ":crash_server_unittest_exe" ] |
| } |
| |
| fuchsia_component("inspect_manager_unittest") { |
| testonly = true |
| |
| manifest = "meta/inspect_manager_unittest.cmx" |
| |
| deps = [ ":inspect_manager_unittest_exe" ] |
| } |
| |
| fuchsia_component("network_watcher_unittest") { |
| testonly = true |
| |
| manifest = "meta/network_watcher_unittest.cmx" |
| |
| deps = [ ":network_watcher_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("report_util_unittest") { |
| testonly = true |
| |
| manifest = "meta/report_util_unittest.cmx" |
| |
| deps = [ ":report_util_unittest_exe" ] |
| } |
| |
| fuchsia_component("sized_data_reader_unittest") { |
| testonly = true |
| |
| manifest = "meta/sized_data_reader_unittest.cmx" |
| |
| deps = [ ":sized_data_reader_unittest_exe" ] |
| } |
| |
| fuchsia_component("snapshot_manager_unittest") { |
| testonly = true |
| |
| manifest = "meta/snapshot_manager_unittest.cmx" |
| |
| deps = [ ":snapshot_manager_unittest_exe" ] |
| } |
| |
| fuchsia_component("store_unittest") { |
| testonly = true |
| |
| manifest = "meta/store_unittest.cmx" |
| |
| deps = [ ":store_unittest_exe" ] |
| } |
| |
| fuchsia_component("store_metadata_unittest") { |
| testonly = true |
| |
| manifest = "meta/store_metadata_unittest.cmx" |
| |
| deps = [ ":store_metadata_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", |
| ":crash_server_unittest", |
| ":snapshot_manager_unittest", |
| ":inspect_manager_unittest", |
| ":network_watcher_unittest", |
| ":main_service_unittest", |
| ":privacy_settings_ptr_unittest", |
| ":queue_unittest", |
| ":report_util_unittest", |
| ":sized_data_reader_unittest", |
| ":store_unittest", |
| ":store_metadata_unittest", |
| ] |
| |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| ############################################################################### |
| # GROUPS |
| ############################################################################### |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":crash-reports-tests", |
| |
| # To run the Crashpad tests. |
| "//third_party/crashpad:tests", |
| |
| # 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:copy-pkg", |
| "//src/developer/forensics:copy-pkg-invalid-crash-reports-override-config", |
| "//src/developer/forensics:copy-pkg-valid-crash-reports-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/time/timekeeper", |
| ] |
| } |