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

Commit be4ad83e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Atest: add LOCAL_TEST_CONFIG to module_info.json"

parents 8668e922 c9347b31
Loading
Loading
Loading
Loading
+43 −44
Original line number Diff line number Diff line
@@ -573,22 +573,7 @@ $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
  $(eval my_compat_dist_config_$(suite) := ))


# Make sure we only add the files once for multilib modules.
ifdef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
  # Sync the auto_test_config value for multilib modules.
  ifdef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_autogen
    ALL_MODULES.$(my_register_name).auto_test_config := true
  endif
else
  $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files := true
  # LOCAL_COMPATIBILITY_SUPPORT_FILES is a list of <src>[:<dest>].
  $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
    $(eval my_compat_dist_$(suite) += $(foreach f, $(LOCAL_COMPATIBILITY_SUPPORT_FILES), \
      $(eval p := $(subst :,$(space),$(f))) \
      $(eval s := $(word 1,$(p))) \
      $(eval n := $(or $(word 2,$(p)),$(notdir $(word 1, $(p))))) \
      $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
        $(s):$(dir)/$(n)))))
# Auto-generate build config.
ifneq (,$(LOCAL_FULL_TEST_CONFIG))
  test_config := $(LOCAL_FULL_TEST_CONFIG)
else ifneq (,$(LOCAL_TEST_CONFIG))
@@ -622,17 +607,31 @@ else
    endif
  endif
endif

is_instrumentation_test :=

# Make sure we only add the files once for multilib modules.
ifdef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
  # Sync the auto_test_config value for multilib modules.
  ifdef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_autogen
    ALL_MODULES.$(my_register_name).auto_test_config := true
  endif
else
  $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files := true
  # LOCAL_COMPATIBILITY_SUPPORT_FILES is a list of <src>[:<dest>].
  $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
    $(eval my_compat_dist_$(suite) += $(foreach f, $(LOCAL_COMPATIBILITY_SUPPORT_FILES), \
      $(eval p := $(subst :,$(space),$(f))) \
      $(eval s := $(word 1,$(p))) \
      $(eval n := $(or $(word 2,$(p)),$(notdir $(word 1, $(p))))) \
      $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
        $(s):$(dir)/$(n)))))

  ifneq (,$(test_config))
    $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
      $(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
        $(test_config):$(dir)/$(LOCAL_MODULE).config)))
  endif

  test_config :=

  ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
    $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
      $(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
@@ -647,19 +646,17 @@ else
  endif
endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files

# HACK: pretend a soong LOCAL_FULL_TEST_CONFIG is autogenerated by copying it to
# the location autogenerated test configs use and setting the flag in
# HACK: pretend a soong LOCAL_FULL_TEST_CONFIG is autogenerated by setting the flag in
# module-info.json
ifdef LOCAL_FULL_TEST_CONFIG
# TODO: (b/113029686) Add explicit flag from Soong to determine if a test was
# autogenerated.
ifneq (,$(filter $(SOONG_OUT_DIR)%,$(LOCAL_FULL_TEST_CONFIG)))
  ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
    my_test_config_file := $(dir $(LOCAL_BUILT_MODULE))$(LOCAL_MODULE).config
    $(eval $(call copy-one-file,$(LOCAL_FULL_TEST_CONFIG),$(my_test_config_file)))
    $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_test_config_file))
    ALL_MODULES.$(my_register_name).auto_test_config := true
    my_test_config_file :=
  endif
endif


ifneq ($(my_test_data_file_pairs),)
$(foreach pair, $(my_test_data_file_pairs), \
  $(eval parts := $(subst :,$(space),$(pair))) \
@@ -771,6 +768,8 @@ endif
ALL_MODULES.$(my_register_name).FOR_HOST_CROSS := $(my_host_cross)
ALL_MODULES.$(my_register_name).MODULE_NAME := $(LOCAL_MODULE)
ALL_MODULES.$(my_register_name).COMPATIBILITY_SUITES := $(LOCAL_COMPATIBILITY_SUITE)
ALL_MODULES.$(my_register_name).TEST_CONFIG := $(test_config)
test_config :=

INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)

+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ $(MODULE_INFO_JSON):
			'"compatibility_suites": [$(foreach w,$(sort $(ALL_MODULES.$(m).COMPATIBILITY_SUITES)),"$(w)", )], ' \
			'"auto_test_config": [$(ALL_MODULES.$(m).auto_test_config)], ' \
			'"module_name": ["$(ALL_MODULES.$(m).MODULE_NAME)"], ' \
			'"test_config": [$(if $(ALL_MODULES.$(m).TEST_CONFIG),"$(ALL_MODULES.$(m).TEST_CONFIG)")], ' \
			'},\n' \
	 ) | sed -e 's/, *\]/]/g' -e 's/, *\}/ }/g' -e '$$s/,$$//' >> $@
	$(hide) echo '}' >> $@