blob: 6ce82f0328bdc3d1f198f1623b0e33ed4f976c73 [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 (shlib_prefix != "") {
_so_name = shlib_prefix + get_label_info(_linker_inputs_dep, "name")
_so_name = string_replace(_so_name,
"${shlib_prefix}${shlib_prefix}",
shlib_prefix)
}
_dir = get_label_info(_linker_inputs_dep, "root_out_dir")
if (is_android) {
_dir += "/lib.unstripped"
}
_linker_inputs_file = "$_dir/${_so_name}$shlib_extension"
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.allowed_violations)) {
foreach(_glob, invoker.allowed_violations) {
args += [
"--allow-violation",
_glob,
]
}
}
if (defined(invoker.expect_failure) && invoker.expect_failure) {
args += [ "--expect-failure" ]
}
}
}