Use intermediates for sepolicy contexts tests
Using the installed locations for the sepolicy contexts tests causes checkbuilds to incorrectly install the files, and races with the packaging rules to cause them to be non-deterministically included in the final NOTICE files or images. Use the intermediates location instead. Fixes: 174692639 Test: mmma system/sepolicy Change-Id: Iea6869583b634f6018915934a1576fc283c106b2
This commit is contained in:
parent
ab5e7d3671
commit
b67df1f259
1 changed files with 30 additions and 39 deletions
|
@ -17,24 +17,20 @@ include $(CLEAR_VARS)
|
|||
# TODO: move tests into Soong after refactoring sepolicy module (b/130693869)
|
||||
|
||||
# Run host-side test with contexts files and the sepolicy file.
|
||||
# $(1): paths to contexts files
|
||||
# $(1): names of modules containing context files
|
||||
# $(2): path to the host tool
|
||||
# $(3): additional argument to be passed to the tool
|
||||
define run_contexts_test
|
||||
$$(LOCAL_BUILT_MODULE): PRIVATE_CONTEXTS := $(1)
|
||||
my_contexts := $(foreach m,$(1),$$(call intermediates-dir-for,ETC,$(m))/$(m))
|
||||
$$(LOCAL_BUILT_MODULE): PRIVATE_CONTEXTS := $$(my_contexts)
|
||||
$$(LOCAL_BUILT_MODULE): PRIVATE_SEPOLICY := $$(built_sepolicy)
|
||||
$$(LOCAL_BUILT_MODULE): $(2) $(1) $$(built_sepolicy)
|
||||
$$(LOCAL_BUILT_MODULE): $(2) $$(my_contexts) $$(built_sepolicy)
|
||||
$$(hide) $$< $(3) $$(PRIVATE_SEPOLICY) $$(PRIVATE_CONTEXTS)
|
||||
$$(hide) mkdir -p $$(dir $$@)
|
||||
$$(hide) touch $$@
|
||||
my_contexts :=
|
||||
endef
|
||||
|
||||
system_out := $(TARGET_OUT)/etc/selinux
|
||||
system_ext_out := $(TARGET_OUT_SYSTEM_EXT)/etc/selinux
|
||||
product_out := $(TARGET_OUT_PRODUCT)/etc/selinux
|
||||
vendor_out := $(TARGET_OUT_VENDOR)/etc/selinux
|
||||
odm_out := $(TARGET_OUT_ODM)/etc/selinux
|
||||
|
||||
checkfc := $(HOST_OUT_EXECUTABLES)/checkfc
|
||||
property_info_checker := $(HOST_OUT_EXECUTABLES)/property_info_checker
|
||||
|
||||
|
@ -44,8 +40,7 @@ LOCAL_MODULE_CLASS := FAKE
|
|||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(system_out)/plat_file_contexts, $(checkfc),))
|
||||
$(eval $(call run_contexts_test, plat_file_contexts, $(checkfc),))
|
||||
|
||||
##################################
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -56,7 +51,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(system_ext_out)/system_ext_file_contexts, $(checkfc),))
|
||||
$(eval $(call run_contexts_test, system_ext_file_contexts, $(checkfc),))
|
||||
|
||||
##################################
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -67,7 +62,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(product_out)/product_file_contexts, $(checkfc),))
|
||||
$(eval $(call run_contexts_test, product_file_contexts, $(checkfc),))
|
||||
|
||||
##################################
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -78,7 +73,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(vendor_out)/vendor_file_contexts, $(checkfc),))
|
||||
$(eval $(call run_contexts_test, vendor_file_contexts, $(checkfc),))
|
||||
|
||||
##################################
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -89,7 +84,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(odm_out)/odm_file_contexts, $(checkfc),))
|
||||
$(eval $(call run_contexts_test, odm_file_contexts, $(checkfc),))
|
||||
|
||||
##################################
|
||||
|
||||
|
@ -101,7 +96,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(system_out)/plat_hwservice_contexts, $(checkfc), -e -l))
|
||||
$(eval $(call run_contexts_test, plat_hwservice_contexts, $(checkfc), -e -l))
|
||||
|
||||
##################################
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -112,7 +107,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(system_ext_out)/system_ext_hwservice_contexts, $(checkfc), -e -l))
|
||||
$(eval $(call run_contexts_test, system_ext_hwservice_contexts, $(checkfc), -e -l))
|
||||
|
||||
##################################
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -123,7 +118,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(product_out)/product_hwservice_contexts, $(checkfc), -e -l))
|
||||
$(eval $(call run_contexts_test, product_hwservice_contexts, $(checkfc), -e -l))
|
||||
|
||||
##################################
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -134,7 +129,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(vendor_out)/vendor_hwservice_contexts, $(checkfc), -e -l))
|
||||
$(eval $(call run_contexts_test, vendor_hwservice_contexts, $(checkfc), -e -l))
|
||||
|
||||
##################################
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -145,11 +140,11 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(odm_out)/odm_hwservice_contexts, $(checkfc), -e -l))
|
||||
$(eval $(call run_contexts_test, odm_hwservice_contexts, $(checkfc), -e -l))
|
||||
|
||||
##################################
|
||||
|
||||
pc_files := $(system_out)/plat_property_contexts
|
||||
pc_modules := plat_property_contexts
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
@ -159,13 +154,13 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(pc_files), $(property_info_checker),))
|
||||
$(eval $(call run_contexts_test, $(pc_modules), $(property_info_checker),))
|
||||
|
||||
##################################
|
||||
|
||||
ifdef HAS_SYSTEM_EXT_SEPOLICY_DIR
|
||||
|
||||
pc_files += $(system_ext_out)/system_ext_property_contexts
|
||||
pc_modules += system_ext_property_contexts
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
@ -175,13 +170,13 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(pc_files), $(property_info_checker),))
|
||||
$(eval $(call run_contexts_test, $(pc_modules), $(property_info_checker),))
|
||||
|
||||
endif
|
||||
|
||||
##################################
|
||||
|
||||
pc_files += $(vendor_out)/vendor_property_contexts
|
||||
pc_modules += vendor_property_contexts
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
@ -191,13 +186,13 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(pc_files), $(property_info_checker),))
|
||||
$(eval $(call run_contexts_test, $(pc_modules), $(property_info_checker),))
|
||||
|
||||
##################################
|
||||
|
||||
ifdef BOARD_ODM_SEPOLICY_DIRS
|
||||
|
||||
pc_files += $(odm_out)/odm_property_contexts
|
||||
pc_modules += odm_property_contexts
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
@ -207,7 +202,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(pc_files), $(property_info_checker),))
|
||||
$(eval $(call run_contexts_test, $(pc_modules), $(property_info_checker),))
|
||||
|
||||
endif
|
||||
|
||||
|
@ -215,7 +210,7 @@ endif
|
|||
|
||||
ifdef HAS_PRODUCT_SEPOLICY_DIR
|
||||
|
||||
pc_files += $(product_out)/product_property_contexts
|
||||
pc_modules += product_property_contexts
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
@ -225,11 +220,11 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(pc_files), $(property_info_checker),))
|
||||
$(eval $(call run_contexts_test, $(pc_modules), $(property_info_checker),))
|
||||
|
||||
endif
|
||||
|
||||
pc_files :=
|
||||
pc_modules :=
|
||||
|
||||
##################################
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -240,7 +235,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(system_out)/plat_service_contexts, $(checkfc), -s))
|
||||
$(eval $(call run_contexts_test, plat_service_contexts, $(checkfc), -s))
|
||||
|
||||
##################################
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -251,7 +246,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(system_ext_out)/system_ext_service_contexts, $(checkfc), -s))
|
||||
$(eval $(call run_contexts_test, system_ext_service_contexts, $(checkfc), -s))
|
||||
|
||||
##################################
|
||||
include $(CLEAR_VARS)
|
||||
|
@ -262,7 +257,7 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(product_out)/product_service_contexts, $(checkfc), -s))
|
||||
$(eval $(call run_contexts_test, product_service_contexts, $(checkfc), -s))
|
||||
|
||||
##################################
|
||||
# nonplat_service_contexts is only allowed on non-full-treble devices
|
||||
|
@ -276,14 +271,10 @@ LOCAL_MODULE_TAGS := optional
|
|||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(eval $(call run_contexts_test, $(vendor_out)/vendor_service_contexts, $(checkfc), -s))
|
||||
$(eval $(call run_contexts_test, vendor_service_contexts, $(checkfc), -s))
|
||||
|
||||
endif
|
||||
|
||||
system_out :=
|
||||
product_out :=
|
||||
vendor_out :=
|
||||
odm_out :=
|
||||
checkfc :=
|
||||
property_info_checker :=
|
||||
run_contexts_test :=
|
||||
|
|
Loading…
Reference in a new issue