blob: c46e0e34327ae5e9d49b86e5473846925fe31c3f [file]
# 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.py",
]
library_deps = [ "//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" ]
}
}