| # Copyright 2022 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/compiler.gni") |
| import("//build/host.gni") |
| import("//build/test.gni") |
| import("//build/testing/environments.gni") |
| import("//build/testing/host_test_data.gni") |
| import("//build/testing/symbols_dir_test_data.gni") |
| import("//src/developer/ffx/config.gni") |
| |
| if (is_host && has_board) { |
| # Directory to store debug symbols, which are required for the e2e test to run. |
| # The path is relative to the $root_out_dir, where zxdb_e2e_tests binary lives. |
| symbol_dir = "test_data/zxdb_e2e_tests/build-id" |
| |
| test("zxdb_e2e_tests") { |
| sources = [ |
| "e2e_test.cc", |
| "e2e_test.h", |
| "ffx_debug_agent_bridge.cc", |
| "ffx_debug_agent_bridge.h", |
| "fuzzy_matcher.cc", |
| "fuzzy_matcher.h", |
| "main.cc", |
| "script_test.cc", |
| "script_test.h", |
| ] |
| |
| package_deps = [ |
| "inferiors:zxdb_e2e_inferiors", |
| "//src/developer/debug/debug_agent", |
| "//src/developer/forensics/crasher", |
| "//src/developer/forensics/crasher:crasher_test", |
| ] |
| deps = [ |
| # In variant builds the variant version of the test executable will be run. However, the test |
| # will expect it can still run the host_x64 default variant of ffx, which is still built |
| # regardless of build variant. But a simple dependency here would try to build an ASAN variant |
| # of ffx, which creates a conflict because then there are two ffx binaries in the path of the |
| # existing tooling, which causes the infra builds (and local attempts to invoke ffx) to fail |
| # horribly. ${toolchain_variant.base} specifies specifically to depend on the normal |
| # non-variant version of ffx that's built all the time so we don't create a second copy, and |
| # can expect the path to be consistent and predictable. |
| ":zxdb_e2e_symbols(${toolchain_variant.base})", |
| ":zxdb_e2e_test_data(${toolchain_variant.base})", |
| "//src/developer/debug/shared", |
| "//src/developer/debug/zxdb/client", |
| "//src/developer/debug/zxdb/common:test_support", |
| "//src/developer/debug/zxdb/console:test_support", |
| "//src/developer/debug/zxdb/symbols:test_support", |
| "//src/developer/ffx:test_data", |
| "//src/developer/ffx/plugins/debug:ffx_debug_plugin_tool_test_data", |
| "//src/lib/fxl/test:test_settings", |
| "//third_party/googletest:gtest", |
| ] |
| |
| # The location of ffx binary and metadata (including ffx and the ffx-debug |
| # subtool) test data directory for the test to be able to find them. |
| _ffx_test_data_path = rebase_path(ffx_test_host_tools_out_dir, root_out_dir) |
| |
| _is_lto = select_variant + [ "lto" ] - [ "lto" ] != select_variant |
| _is_thinlto = |
| select_variant + [ "thinlto" ] - [ "thinlto" ] != select_variant |
| |
| build_type = |
| "optimize=$optimize:target_cpu=$target_cpu:is_lto=$_is_lto:" + |
| "is_thinlto=$_is_thinlto:is_asan=$is_asan:is_coverage=$is_coverage" |
| |
| defines = [ |
| "ZXDB_E2E_TESTS_BUILD_TYPE=\"" + build_type + "\"", |
| "ZXDB_E2E_TESTS_SYMBOL_DIR=\"" + symbol_dir + "\"", |
| "ZXDB_E2E_TESTS_SCRIPTS_DIR=\"" + rebase_path("scripts", root_out_dir) + |
| "\"", |
| "ZXDB_E2E_TESTS_FFX_TEST_DATA=\"" + _ffx_test_data_path + "\"", |
| ] |
| |
| environments = all_fuchsia_envs |
| |
| # TODO(https://fxbug.dev/42143551): The arm64 emulator is run from an arm64 host but we only |
| # support running tests on x64 hosts. |
| if (board_name == "arm64" || board_name == "qemu-arm64") { |
| environments -= [ emu_env ] |
| } |
| |
| # TODO(b/319276232): Reenable sherlock when the flake is fixed. |
| # |
| # Note that sherlock cannot run the Starnix tests, which happen to be the only e2e tests |
| # that currently run on these environments (see below). |
| environments -= [ sherlock_env ] |
| |
| # TODO(https://fxbug.dev/42109154): Re-enable astro/nelson when enabling non-Starnix |
| # breakpoint tests below. These environments cannot run the Starnix tests which are the |
| # only e2e tests that currently run on these environments. |
| environments -= [ |
| astro_env, |
| nelson_env, |
| ] |
| |
| # TODO(https://fxbug.dev/319163754): This test doesn't pass on GCE. |
| environments += [ gce_env ] |
| environments -= [ gce_env ] |
| } |
| |
| host_test_data("zxdb_e2e_test_data") { |
| sources = [] |
| |
| # TODO(https://fxbug.dev/42109154): Enable software breakpoint tests on ARM64 |
| # once they are stable. |
| if (target_cpu == "arm64") { |
| sources += [ |
| "scripts/starnix_proc_exception.script", |
| "scripts/starnix_proc_hardware_breakpoint.script", |
| ] |
| } else { |
| sources += [ |
| # TODO(jruthe): List test scripts invididually here once they are deflaked. |
| "scripts", |
| ] |
| } |
| } |
| |
| symbols_dir_test_data("zxdb_e2e_symbols") { |
| output_dir = "$root_out_dir/$symbol_dir" |
| deps = [ |
| "inferiors:zxdb_e2e_inferiors($target_toolchain)", |
| "//src/developer/forensics/crasher:crasher($target_toolchain)", |
| "//src/developer/forensics/crasher:crasher_test($target_toolchain)", |
| "//src/starnix/kernel:starnix_kernel_package($target_toolchain)", |
| ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| if (has_board) { |
| deps = [ ":zxdb_e2e_tests($host_toolchain)" ] |
| } |
| } |