Link shared libs to per test module folder in host-unit-tests.zip

Downstream testing infra needs per test module folder to be
self-contained to prune dependencies and increase testing efficiency.

Bug: 351909435
Test: presubmit
Change-Id: Icda8982af8eb223ba4ae45be7975dc5aa42a183e
This commit is contained in:
yike
2024-07-10 17:07:47 +00:00
parent 4c47a8925e
commit 79422c8ed9
2 changed files with 20 additions and 2 deletions

View File

@@ -29,15 +29,28 @@ my_host_shared_lib_for_host_unit_tests := $(foreach f,$(COMPATIBILITY.host-unit-
$(eval _cmf_src := $(word 1,$(_cmf_tuple))) \
$(_cmf_src)))
my_symlinks_for_host_unit_tests := $(foreach f,$(COMPATIBILITY.host-unit-tests.SYMLINKS),\
$(strip $(eval _cmf_tuple := $(subst :, ,$(f))) \
$(eval _cmf_dep := $(word 1,$(_cmf_tuple))) \
$(eval _cmf_src := $(word 2,$(_cmf_tuple))) \
$(eval _cmf_dest := $(word 3,$(_cmf_tuple))) \
$(call symlink-file,$(_cmf_dep),$(_cmf_src),$(_cmf_dest)) \
$(_cmf_dest)))
$(host_unit_tests_zip) : PRIVATE_HOST_SHARED_LIBS := $(my_host_shared_lib_for_host_unit_tests)
$(host_unit_tests_zip) : $(COMPATIBILITY.host-unit-tests.FILES) $(my_host_shared_lib_for_host_unit_tests) $(SOONG_ZIP)
$(host_unit_tests_zip) : PRIVATE_SYMLINKS := $(my_symlinks_for_host_unit_tests)
$(host_unit_tests_zip) : $(COMPATIBILITY.host-unit-tests.FILES) $(my_host_shared_lib_for_host_unit_tests) $(my_symlinks_for_host_unit_tests) $(SOONG_ZIP)
echo $(sort $(COMPATIBILITY.host-unit-tests.FILES)) | tr " " "\n" > $@.list
grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true
echo "" >> $@-host-libs.list
$(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \
echo $$shared_lib >> $@-host-libs.list; \
done
$(hide) for symlink in $(PRIVATE_SYMLINKS); do \
echo $$symlink >> $@-host.list; \
done
grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
$(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list \
-P target -C $(PRODUCT_OUT) -l $@-target.list \