| # 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/components.gni") | |
| import("//build/components/fuchsia_unittest_component.gni") | |
| import("//build/testing/cc_test_executable.gni") | |
| visibility = [ ":*" ] | |
| ############################################################################### | |
| # SOURCES | |
| ############################################################################### | |
| source_set("test_lib") { | |
| testonly = true | |
| sources = [ | |
| "crasher_wrapper.cc", | |
| "crasher_wrapper.h", | |
| ] | |
| deps = [ | |
| "//sdk/lib/fdio", | |
| "//sdk/lib/syslog/cpp", | |
| "//src/lib/fostr/fidl/fuchsia.exception", | |
| "//src/lib/fsl", | |
| "//zircon/system/ulib/zx", | |
| ] | |
| } | |
| ############################################################################### | |
| # EXECUTABLES | |
| ############################################################################### | |
| executable("crasher") { | |
| testonly = true | |
| output_name = "exception_broker_crasher" | |
| sources = [ "crasher.cc" ] | |
| # TODO(https://fxbug.dev/42069777): Remove this once the underlying issue is addressed. | |
| exclude_toolchain_tags = [ "hwasan" ] | |
| } | |
| cc_test_executable("exception_broker_config_test_exe") { | |
| testonly = true | |
| sources = [ "exception_broker_config_test.cc" ] | |
| deps = [ | |
| "//sdk/lib/inspect/testing/cpp", | |
| "//sdk/lib/sys/cpp/testing:unit", | |
| "//src/developer/forensics/exceptions:lib", | |
| "//src/lib/fsl", | |
| "//src/lib/fxl", | |
| "//src/lib/fxl/test:gtest_main", | |
| "//third_party/googletest:gmock", | |
| "//third_party/googletest:gtest", | |
| ] | |
| } | |
| cc_test_executable("exception_broker_integration_test_exe") { | |
| testonly = true | |
| sources = [ "exception_broker_integration_test.cc" ] | |
| deps = [ | |
| ":test_lib", | |
| "//sdk/fidl/fuchsia.exception:fuchsia.exception_hlcpp", | |
| "//src/developer/forensics/exceptions:lib", | |
| "//src/developer/forensics/public/fakes:fuchsia.feedback.testing_hlcpp", | |
| "//src/developer/forensics/testing:gtest_with_syslog_main", | |
| "//src/lib/fsl", | |
| "//src/lib/fxl", | |
| "//third_party/googletest:gtest", | |
| ] | |
| # TODO(https://fxbug.dev/42069777): Remove this once the underlying issue is addressed. | |
| exclude_toolchain_tags = [ "hwasan" ] | |
| } | |
| cc_test_executable("exception_broker_unittest_exe") { | |
| testonly = true | |
| sources = [ | |
| "crash_counter_unittest.cc", | |
| "crash_reporter_unittest.cc", | |
| "exception_broker_unittest.cc", | |
| "minidump_unittest.cc", | |
| "process_limbo_manager_unittest.cc", | |
| "report_builder_unittest.cc", | |
| ] | |
| deps = [ | |
| ":test_lib", | |
| "//sdk/fidl/fuchsia.driver.crash:fuchsia.driver.crash_cpp", | |
| "//sdk/fidl/fuchsia.feedback:fuchsia.feedback_cpp", | |
| "//sdk/fidl/fuchsia.sys2:fuchsia.sys2_cpp", | |
| "//sdk/lib/sys/cpp/testing:unit", | |
| "//src/developer/forensics/exceptions:constants", | |
| "//src/developer/forensics/exceptions:lib", | |
| "//src/developer/forensics/exceptions/handler:lib", | |
| "//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:fidl_server", | |
| "//src/developer/forensics/testing/stubs:wake_lease", | |
| "//src/lib/fxl", | |
| "//src/lib/fxl/test:test_settings", | |
| "//third_party/googletest:gtest", | |
| "//zircon/system/ulib/zx", | |
| ] | |
| } | |
| cc_test_executable("process_launch_failure_unittest_exe") { | |
| testonly = true | |
| sources = [ "process_launch_failure_unittest.cc" ] | |
| deps = [ | |
| ":test_lib", | |
| "//src/developer/forensics/exceptions:lib", | |
| "//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/lib/fostr/fidl/fuchsia.exception", | |
| "//third_party/googletest:gtest", | |
| "//zircon/system/ulib/zx", | |
| ] | |
| } | |
| cc_test_executable("wake_lease_integration_test_exe") { | |
| testonly = true | |
| sources = [ "wake_lease_integration_test.cc" ] | |
| deps = [ | |
| "//sdk/lib/component/incoming/cpp", | |
| "//src/developer/forensics/exceptions:constants", | |
| "//src/developer/forensics/exceptions/handler:lib", | |
| "//src/developer/forensics/testing:gtest_with_syslog_main", | |
| "//src/lib/testing/loop_fixture", | |
| "//third_party/googletest:gtest", | |
| ] | |
| } | |
| cc_test_executable("wake_lease_unittest_exe") { | |
| testonly = true | |
| sources = [ "wake_lease_unittest.cc" ] | |
| deps = [ | |
| "//src/developer/forensics/exceptions:constants", | |
| "//src/developer/forensics/exceptions/handler:lib", | |
| "//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:system_activity_governor", | |
| "//src/developer/forensics/utils:promise_timeout", | |
| "//third_party/googletest:gtest", | |
| ] | |
| } | |
| executable("stub_exception_handler_exe") { | |
| testonly = true | |
| # We need the same name as the real sub-process spawned by the exception | |
| # broker, but we need to put it in a different build directory that the | |
| # default one. | |
| output_name = "exception_handler" | |
| output_dir = target_out_dir | |
| sources = [ "stub_exception_handler.cc" ] | |
| deps = [ | |
| "//sdk/lib/async-loop:async-loop-cpp", | |
| "//sdk/lib/async-loop:async-loop-default", | |
| "//sdk/lib/fit", | |
| "//src/developer/forensics/exceptions/fidl:fuchsia.exception.internal_cpp", | |
| ] | |
| } | |
| ############################################################################### | |
| # RESOURCES | |
| ############################################################################### | |
| resource("enable_jitd_on_startup") { | |
| sources = [ "configs/test_enable_jitd_on_startup.json" ] | |
| outputs = [ "data/enable_jitd_on_startup.json" ] | |
| } | |
| resource("filter_jitd_config") { | |
| sources = [ "configs/test_filter_jitd_config.json" ] | |
| outputs = [ "data/filter_jitd_config.json" ] | |
| } | |
| ############################################################################### | |
| # COMPONENTS | |
| ############################################################################### | |
| fuchsia_component("exception_broker_config_test") { | |
| testonly = true | |
| manifest = "meta/exception_broker_config_test.cml" | |
| deps = [ | |
| ":enable_jitd_on_startup", | |
| ":exception_broker_config_test_exe", | |
| ":filter_jitd_config", | |
| ] | |
| } | |
| fuchsia_test_component("exception_broker_integration_test") { | |
| manifest = "meta/exception_broker_integration_test.cml" | |
| deps = [ | |
| ":config_suspend_disabled", | |
| ":crasher", | |
| ":exception_broker_integration_test_exe", | |
| ] | |
| } | |
| fuchsia_test_component("wake_lease_integration_test") { | |
| manifest = "meta/wake_lease_integration_test.cml" | |
| deps = [ ":wake_lease_integration_test_exe" ] | |
| } | |
| fuchsia_component_manifest("config_suspend_disabled") { | |
| component_name = "config_suspend_disabled" | |
| manifest = "meta/config_suspend_disabled.cml" | |
| } | |
| fuchsia_component("exception_broker_unittest") { | |
| testonly = true | |
| manifest = "meta/exception_broker_unittest.cml" | |
| deps = [ | |
| ":crasher", | |
| ":exception_broker_unittest_exe", | |
| # Stub exception handler sub-process that avoids making FIDL calls like the | |
| # real one. | |
| ":stub_exception_handler_exe", | |
| ] | |
| } | |
| fuchsia_component("process_launch_failure_unittest") { | |
| testonly = true | |
| manifest = "meta/process_launch_failure_unittest.cml" | |
| deps = [ | |
| ":crasher", | |
| ":process_launch_failure_unittest_exe", | |
| # Stub exception handler sub-process that avoids making FIDL calls like the | |
| # real one. | |
| ":stub_exception_handler_exe", | |
| ] | |
| } | |
| fuchsia_unittest_component("wake_lease_unittest") { | |
| deps = [ ":wake_lease_unittest_exe" ] | |
| } | |
| ############################################################################### | |
| # PACKAGES | |
| ############################################################################### | |
| fuchsia_test_package("exception-broker-tests") { | |
| test_components = [ | |
| ":exception_broker_config_test", | |
| ":exception_broker_unittest", | |
| ":process_launch_failure_unittest", | |
| ":wake_lease_unittest", | |
| ] | |
| test_specs = { | |
| log_settings = { | |
| max_severity = "FATAL" | |
| } | |
| } | |
| } | |
| # Separate package as the executable conflicts between exception_broker_unittest | |
| # and the injected exceptions component. | |
| fuchsia_test_package("exception-broker-integration-test") { | |
| test_components = [ ":exception_broker_integration_test" ] | |
| deps = [ | |
| # Other components that we are injecting in the integration tests. | |
| "//src/developer/forensics:exceptions", | |
| "//src/developer/forensics/public/fakes:fake_crash_reporter", | |
| "//src/developer/forensics/testing/fakes:fake_crash_introspect", | |
| ] | |
| } | |
| fuchsia_test_package("wake-lease-integration-test") { | |
| test_components = [ ":wake_lease_integration_test" ] | |
| deps = [ | |
| # Other components that we are injecting in the integration tests. | |
| "//src/power/broker:component", | |
| "//src/power/system-activity-governor:component", | |
| "//src/power/testing/fake-shutdown-shim", | |
| ] | |
| subpackages = [ "//src/power/system-activity-governor:config-no-suspender" ] | |
| } | |
| ############################################################################### | |
| # GROUPS | |
| ############################################################################### | |
| group("tests") { | |
| testonly = true | |
| public_deps = [ | |
| ":exception-broker-integration-test", | |
| ":exception-broker-tests", | |
| ":wake-lease-integration-test", | |
| ] | |
| visibility += [ "//src/developer/forensics:tests" ] | |
| } |