blob: f3e1cc3272ce5294b10e847e521986d1addedd59 [file] [log] [blame]
Ian Rogersafd9acc2014-06-17 08:21:54 -07001#
2# Copyright (C) 2011 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
Igor Murashkin37743352014-11-13 14:38:00 -080017ifndef ART_ANDROID_COMMON_TEST_MK
18ART_ANDROID_COMMON_TEST_MK = true
Ian Rogersafd9acc2014-06-17 08:21:54 -070019
20include art/build/Android.common_path.mk
21
Andreas Gampe1fe5e5c2014-07-11 21:14:35 -070022# We need to set a define for the nativetest dir so that common_runtime_test will know the right
23# path. (The problem is being a 32b test on 64b device, which is still located in nativetest64).
24ART_TARGET_CFLAGS += -DART_TARGET_NATIVETEST_DIR=${ART_TARGET_NATIVETEST_DIR}
25
Ian Rogersafd9acc2014-06-17 08:21:54 -070026# List of known broken tests that we won't attempt to execute. The test name must be the full
27# rule name such as test-art-host-oat-optimizing-HelloWorld64.
Mathieu Chartierbdeb9b72015-01-07 17:42:07 -080028ART_TEST_KNOWN_BROKEN :=
Ian Rogersafd9acc2014-06-17 08:21:54 -070029
Andreas Gampe928f72b2014-09-09 19:53:48 -070030# Failing valgrind tests.
31# Note: *all* 64b tests involving the runtime do not work currently. b/15170219.
32
Nicolas Geoffrayf61b5372014-06-25 14:35:34 +010033# List of known failing tests that when executed won't cause test execution to not finish.
34# The test name must be the full rule name such as test-art-host-oat-optimizing-HelloWorld64.
35ART_TEST_KNOWN_FAILING :=
Ian Rogersafd9acc2014-06-17 08:21:54 -070036
37# Keep going after encountering a test failure?
Andreas Gampee7655c52014-07-24 21:41:06 -070038ART_TEST_KEEP_GOING ?= true
Ian Rogersafd9acc2014-06-17 08:21:54 -070039
Ian Rogers5242c0a2014-07-18 11:02:19 -070040# Do you want all tests, even those that are time consuming?
Ian Rogersf5c44b32014-08-19 16:52:36 -070041ART_TEST_FULL ?= false
42
43# Do you want default compiler tests run?
44ART_TEST_DEFAULT_COMPILER ?= true
45
46# Do you want interpreter tests run?
47ART_TEST_INTERPRETER ?= $(ART_TEST_FULL)
Ian Rogers5242c0a2014-07-18 11:02:19 -070048
Mathieu Chartier3fc1b122015-02-26 10:58:08 -080049# Do you want JIT tests run?
50ART_TEST_JIT ?= $(ART_TEST_FULL)
51
Ian Rogers5242c0a2014-07-18 11:02:19 -070052# Do you want optimizing compiler tests run?
53ART_TEST_OPTIMIZING ?= $(ART_TEST_FULL)
54
Andreas Gampec23c9c92014-10-28 14:47:25 -070055# Do we want to test a PIC-compiled core image?
56ART_TEST_PIC_IMAGE ?= $(ART_TEST_FULL)
57
58# Do we want to test PIC-compiled tests ("apps")?
59ART_TEST_PIC_TEST ?= $(ART_TEST_FULL)
60
Ian Rogers5242c0a2014-07-18 11:02:19 -070061# Do you want tracing tests run?
62ART_TEST_TRACE ?= $(ART_TEST_FULL)
63
Ian Rogers701aa642014-07-18 11:38:13 -070064# Do you want tests with GC verification enabled run?
65ART_TEST_GC_VERIFY ?= $(ART_TEST_FULL)
66
Ian Rogers8a14b752014-07-18 15:06:53 -070067# Do you want tests with the GC stress mode enabled run?
68ART_TEST_GC_STRESS ?= $(ART_TEST_FULL)
69
Ian Rogersf5c44b32014-08-19 16:52:36 -070070# Do you want tests with the JNI forcecopy mode enabled run?
71ART_TEST_JNI_FORCECOPY ?= $(ART_TEST_FULL)
Alex Lighta59dd802014-07-02 16:28:08 -070072
Ian Rogersf5c44b32014-08-19 16:52:36 -070073# Do you want run-tests with relocation disabled run?
Alex Lighta59dd802014-07-02 16:28:08 -070074ART_TEST_RUN_TEST_NO_RELOCATE ?= $(ART_TEST_FULL)
75
Nicolas Geoffray41bb3312014-10-24 13:49:08 +010076# Do you want run-tests with prebuilding?
77ART_TEST_RUN_TEST_PREBUILD ?= true
78
Ian Rogersf5c44b32014-08-19 16:52:36 -070079# Do you want run-tests with no prebuilding enabled run?
Alex Light9d722532014-07-22 18:07:12 -070080ART_TEST_RUN_TEST_NO_PREBUILD ?= $(ART_TEST_FULL)
Alex Lighta59dd802014-07-02 16:28:08 -070081
Alex Light03a112d2014-08-25 13:25:56 -070082# Do you want run-tests without a pregenerated core.art?
83ART_TEST_RUN_TEST_NO_IMAGE ?= $(ART_TEST_FULL)
84
85# Do you want run-tests with relocation enabled but patchoat failing?
86ART_TEST_RUN_TEST_RELOCATE_NO_PATCHOAT ?= $(ART_TEST_FULL)
87
88# Do you want run-tests without a dex2oat?
89ART_TEST_RUN_TEST_NO_DEX2OAT ?= $(ART_TEST_FULL)
90
Nicolas Geoffraybd2c63c2014-10-16 18:04:12 +010091# Do you want run-tests with libartd.so?
92ART_TEST_RUN_TEST_DEBUG ?= true
93
94# Do you want run-tests with libart.so?
95ART_TEST_RUN_TEST_NDEBUG ?= $(ART_TEST_FULL)
96
Nicolas Geoffray41bb3312014-10-24 13:49:08 +010097# Do you want run-tests with the host/target's second arch?
98ART_TEST_RUN_TEST_2ND_ARCH ?= true
99
Alex Lightbfac14a2014-07-30 09:41:21 -0700100# Do you want failed tests to have their artifacts cleaned up?
101ART_TEST_RUN_TEST_ALWAYS_CLEAN ?= true
102
Nicolas Geoffray43c162f2015-03-09 12:21:26 +0000103# Do you want run-tests with the --debuggable flag
104ART_TEST_RUN_TEST_DEBUGGABLE ?= $(ART_TEST_FULL)
105
Ian Rogersafd9acc2014-06-17 08:21:54 -0700106# Define the command run on test failure. $(1) is the name of the test. Executed by the shell.
107define ART_TEST_FAILED
108 ( [ -f $(ART_HOST_TEST_DIR)/skipped/$(1) ] || \
109 (mkdir -p $(ART_HOST_TEST_DIR)/failed/ && touch $(ART_HOST_TEST_DIR)/failed/$(1) && \
110 echo $(ART_TEST_KNOWN_FAILING) | grep -q $(1) \
111 && (echo -e "$(1) \e[91mKNOWN FAILURE\e[0m") \
Ian Rogersd2c0b092014-07-22 14:22:22 -0700112 || (echo -e "$(1) \e[91mFAILED\e[0m" >&2 )))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700113endef
114
115# Define the command run on test success. $(1) is the name of the test. Executed by the shell.
116# The command checks prints "PASSED" then checks to see if this was a top-level make target (e.g.
117# "mm test-art-host-oat-HelloWorld32"), if it was then it does nothing, otherwise it creates a file
118# to be printed in the passing test summary.
119define ART_TEST_PASSED
120 ( echo -e "$(1) \e[92mPASSED\e[0m" && \
121 (echo $(MAKECMDGOALS) | grep -q $(1) || \
122 (mkdir -p $(ART_HOST_TEST_DIR)/passed/ && touch $(ART_HOST_TEST_DIR)/passed/$(1))))
123endef
124
125# Define the command run on test success of multiple prerequisites. $(1) is the name of the test.
126# When the test is a top-level make target then a summary of the ran tests is produced. Executed by
127# the shell.
128define ART_TEST_PREREQ_FINISHED
129 (echo -e "$(1) \e[32mCOMPLETE\e[0m" && \
130 (echo $(MAKECMDGOALS) | grep -q -v $(1) || \
131 (([ -d $(ART_HOST_TEST_DIR)/passed/ ] \
132 && (echo -e "\e[92mPASSING TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/passed/) \
133 || (echo -e "\e[91mNO TESTS PASSED\e[0m")) && \
134 ([ -d $(ART_HOST_TEST_DIR)/skipped/ ] \
135 && (echo -e "\e[93mSKIPPED TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/skipped/) \
136 || (echo -e "\e[92mNO TESTS SKIPPED\e[0m")) && \
137 ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \
Ian Rogers51829152014-07-21 20:28:31 -0700138 && (echo -e "\e[91mFAILING TESTS\e[0m" >&2 && ls -1 $(ART_HOST_TEST_DIR)/failed/ >&2) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700139 || (echo -e "\e[92mNO TESTS FAILED\e[0m")) \
140 && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] && rm -r $(ART_HOST_TEST_DIR) \
141 || (rm -r $(ART_HOST_TEST_DIR) && false)))))
142endef
143
144# Define the command executed by the shell ahead of running an art test. $(1) is the name of the
145# test.
146define ART_TEST_SKIP
147 ((echo $(ART_TEST_KNOWN_BROKEN) | grep -q -v $(1) \
148 && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] || [ $(ART_TEST_KEEP_GOING) = true ])\
149 && echo -e "$(1) \e[95mRUNNING\e[0m") \
150 || ((mkdir -p $(ART_HOST_TEST_DIR)/skipped/ && touch $(ART_HOST_TEST_DIR)/skipped/$(1) \
151 && ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \
152 && echo -e "$(1) \e[93mSKIPPING DUE TO EARLIER FAILURE\e[0m") \
153 || echo -e "$(1) \e[93mSKIPPING BROKEN TEST\e[0m") && false))
154endef
155
156# Create a build rule to create the dex file for a test.
157# $(1): module prefix, e.g. art-test-dex
158# $(2): input test directory in art/test, e.g. HelloWorld
159# $(3): target output module path (default module path is used on host)
160# $(4): additional dependencies
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700161# $(5): a make variable used to collate target dependencies, e.g ART_TEST_TARGET_OAT_HelloWorld_DEX
162# $(6): a make variable used to collate host dependencies, e.g ART_TEST_HOST_OAT_HelloWorld_DEX
Richard Uhler66d874d2015-01-15 09:37:19 -0800163#
Richard Uhler4d57ecf2015-03-11 12:36:24 -0700164# If the input test directory contains a file called main.list and main.jpp,
165# then a multi-dex file is created passing main.list as the --main-dex-list
166# argument to dx and main.jpp for Jack.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700167define build-art-test-dex
168 ifeq ($(ART_BUILD_TARGET),true)
169 include $(CLEAR_VARS)
170 LOCAL_MODULE := $(1)-$(2)
171 LOCAL_SRC_FILES := $(call all-java-files-under, $(2))
172 LOCAL_NO_STANDARD_LIBRARIES := true
173 LOCAL_DEX_PREOPT := false
174 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4)
175 LOCAL_MODULE_TAGS := tests
176 LOCAL_JAVA_LIBRARIES := $(TARGET_CORE_JARS)
177 LOCAL_MODULE_PATH := $(3)
178 LOCAL_DEX_PREOPT_IMAGE_LOCATION := $(TARGET_CORE_IMG_OUT)
Richard Uhler66d874d2015-01-15 09:37:19 -0800179 ifneq ($(wildcard $(LOCAL_PATH)/$(2)/main.list),)
180 LOCAL_DX_FLAGS := --multi-dex --main-dex-list=$(LOCAL_PATH)/$(2)/main.list --minimal-main-dex
Richard Uhler4d57ecf2015-03-11 12:36:24 -0700181 LOCAL_JACK_FLAGS := -D jack.dex.output.policy=minimal-multidex -D jack.preprocessor=true -D jack.preprocessor.file=$(LOCAL_PATH)/$(2)/main.jpp
Richard Uhler66d874d2015-01-15 09:37:19 -0800182 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700183 include $(BUILD_JAVA_LIBRARY)
Brian Carlstrom532714a2014-06-25 02:15:31 -0700184 $(5) := $$(LOCAL_INSTALLED_MODULE)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700185 endif
186 ifeq ($(ART_BUILD_HOST),true)
187 include $(CLEAR_VARS)
188 LOCAL_MODULE := $(1)-$(2)
189 LOCAL_SRC_FILES := $(call all-java-files-under, $(2))
190 LOCAL_NO_STANDARD_LIBRARIES := true
191 LOCAL_DEX_PREOPT := false
192 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4)
193 LOCAL_JAVA_LIBRARIES := $(HOST_CORE_JARS)
194 LOCAL_DEX_PREOPT_IMAGE := $(HOST_CORE_IMG_LOCATION)
Richard Uhler66d874d2015-01-15 09:37:19 -0800195 ifneq ($(wildcard $(LOCAL_PATH)/$(2)/main.list),)
196 LOCAL_DX_FLAGS := --multi-dex --main-dex-list=$(LOCAL_PATH)/$(2)/main.list --minimal-main-dex
Richard Uhler4d57ecf2015-03-11 12:36:24 -0700197 LOCAL_JACK_FLAGS := -D jack.dex.output.policy=minimal-multidex -D jack.preprocessor=true -D jack.preprocessor.file=$(LOCAL_PATH)/$(2)/main.jpp
Richard Uhler66d874d2015-01-15 09:37:19 -0800198 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700199 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700200 $(6) := $$(LOCAL_INSTALLED_MODULE)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700201 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700202endef
203
Igor Murashkin37743352014-11-13 14:38:00 -0800204endif # ART_ANDROID_COMMON_TEST_MK