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

Commit 23d1c73f authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Rewrite test data logic to make it faster" am: 83e9cfe2 am:...

Merge "Rewrite test data logic to make it faster" am: 83e9cfe2 am: 84849aef am: b17e2f50 am: 7f82a0ca

Original change: https://android-review.googlesource.com/c/platform/build/+/1326014

Change-Id: I36f0a8b7f209aeac9dea469cb9589e286b5e92b1
parents 281a3ea4 7f82a0ca
Loading
Loading
Loading
Loading
+29 −11
Original line number Diff line number Diff line
@@ -562,17 +562,35 @@ ifneq ($(strip $(filter NATIVE_TESTS,$(LOCAL_MODULE_CLASS)) $(LOCAL_IS_FUZZ_TARG
ifneq ($(strip $(LOCAL_TEST_DATA)),)
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))

my_test_data_pairs := $(strip $(foreach td,$(LOCAL_TEST_DATA), \
    $(eval _file := $(call word-colon,2,$(td))) \
    $(if $(_file), \
      $(eval _src_base := $(call word-colon,1,$(td))), \
      $(eval _src_base := $(LOCAL_PATH)) \
        $(eval _file := $(call word-colon,1,$(td)))) \
    $(if $(call streq,$(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)),, \
      $(if $(findstring ..,$(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include '..': $(_file))) \
      $(if $(filter /%,$(_src_base) $(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include absolute paths: $(_src_base) $(_file)))) \
    $(eval my_test_data_file_pairs := $(my_test_data_file_pairs) $(call append-path,$(_src_base),$(_file)):$(_file)) \
    $(call append-path,$(_src_base),$(_file)):$(call append-path,$(my_module_path),$(_file))))
ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
  define copy_test_data_pairs
    _src_base := $$(call word-colon,1,$$(td))
    _file := $$(call word-colon,2,$$(td))
    my_test_data_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(call append-path,$$(my_module_path),$$(_file))
    my_test_data_file_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(_file)
  endef
else
  define copy_test_data_pairs
    _src_base := $$(call word-colon,1,$$(td))
    _file := $$(call word-colon,2,$$(td))
    ifndef _file
      _file := $$(_src_base)
      _src_base := $$(LOCAL_PATH)
    endif
    ifneq (,$$(findstring ..,$$(_file)))
      $$(call pretty-error,LOCAL_TEST_DATA may not include '..': $$(_file))
    endif
    ifneq (,$$(filter/%,$$(_src_base) $$(_file)))
      $$(call pretty-error,LOCAL_TEST_DATA may not include absolute paths: $$(_src_base) $$(_file))
    endif
    my_test_data_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(call append-path,$$(my_module_path),$$(_file))
    my_test_data_file_pairs += $$(call append-path,$$(_src_base),$$(_file)):$$(_file)
  endef
endif

$(foreach td,$(LOCAL_TEST_DATA),$(eval $(copy_test_data_pairs)))

copy_test_data_pairs :=

my_installed_test_data := $(call copy-many-files,$(my_test_data_pairs))
$(LOCAL_INSTALLED_MODULE): $(my_installed_test_data)