| # 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/json/validate_json.gni") |
| import("//build/python/python_host_test.gni") |
| |
| intermediate_metadata_path = "${target_gen_dir}/fhcp_intermediate_metadata.json" |
| fhcp_metadata_path = "${target_gen_dir}/fhcp_metadata.json" |
| appendix_path = "${target_gen_dir}/fhcp_appendix.json" |
| |
| generated_file("test-metadata-json") { |
| testonly = true |
| data_keys = [ |
| "fhcp", |
| "tests", |
| ] |
| output_conversion = "json" |
| outputs = [ intermediate_metadata_path ] |
| deps = [ ":device-tests" ] |
| } |
| |
| copy("json-appendix") { |
| sources = [ "//build/drivers/FHCP.json" ] |
| outputs = [ appendix_path ] |
| } |
| |
| action("fhcp-metadata-json") { |
| testonly = true |
| script = "//src/devices/tests/fhcp/src/generate_metadata_json.py" |
| deps = [ |
| ":json-appendix", |
| ":test-metadata-json", |
| ] |
| |
| inputs = [ |
| intermediate_metadata_path, |
| appendix_path, |
| ] |
| |
| outputs = [ fhcp_metadata_path ] |
| |
| args = [ |
| "--appendix_json", |
| rebase_path(appendix_path, root_build_dir), |
| "--intermediate_json", |
| rebase_path(intermediate_metadata_path, root_build_dir), |
| "--output_json", |
| rebase_path(fhcp_metadata_path, root_build_dir), |
| ] |
| } |
| |
| # Verify that the metadata complies with the specified schema. |
| validate_json("fhcp-test-json-validate") { |
| testonly = true |
| data = fhcp_metadata_path |
| schema = "//build/sdk/meta/fhcp_tests.json" |
| public_deps = [ ":fhcp-metadata-json" ] |
| } |
| |
| if (is_host) { |
| python_host_test("generate-metadata-test") { |
| enable_mypy = true |
| main_source = "//src/devices/tests/fhcp/src/generate_metadata_json_test.py" |
| sources = [ "//src/devices/tests/fhcp/src/generate_metadata_json.py" ] |
| } |
| } |
| |
| group("fhcp") { |
| testonly = true |
| deps = [ |
| ":fhcp-metadata-json", |
| ":fhcp-test-json-validate", |
| ] |
| } |
| |
| group("device-tests") { |
| testonly = true |
| deps = [ |
| "sample:tests", |
| "//src/ui/input/fhcp:touchpad-test-pkg", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":device-tests", |
| ":fhcp-test-json-validate", |
| ":generate-metadata-test($host_toolchain)", |
| ] |
| } |