| # Copyright 2023 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/python/host.gni") | |
| import("//build/python/python_binary.gni") | |
| import("//build/python/python_host_test.gni") | |
| import("//build/testing/host_test_data.gni") | |
| group("tests") { | |
| testonly = true | |
| deps = [ | |
| ":args_test($host_toolchain)", | |
| ":config_test($host_toolchain)", | |
| ":console_test($host_toolchain)", | |
| ":debugger_test($host_toolchain)", | |
| ":environment_test($host_toolchain)", | |
| ":event_test($host_toolchain)", | |
| ":execution_test($host_toolchain)", | |
| ":find_affected_test($host_toolchain)", | |
| ":log_test($host_toolchain)", | |
| ":main_test($host_toolchain)", | |
| ":package_repository_test($host_toolchain)", | |
| ":selection_action_test($host_toolchain)", | |
| ":selection_test($host_toolchain)", | |
| ":summary_test($host_toolchain)", | |
| ":test_list_file_test($host_toolchain)", | |
| ":tests_json_file_test($host_toolchain)", | |
| "dataparse:tests", | |
| ] | |
| } | |
| if (is_host) { | |
| binary_sources = [ | |
| "args.py", | |
| "config.py", | |
| "console.py", | |
| "debugger.py", | |
| "environment.py", | |
| "event.py", | |
| "execution.py", | |
| "find_affected.py", | |
| "log.py", | |
| "package_repository.py", | |
| "selection.py", | |
| "selection_action.py", | |
| "selection_types.py", | |
| "summary.py", | |
| "test_list_file.py", | |
| "tests_json_file.py", | |
| ] | |
| binary_deps = [ | |
| "dataparse", | |
| "//scripts/debug/zxdb_cli/daemon:install", | |
| "//scripts/debug/zxdb_cli/daemon_manager", | |
| "//scripts/fxtest/scripts:install", | |
| "//scripts/lib/agents", | |
| "//scripts/lib/async_utils", | |
| "//scripts/lib/fx_cmd", | |
| "//scripts/lib/package_server", | |
| "//scripts/lib/statusinfo", | |
| "//scripts/lib/termout", | |
| "//third_party/colorama", | |
| "//third_party/jellyfish", | |
| "//third_party/python_portpicker:portpicker", | |
| "//tools/test_list_tool:install", | |
| ] | |
| # Main executable target. | |
| python_binary("fxtest-rewrite") { | |
| # Unbuffer so output can be piped to other programs nicely. | |
| unbuffered_output = true | |
| main_source = "main.py" | |
| output_name = "fxtest_rewrite.pyz" | |
| sources = binary_sources | |
| deps = binary_deps | |
| } | |
| main_module_tests = [ | |
| "args", | |
| "config", | |
| "console", | |
| "debugger", | |
| "environment", | |
| "event", | |
| "execution", | |
| "find_affected", | |
| "log", | |
| "main", | |
| "package_repository", | |
| "selection", | |
| "selection_action", | |
| "summary", | |
| "test_list_file", | |
| "tests_json_file", | |
| ] | |
| foreach(test_name, main_module_tests) { | |
| target = "${test_name}_test" | |
| main_source = "tests/${test_name}_test.py" | |
| python_host_test(target) { | |
| # TODO(https://fxbug.dev/329239255): Re-enable when flake is addressed | |
| if (test_name != "main") { | |
| } else { | |
| enable_mypy = false | |
| } | |
| main_source = main_source | |
| main_callable = "unittest.main" | |
| extra_args = [ "-v" ] | |
| test_dir = "$root_out_dir/test_data/fxtest-rewrite-tests" | |
| sources = binary_sources + [ "main.py" ] | |
| libraries = binary_deps + [ "//third_party/parameterized" ] | |
| # TODO(https://fxbug.dev/521328891): The debugger module needs pydantic to resolve, even if it | |
| # isn't used. | |
| test_data_deps = [ "//prebuilt/third_party/pydantic-core:test_data" ] | |
| deps = [ | |
| ":test_data", | |
| ":test_deps", | |
| ] | |
| } | |
| } | |
| host_test_data("test_data") { | |
| sources = [ | |
| "tests/test_data/build_output/all_package_manifests.list", | |
| "tests/test_data/build_output/bazel_test_packages.list", | |
| "tests/test_data/build_output/disabled_tests.json", | |
| "tests/test_data/build_output/package-repositories.json", | |
| "tests/test_data/build_output/package-targets.json", | |
| "tests/test_data/build_output/test-list.json", | |
| "tests/test_data/build_output/tests.json", | |
| ] | |
| outputs = [ "$root_out_dir/test_data/fxtest-rewrite-tests/test_data/build_output/{{source_file_part}}" ] | |
| } | |
| host_test_data("test_deps") { | |
| sources = [ "$root_build_dir/host-tools/dldist" ] | |
| outputs = [ | |
| "$root_out_dir/test_data/fxtest-rewrite-tests/bin/{{source_file_part}}", | |
| ] | |
| deps = [ "//scripts/fxtest/scripts:install" ] | |
| } | |
| install_python_tool("install") { | |
| name = "test" | |
| binary = ":fxtest-rewrite" | |
| } | |
| } |