| # Copyright 2026 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/python_action.gni") | |
| import("//build/python/python_binary.gni") | |
| import("//build/python/python_host_test.gni") | |
| import("//build/python/python_library.gni") | |
| import("//build/testing/golden_files.gni") | |
| group("tests") { | |
| testonly = true | |
| deps = [ | |
| ":protocol_test($host_toolchain)", | |
| ":schema_golden_check($host_toolchain)", | |
| ] | |
| } | |
| if (is_host) { | |
| python_library("protocol_lib") { | |
| library_name = "shared" | |
| sources = [ | |
| "__init__.py", | |
| "protocol/__init__.py", | |
| "protocol/async_backtrace.py", | |
| "protocol/attach.py", | |
| "protocol/base.py", | |
| "protocol/break_request.py", | |
| "protocol/continue_request.py", | |
| "protocol/detach.py", | |
| "protocol/evaluate.py", | |
| "protocol/finish.py", | |
| "protocol/get_state.py", | |
| "protocol/hello.py", | |
| "protocol/next_request.py", | |
| "protocol/pause.py", | |
| "protocol/stack_trace.py", | |
| "protocol/start.py", | |
| "protocol/step_in.py", | |
| "protocol/stop.py", | |
| "protocol/threads.py", | |
| "protocol/variables.py", | |
| "protocol/wait_for_event.py", | |
| "protocol/watch_request.py", | |
| ] | |
| library_deps = [ | |
| "//src/lib/debug/dap/python:lib", | |
| "//src/lib/debug/dap/python/zxdb:zxdb_dap", | |
| "//third_party/pylibs/pydantic", | |
| ] | |
| } | |
| python_host_test("protocol_test") { | |
| main_source = "tests/test_protocol.py" | |
| libraries = [ ":protocol_lib" ] | |
| # Explicitly depend on pydantic-core's test_data. This is to ensure that the | |
| # module's DSO is bundled together with our test so the top-level pydantic | |
| # module loads correctly. | |
| test_data_deps = [ "//prebuilt/third_party/pydantic-core:test_data" ] | |
| } | |
| python_binary("generate_schema_bin") { | |
| main_source = "generate_schema.py" | |
| main_callable = "main" | |
| deps = [ ":protocol_lib" ] | |
| } | |
| python_action("generate_schema") { | |
| binary_label = ":generate_schema_bin" | |
| outputs = [ "$target_gen_dir/schema.json" ] | |
| args = [ | |
| "--output", | |
| rebase_path("$target_gen_dir/schema.json", root_build_dir), | |
| ] | |
| } | |
| golden_files("schema_golden_check") { | |
| comparisons = [ | |
| { | |
| golden = "//scripts/debug/zxdb_cli/schema.json" | |
| candidate = "$target_gen_dir/schema.json" | |
| }, | |
| ] | |
| deps = [ ":generate_schema" ] | |
| } | |
| } |