Test dcla libs for b build.
Bug: 273862399 Test: local Change-Id: Ic72239779d63d64b68a902de6f5b3c6567385878
This commit is contained in:
@@ -45,6 +45,11 @@ MODULES=(
|
||||
com.android.tethering
|
||||
)
|
||||
|
||||
BAZEL_TARGETS=(
|
||||
//packages/modules/adb/apex:com.android.adbd
|
||||
//frameworks/av/apex:com.android.media.swcodec
|
||||
)
|
||||
|
||||
DCLA_LIBS=(
|
||||
libbase.so
|
||||
libc++.so
|
||||
@@ -76,6 +81,10 @@ DEAPEXER="${DEAPEXER} --debugfs_path=${DEBUGFS}"
|
||||
############
|
||||
OUTPUT_DIR="$(mktemp -d tmp.XXXXXX)"
|
||||
|
||||
function call_bazel() {
|
||||
build/bazel/bin/bazel $@
|
||||
}
|
||||
|
||||
function cleanup {
|
||||
rm -rf "${OUTPUT_DIR}"
|
||||
}
|
||||
@@ -87,7 +96,9 @@ trap cleanup EXIT
|
||||
|
||||
function extract_dcla_libs() {
|
||||
local product=$1; shift
|
||||
for module in "${MODULES[@]}"; do
|
||||
local modules=("$@"); shift
|
||||
|
||||
for module in "${modules[@]}"; do
|
||||
local apex="${OUTPUT_DIR}/${product}/${module}.apex"
|
||||
local extract_dir="${OUTPUT_DIR}/${product}/${module}/extract"
|
||||
|
||||
@@ -97,11 +108,12 @@ function extract_dcla_libs() {
|
||||
|
||||
function compare_dcla_libs() {
|
||||
local product=$1; shift
|
||||
local modules=("$@"); shift
|
||||
|
||||
for lib in "${DCLA_LIBS[@]}"; do
|
||||
for arch in lib lib64; do
|
||||
local prev_sha=""
|
||||
for module in "${MODULES[@]}"; do
|
||||
for module in "${modules[@]}"; do
|
||||
local file="${OUTPUT_DIR}/${product}/${module}/extract/${arch}/${lib}"
|
||||
if [[ ! -f "${file}" ]]; then
|
||||
# not all libs are present in a module
|
||||
@@ -112,7 +124,7 @@ function compare_dcla_libs() {
|
||||
sha="${sha% *}"
|
||||
if [ "${prev_sha}" == "" ]; then
|
||||
prev_sha="${sha}"
|
||||
elif [ "${sha}" != "${prev_sha}" ] && { [ "${lib}" != "libcrypto.so" ] || [ "${module}" != "com.android.tethering" ]; }; then
|
||||
elif [ "${sha}" != "${prev_sha}" ] && { [ "${lib}" != "libcrypto.so" ] || [[ "${module}" != *"com.android.tethering" ]]; }; then
|
||||
echo "Test failed, ${lib} has different hash value"
|
||||
exit 1
|
||||
fi
|
||||
@@ -131,8 +143,22 @@ for product in "${TARGET_PRODUCTS[@]}"; do
|
||||
--product "${product}" \
|
||||
--dist_dir "${OUTPUT_DIR}/${product}"
|
||||
|
||||
extract_dcla_libs "${product}"
|
||||
compare_dcla_libs "${product}"
|
||||
bazel_apexes=()
|
||||
if [[ -n ${TEST_BAZEL+x} ]] && [ "${TEST_BAZEL}" = true ]; then
|
||||
export TARGET_PRODUCT="${product/module/aosp}"
|
||||
call_bazel build --config=bp2build --config=ci --config=android "${BAZEL_TARGETS[@]}"
|
||||
for target in "${BAZEL_TARGETS[@]}"; do
|
||||
apex_path="$(realpath $(call_bazel cquery --config=bp2build --config=android --config=ci --output=files $target))"
|
||||
mkdir -p ${OUTPUT_DIR}/${product}
|
||||
bazel_apex="bazel_$(basename $apex_path)"
|
||||
mv $apex_path ${OUTPUT_DIR}/${product}/${bazel_apex}
|
||||
bazel_apexes+=(${bazel_apex%".apex"})
|
||||
done
|
||||
fi
|
||||
|
||||
all_modeuls=(${MODULES[@]} ${bazel_apexes[@]})
|
||||
extract_dcla_libs "${product}" "${all_modeuls[@]}"
|
||||
compare_dcla_libs "${product}" "${all_modeuls[@]}"
|
||||
done
|
||||
|
||||
echo "Test passed"
|
||||
|
@@ -15,8 +15,8 @@ TOP="$(readlink -f "$(dirname "$0")"/../../..)"
|
||||
# mock client.
|
||||
"$TOP/build/soong/tests/apex_comparison_tests.sh"
|
||||
"$TOP/build/soong/tests/apex_comparison_tests.sh" "module_arm64only"
|
||||
extra_build_params=--bazel-mode-staging "$TOP/build/soong/tests/dcla_apex_comparison_test.sh"
|
||||
BUILD_BROKEN_DISABLE_BAZEL=true "$TOP/build/soong/tests/dcla_apex_comparison_test.sh"
|
||||
TEST_BAZEL=true extra_build_params=--bazel-mode-staging "$TOP/build/soong/tests/dcla_apex_comparison_test.sh"
|
||||
#BUILD_BROKEN_DISABLE_BAZEL=true "$TOP/build/soong/tests/dcla_apex_comparison_test.sh"
|
||||
"$TOP/build/soong/tests/apex_cc_module_arch_variant_tests.sh"
|
||||
"$TOP/build/soong/tests/apex_cc_module_arch_variant_tests.sh" "aosp_arm" "armv7-a"
|
||||
"$TOP/build/soong/tests/apex_cc_module_arch_variant_tests.sh" "aosp_cf_arm64_phone" "armv8-a" "cortex-a53"
|
||||
|
Reference in New Issue
Block a user