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

Commit 160b670f authored by Ying Wang's avatar Ying Wang
Browse files

Add build goal "tests".

Bug: 5368571
The phony build goal "tests" will eventually replace the build variant
tests.

Change-Id: Ia656f2cf2260feeaa8fa32e9221b7f9ce0990262
parent bdbbd206
Loading
Loading
Loading
Loading
+30 −6
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@ else
  FILE_NAME_TAG := $(BUILD_NUMBER)
endif

is_tests_build := $(filter tests,$(MAKECMDGOALS))

# -----------------------------------------------------------------
# Define rules to copy PRODUCT_COPY_FILES defined by the product.
# PRODUCT_COPY_FILES contains words like <source file>:<dest file>.
@@ -746,6 +748,14 @@ INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
    $(ALL_GENERATED_SOURCES) \
    $(ALL_DEFAULT_INSTALLED_MODULES))

ifdef is_tests_build
# We don't want to install tests modules to the system partition
# when building "tests", because now "tests" may be built in a user, userdebug
# or eng build variant and we don't want to pollute the system partition.
# INTERNAL_SYSTEMIMAGE_FILES += $(filter $(TARGET_OUT)/%, \
#    $(tests_MODULES))
endif

FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
# -----------------------------------------------------------------
# installed file list
@@ -888,6 +898,12 @@ boottarball-nodeps btnod: $(FS_GET_STATS) \
INTERNAL_USERDATAIMAGE_FILES := \
    $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))

# If we build "tests" at the same time, make sure $(tests_MODULES) get covered.
ifdef is_tests_build
INTERNAL_USERDATAIMAGE_FILES += \
    $(filter $(TARGET_OUT_DATA)/%,$(tests_MODULES))
endif

userdataimage_intermediates := \
    $(call intermediates-dir-for,PACKAGING,userdata)
BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
@@ -1208,6 +1224,7 @@ endif # TARGET_PRODUCT != sdk
# This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
# only grab DATA, and it's called "*-tests-*.zip".
#
ifdef is_tests_build
name := $(TARGET_PRODUCT)
ifeq ($(TARGET_BUILD_TYPE),debug)
  name := $(name)_debug
@@ -1246,6 +1263,13 @@ ifneq (,$(filter $(MAKECMDGOALS),tests-build-target))
          $(BUILT_USERDATAIMAGE_TARGET))
endif

.PHONY: tests
tests: $(BUILT_TESTS_ZIP_PACKAGE)
ifneq (,$(filter tests, $(MAKECMDGOALS)))
$(call dist-for-goals, tests, $(BUILT_TESTS_ZIP_PACKAGE))
endif
endif  # is_tests_build

# -----------------------------------------------------------------
# A zip of the symbols directory.  Keep the full paths to make it
# more obvious where these files came from.
+2 −3
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ include $(BUILD_SYSTEM)/definitions.mk
# Bring in dex_preopt.mk
include $(BUILD_SYSTEM)/dex_preopt.mk

ifneq ($(filter eng user userdebug tests,$(MAKECMDGOALS)),)
ifneq ($(filter eng user userdebug,$(MAKECMDGOALS)),)
$(info ***************************************************************)
$(info ***************************************************************)
$(info Don't pass '$(filter eng user userdebug tests,$(MAKECMDGOALS))' on \
@@ -797,8 +797,7 @@ endif # TARGET_BUILD_APPS
endif # droid in $(MAKECMDGOALS)


.PHONY: droid tests
tests: droidcore
.PHONY: droid

# phony target that include any targets in $(ALL_MODULES)
.PHONY: all_modules