Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79422c8e authored by yike's avatar yike
Browse files

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
parent 4c47a892
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -688,11 +688,16 @@ $(foreach suite,general-tests device-tests vts tvts art-host-tests host-unit-tes
          $(eval my_testcases := $(HOST_OUT_TESTCASES)),\
          $(eval my_testcases := $$(COMPATIBILITY_TESTCASES_OUT_$(suite))))\
        $(eval target := $(my_testcases)/$(lastword $(subst /, ,$(dir $(f))))/$(notdir $(f)))\
        $(eval link_target := ../../../$(lastword $(subst /, ,$(dir $(f))))/$(notdir $(f)))\
        $(eval symlink := $(my_testcases)/$(m)/shared_libs/$(lastword $(subst /, ,$(dir $(f))))/$(notdir $(f)))\
        $(eval COMPATIBILITY.$(suite).SYMLINKS := \
          $$(COMPATIBILITY.$(suite).SYMLINKS) $(f):$(link_target):$(symlink))\
        $(if $(strip $(ALL_TARGETS.$(target).META_LIC)),,$(call declare-copy-target-license-metadata,$(target),$(f)))\
        $(eval COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES := \
          $$(COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES) $(f):$(target))\
        $(eval COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES := \
          $(sort $(COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES)))))))
          $(sort $(COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES))))))\
  $(eval COMPATIBILITY.$(suite).SYMLINKS := $(sort $(COMPATIBILITY.$(suite).SYMLINKS))))
endef

$(call resolve-shared-libs-depes,TARGET_)
+14 −1
Original line number Diff line number Diff line
@@ -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 \