Copy lsdump files from non-apex variant
This commit refines the logic to pick the lsdump files for reference ABI dumps. Before this commit, `findlsdump()` simply use `str_a in str_b` to check whether module variant name (e.g. `android_arm_armv7-a-neon_core_shared`) is in the path. However, this check also matches the variant for apex modules (e.g. `android_arm_armv7-a-neon_core_shared_apex.name`). This commit fixes the problem by splitting each path into path components and check whether a path component matches with the module variant name. Bug: 121986692 Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py Change-Id: I98f78f460ddeb076f4ca35b7a0d9dcac4a479ae8
This commit is contained in:
@@ -9,7 +9,8 @@ import time
|
|||||||
from utils import (
|
from utils import (
|
||||||
AOSP_DIR, COMPRESSED_SOURCE_ABI_DUMP_EXT, SOURCE_ABI_DUMP_EXT,
|
AOSP_DIR, COMPRESSED_SOURCE_ABI_DUMP_EXT, SOURCE_ABI_DUMP_EXT,
|
||||||
SOURCE_ABI_DUMP_EXT_END, SO_EXT, copy_reference_dumps, find_lib_lsdumps,
|
SOURCE_ABI_DUMP_EXT_END, SO_EXT, copy_reference_dumps, find_lib_lsdumps,
|
||||||
get_build_vars_for_product, make_libraries, make_tree)
|
get_build_vars_for_product, get_module_variant_dir_name, make_libraries,
|
||||||
|
make_tree)
|
||||||
|
|
||||||
|
|
||||||
PRODUCTS_DEFAULT = ['aosp_arm_ab', 'aosp_arm', 'aosp_arm64', 'aosp_x86_ab',
|
PRODUCTS_DEFAULT = ['aosp_arm_ab', 'aosp_arm', 'aosp_arm64', 'aosp_x86_ab',
|
||||||
@@ -67,10 +68,13 @@ def get_lib_arch_str(target):
|
|||||||
def find_and_copy_lib_lsdumps(target, ref_dump_dir_stem, ref_dump_dir_insertion,
|
def find_and_copy_lib_lsdumps(target, ref_dump_dir_stem, ref_dump_dir_insertion,
|
||||||
core_or_vendor_shared_str, libs, lsdump_paths,
|
core_or_vendor_shared_str, libs, lsdump_paths,
|
||||||
compress):
|
compress):
|
||||||
arch_lsdump_paths = find_lib_lsdumps(target.arch, target.arch_variant,
|
module_variant_dir_name = get_module_variant_dir_name(
|
||||||
target.cpu_variant, lsdump_paths,
|
target.arch, target.arch_variant, target.cpu_variant,
|
||||||
core_or_vendor_shared_str,
|
core_or_vendor_shared_str)
|
||||||
libs)
|
|
||||||
|
arch_lsdump_paths = find_lib_lsdumps(
|
||||||
|
module_variant_dir_name, lsdump_paths, libs)
|
||||||
|
|
||||||
# Copy the contents of the lsdump into their corresponding reference ABI
|
# Copy the contents of the lsdump into their corresponding reference ABI
|
||||||
# dumps directories.
|
# dumps directories.
|
||||||
return copy_reference_dumps(arch_lsdump_paths, ref_dump_dir_stem,
|
return copy_reference_dumps(arch_lsdump_paths, ref_dump_dir_stem,
|
||||||
|
|||||||
@@ -164,31 +164,36 @@ def make_libraries(libs, product, variant, llndk_mode):
|
|||||||
make_targets(lib_targets, product, variant)
|
make_targets(lib_targets, product, variant)
|
||||||
|
|
||||||
|
|
||||||
def find_lib_lsdumps(target_arch, target_arch_variant,
|
def get_module_variant_dir_name(arch, arch_variant, cpu_variant,
|
||||||
target_cpu_variant, lsdump_paths,
|
variant_suffix):
|
||||||
core_or_vendor_shared_str, libs):
|
"""Create module variant directory name from the target architecture, the
|
||||||
""" Find the lsdump corresponding to lib_name for the given arch parameters
|
target architecture variant, the target CPU variant, and a variant suffix
|
||||||
if it exists"""
|
(e.g. `_core_shared`, `_vendor_shared`, etc)."""
|
||||||
assert 'ANDROID_PRODUCT_OUT' in os.environ
|
|
||||||
cpu_variant = '_' + target_cpu_variant
|
|
||||||
arch_variant = '_' + target_arch_variant
|
|
||||||
arch_lsdump_paths = []
|
|
||||||
if (target_cpu_variant == 'generic' or target_cpu_variant is None or
|
|
||||||
target_cpu_variant == ''):
|
|
||||||
cpu_variant = ''
|
|
||||||
if (target_arch_variant == target_arch or target_arch_variant is None or
|
|
||||||
target_arch_variant == ''):
|
|
||||||
arch_variant = ''
|
|
||||||
|
|
||||||
target_dir = ('android_' + target_arch + arch_variant +
|
if not arch_variant or arch_variant == arch:
|
||||||
cpu_variant + core_or_vendor_shared_str)
|
arch_variant = ''
|
||||||
for key in lsdump_paths:
|
else:
|
||||||
if libs and key not in libs:
|
arch_variant = '_' + arch_variant
|
||||||
|
|
||||||
|
if not cpu_variant or cpu_variant == 'generic':
|
||||||
|
cpu_variant = ''
|
||||||
|
else:
|
||||||
|
cpu_variant = '_' + cpu_variant
|
||||||
|
|
||||||
|
return 'android_' + arch + arch_variant + cpu_variant + variant_suffix
|
||||||
|
|
||||||
|
|
||||||
|
def find_lib_lsdumps(module_variant_dir_name, lsdump_paths, libs):
|
||||||
|
"""Find the lsdump corresponding to lib_name for the given module variant
|
||||||
|
if it exists."""
|
||||||
|
result = []
|
||||||
|
for lib_name, paths in lsdump_paths.items():
|
||||||
|
if libs and lib_name not in libs:
|
||||||
continue
|
continue
|
||||||
for path in lsdump_paths[key]:
|
for path in paths:
|
||||||
if target_dir in path:
|
if module_variant_dir_name in path.split(os.path.sep):
|
||||||
arch_lsdump_paths.append(os.path.join(AOSP_DIR, path.strip()))
|
result.append(os.path.join(AOSP_DIR, path.strip()))
|
||||||
return arch_lsdump_paths
|
return result
|
||||||
|
|
||||||
|
|
||||||
def run_abi_diff(old_test_dump_path, new_test_dump_path, arch, lib_name,
|
def run_abi_diff(old_test_dump_path, new_test_dump_path, arch, lib_name,
|
||||||
|
|||||||
Reference in New Issue
Block a user