ef59154d41
Other build rules create and use a test config file in the intermediate directory containing $(LOCAL_BUILT_MODULE). Currently, this makefile deletes $(dir $(LOCAL_BUILT_MODULE)) (aka $(dir $@)), so it can delete the config file after it's created and before it's used. Avoid this issue by using $(dir $@)/zipdir as the working directory for constructing a zip file. Bug: b/74524170 Test: mmma bionic Test: run Bionic unit tests Change-Id: Icee4d7bc72ba1c136385a0cb2c28491649598e7c
78 lines
4 KiB
Makefile
78 lines
4 KiB
Makefile
#
|
|
# Copyright (C) 2014 The Android Open Source Project
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Library used by dlext tests - zipped and aligned
|
|
# -----------------------------------------------------------------------------
|
|
|
|
BIONIC_TESTS_ZIPALIGN := $(HOST_OUT_EXECUTABLES)/bionic_tests_zipalign
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE_CLASS := NATIVE_TESTS
|
|
LOCAL_MODULE := libdlext_test_zip_zipaligned
|
|
LOCAL_MODULE_SUFFIX := .zip
|
|
LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_zip
|
|
LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix)
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
my_shared_libs := \
|
|
$(call intermediates-dir-for,SHARED_LIBRARIES,libdlext_test_zip,,,$(bionic_2nd_arch_prefix))/libdlext_test_zip.so \
|
|
$(call intermediates-dir-for,SHARED_LIBRARIES,libatest_simple_zip,,,$(bionic_2nd_arch_prefix))/libatest_simple_zip.so
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SHARED_LIBS := $(my_shared_libs)
|
|
$(LOCAL_BUILT_MODULE): $(my_shared_libs) $(BIONIC_TESTS_ZIPALIGN)
|
|
@echo "Aligning zip: $@"
|
|
$(hide) rm -rf $@.unaligned $@ $(dir $@)/zipdir && mkdir -p $(dir $@)/zipdir/libdir
|
|
$(hide) cp $(PRIVATE_SHARED_LIBS) $(dir $@)/zipdir/libdir
|
|
$(hide) touch $(dir $@)/zipdir/empty_file.txt
|
|
$(hide) (cd $(dir $@)/zipdir && zip -qrD0 ../$(notdir $@).unaligned .)
|
|
$(hide) $(BIONIC_TESTS_ZIPALIGN) 4096 $@.unaligned $@
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE_CLASS := NATIVE_TESTS
|
|
LOCAL_MODULE := libdlext_test_runpath_zip_zipaligned
|
|
LOCAL_MODULE_SUFFIX := .zip
|
|
LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_runpath_zip
|
|
LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix)
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
lib_d := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_d_zip,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_d_zip.so
|
|
lib_a := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_a,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_a.so
|
|
lib_b := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_b,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_b.so
|
|
lib_c := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_c,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_c.so
|
|
lib_x := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_x,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_x.so
|
|
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_D := $(lib_d)
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_A := $(lib_a)
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_B := $(lib_b)
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_C := $(lib_c)
|
|
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_X := $(lib_x)
|
|
$(LOCAL_BUILT_MODULE) : $(lib_d) $(lib_a) $(lib_b) $(lib_c) $(lib_x) $(BIONIC_TESTS_ZIPALIGN)
|
|
@echo "Aligning zip: $@"
|
|
$(hide) rm -rf $@.unaligned $@ $(dir $@)/zipdir && mkdir -p $(dir $@)/zipdir/libdir && \
|
|
mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_a && mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
|
|
$(hide) cp $(PRIVATE_LIB_D) $(dir $@)/zipdir/libdir
|
|
$(hide) cp $(PRIVATE_LIB_A) $(dir $@)/zipdir/libdir/dt_runpath_a
|
|
$(hide) cp $(PRIVATE_LIB_B) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
|
|
$(hide) cp $(PRIVATE_LIB_C) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
|
|
$(hide) cp $(PRIVATE_LIB_X) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
|
|
$(hide) touch $(dir $@)/zipdir/empty_file.txt
|
|
$(hide) (cd $(dir $@)/zipdir && zip -qrD0 ../$(notdir $@).unaligned .)
|
|
$(hide) $(BIONIC_TESTS_ZIPALIGN) 4096 $@.unaligned $@
|
|
|