blob: 6f2694e1d4c8c6f87aa65c9c34fa54023b8f5294 [file] [log] [blame]
# Copyright 2023 The Chromium 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("//testing/test.gni")
template("private_code_test") {
isolated_script_test(target_name) {
forward_variables_from(invoker,
[
"data",
"data_deps",
])
script = "//build/private_code_test/private_code_test.py"
_linker_inputs_dep = invoker.linker_inputs_dep
if (is_android) {
_so_name = "lib" + get_label_info(_linker_inputs_dep, "name")
_so_name = string_replace(_so_name, "liblib", "lib")
_linker_inputs_file = get_label_info(_linker_inputs_dep, "root_out_dir") +
"/lib.unstripped/${_so_name}$shlib_extension"
} else {
assert(false, "TODO: Add non-android support")
}
if (defined(invoker.private_paths_dep)) {
_private_paths_dep = invoker.private_paths_dep
_private_paths_file = invoker.private_paths_file
} else {
_private_paths_dep =
"//build/private_code_test:private_paths($default_toolchain)"
_private_paths_file =
get_label_info(_private_paths_dep, "target_gen_dir") +
"/private_paths.txt"
}
data_deps = [
_linker_inputs_dep,
_private_paths_dep,
]
args = [
"--linker-inputs",
"@WrappedPath(" + rebase_path(_linker_inputs_file, root_build_dir) + ")",
"--private-paths-file",
"@WrappedPath(" + rebase_path(_private_paths_file, root_build_dir) + ")",
"--root-out-dir",
rebase_path(get_label_info(_linker_inputs_dep, "root_out_dir"),
root_build_dir),
]
if (defined(invoker.expect_failure) && invoker.expect_failure) {
args += [ "--expect-failure" ]
}
}
}