| # Copyright 2025 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/build_api_module.gni") |
| import("//build/python/python_host_test.gni") |
| import("//build/testing/host_test_data.gni") |
| |
| # This test ensures that rustdoc_link.py is callable from infra, which reads |
| # tool_paths.json. This test ensures that the path provided to rustdoc_link.py |
| # is correct. |
| |
| group("presence_in_tool_paths_json") { |
| testonly = true |
| deps = [ ":host_test($host_toolchain)" ] |
| } |
| |
| if (is_host) { |
| # test tool paths |
| _tool_paths = "$target_gen_dir/tool_paths.json" |
| generated_file("tool_paths") { |
| outputs = [ _tool_paths ] |
| testonly = true |
| output_conversion = "json" |
| data_keys = [ "tool_paths" ] |
| walk_keys = [ "tool_barrier" ] |
| deps = [ "//build/rust:tool_paths.rustdoc-link($host_toolchain)" ] |
| } |
| |
| _fake_build_dir = "${target_gen_dir}/fake/build/dir" |
| host_test_data("tool_paths_copy") { |
| testonly = true |
| deps = [ ":tool_paths($host_toolchain)" ] |
| outputs = [ "${_fake_build_dir}/tool_paths.json" ] |
| sources = [ _tool_paths ] |
| } |
| |
| host_test_data("copy_script") { |
| sources = [ |
| "//tools/devshell/contrib/lib/rust/rust.py", |
| "//tools/devshell/contrib/lib/rust/rustdoc-link.py", |
| "//tools/devshell/contrib/lib/rust/rustdoc_link_actions.py", |
| ] |
| outputs = [ "$_fake_build_dir/../../tools/devshell/contrib/lib/rust/{{source_file_part}}" ] |
| } |
| |
| python_host_test("host_test") { |
| main_source = "host_test.py" |
| deps = [ |
| ":copy_script($host_toolchain)", |
| ":tool_paths_copy($host_toolchain)", |
| ] |
| extra_args = [ rebase_path(_fake_build_dir, root_build_dir) ] |
| } |
| } |