blob: df7df261ab47a213394a8f9c30152aa1052d27a2 [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
Alex Lightc07d66d2015-11-13 10:51:10 -080030# List of run-tests to skip running in any configuration. This needs to be the full name of the
31# run-test such as '457-regs'.
32ART_TEST_RUN_TEST_SKIP ?=
33
Andreas Gampe928f72b2014-09-09 19:53:48 -070034# Failing valgrind tests.
35# Note: *all* 64b tests involving the runtime do not work currently. b/15170219.
36
Nicolas Geoffrayf61b5372014-06-25 14:35:34 +010037# List of known failing tests that when executed won't cause test execution to not finish.
38# The test name must be the full rule name such as test-art-host-oat-optimizing-HelloWorld64.
39ART_TEST_KNOWN_FAILING :=
Ian Rogersafd9acc2014-06-17 08:21:54 -070040
41# Keep going after encountering a test failure?
Andreas Gampee7655c52014-07-24 21:41:06 -070042ART_TEST_KEEP_GOING ?= true
Ian Rogersafd9acc2014-06-17 08:21:54 -070043
Ian Rogers5242c0a2014-07-18 11:02:19 -070044# Do you want all tests, even those that are time consuming?
Ian Rogersf5c44b32014-08-19 16:52:36 -070045ART_TEST_FULL ?= false
46
Alex Light91de25f2015-10-28 17:00:06 -070047# Do you want run-test to be quieter? run-tests will only show output if they fail.
48ART_TEST_QUIET ?= true
49
Ian Rogersf5c44b32014-08-19 16:52:36 -070050# Do you want interpreter tests run?
51ART_TEST_INTERPRETER ?= $(ART_TEST_FULL)
Igor Murashkin7617abd2015-07-10 18:27:47 -070052ART_TEST_INTERPRETER_ACCESS_CHECKS ?= $(ART_TEST_FULL)
Ian Rogers5242c0a2014-07-18 11:02:19 -070053
Mathieu Chartier3fc1b122015-02-26 10:58:08 -080054# Do you want JIT tests run?
55ART_TEST_JIT ?= $(ART_TEST_FULL)
56
Ian Rogers5242c0a2014-07-18 11:02:19 -070057# Do you want optimizing compiler tests run?
Nicolas Geoffray7db00cd2016-03-22 10:43:01 +000058ART_TEST_OPTIMIZING ?= true
Ian Rogers5242c0a2014-07-18 11:02:19 -070059
Andreas Gampec23c9c92014-10-28 14:47:25 -070060# Do we want to test a PIC-compiled core image?
61ART_TEST_PIC_IMAGE ?= $(ART_TEST_FULL)
62
63# Do we want to test PIC-compiled tests ("apps")?
64ART_TEST_PIC_TEST ?= $(ART_TEST_FULL)
65
Ian Rogers5242c0a2014-07-18 11:02:19 -070066# Do you want tracing tests run?
67ART_TEST_TRACE ?= $(ART_TEST_FULL)
68
Andreas Gampe7526d782015-06-22 22:53:45 -070069# Do you want tracing tests (streaming mode) run?
70ART_TEST_TRACE_STREAM ?= $(ART_TEST_FULL)
71
Ian Rogers701aa642014-07-18 11:38:13 -070072# Do you want tests with GC verification enabled run?
73ART_TEST_GC_VERIFY ?= $(ART_TEST_FULL)
74
Ian Rogers8a14b752014-07-18 15:06:53 -070075# Do you want tests with the GC stress mode enabled run?
76ART_TEST_GC_STRESS ?= $(ART_TEST_FULL)
77
Ian Rogersf5c44b32014-08-19 16:52:36 -070078# Do you want tests with the JNI forcecopy mode enabled run?
79ART_TEST_JNI_FORCECOPY ?= $(ART_TEST_FULL)
Alex Lighta59dd802014-07-02 16:28:08 -070080
Ian Rogersf5c44b32014-08-19 16:52:36 -070081# Do you want run-tests with relocation disabled run?
Alex Lighta59dd802014-07-02 16:28:08 -070082ART_TEST_RUN_TEST_NO_RELOCATE ?= $(ART_TEST_FULL)
83
Nicolas Geoffray41bb3312014-10-24 13:49:08 +010084# Do you want run-tests with prebuilding?
85ART_TEST_RUN_TEST_PREBUILD ?= true
86
Ian Rogersf5c44b32014-08-19 16:52:36 -070087# Do you want run-tests with no prebuilding enabled run?
Alex Light9d722532014-07-22 18:07:12 -070088ART_TEST_RUN_TEST_NO_PREBUILD ?= $(ART_TEST_FULL)
Alex Lighta59dd802014-07-02 16:28:08 -070089
Alex Light03a112d2014-08-25 13:25:56 -070090# Do you want run-tests without a pregenerated core.art?
91ART_TEST_RUN_TEST_NO_IMAGE ?= $(ART_TEST_FULL)
92
93# Do you want run-tests with relocation enabled but patchoat failing?
94ART_TEST_RUN_TEST_RELOCATE_NO_PATCHOAT ?= $(ART_TEST_FULL)
95
96# Do you want run-tests without a dex2oat?
97ART_TEST_RUN_TEST_NO_DEX2OAT ?= $(ART_TEST_FULL)
98
Nicolas Geoffraybd2c63c2014-10-16 18:04:12 +010099# Do you want run-tests with libartd.so?
100ART_TEST_RUN_TEST_DEBUG ?= true
101
102# Do you want run-tests with libart.so?
103ART_TEST_RUN_TEST_NDEBUG ?= $(ART_TEST_FULL)
104
Nicolas Geoffray41bb3312014-10-24 13:49:08 +0100105# Do you want run-tests with the host/target's second arch?
106ART_TEST_RUN_TEST_2ND_ARCH ?= true
107
Alex Lightbfac14a2014-07-30 09:41:21 -0700108# Do you want failed tests to have their artifacts cleaned up?
109ART_TEST_RUN_TEST_ALWAYS_CLEAN ?= true
110
Nicolas Geoffray43c162f2015-03-09 12:21:26 +0000111# Do you want run-tests with the --debuggable flag
112ART_TEST_RUN_TEST_DEBUGGABLE ?= $(ART_TEST_FULL)
113
Jeff Haodcdc85b2015-12-04 14:06:18 -0800114# Do you want to test multi-part boot-image functionality?
115ART_TEST_RUN_TEST_MULTI_IMAGE ?= $(ART_TEST_FULL)
116
Ian Rogersafd9acc2014-06-17 08:21:54 -0700117# Define the command run on test failure. $(1) is the name of the test. Executed by the shell.
118define ART_TEST_FAILED
119 ( [ -f $(ART_HOST_TEST_DIR)/skipped/$(1) ] || \
120 (mkdir -p $(ART_HOST_TEST_DIR)/failed/ && touch $(ART_HOST_TEST_DIR)/failed/$(1) && \
121 echo $(ART_TEST_KNOWN_FAILING) | grep -q $(1) \
122 && (echo -e "$(1) \e[91mKNOWN FAILURE\e[0m") \
Ian Rogersd2c0b092014-07-22 14:22:22 -0700123 || (echo -e "$(1) \e[91mFAILED\e[0m" >&2 )))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700124endef
125
Alex Light91de25f2015-10-28 17:00:06 -0700126ifeq ($(ART_TEST_QUIET),true)
127 ART_TEST_ANNOUNCE_PASS := ( true )
128 ART_TEST_ANNOUNCE_RUN := ( true )
129 ART_TEST_ANNOUNCE_SKIP_FAILURE := ( true )
130 ART_TEST_ANNOUNCE_SKIP_BROKEN := ( true )
131else
132 # Note the use of '=' and not ':=' is intentional since these are actually functions.
133 ART_TEST_ANNOUNCE_PASS = ( echo -e "$(1) \e[92mPASSED\e[0m" )
134 ART_TEST_ANNOUNCE_RUN = ( echo -e "$(1) \e[95mRUNNING\e[0m")
135 ART_TEST_ANNOUNCE_SKIP_FAILURE = ( echo -e "$(1) \e[93mSKIPPING DUE TO EARLIER FAILURE\e[0m" )
136 ART_TEST_ANNOUNCE_SKIP_BROKEN = ( echo -e "$(1) \e[93mSKIPPING BROKEN TEST\e[0m" )
137endif
138
Ian Rogersafd9acc2014-06-17 08:21:54 -0700139# Define the command run on test success. $(1) is the name of the test. Executed by the shell.
140# The command checks prints "PASSED" then checks to see if this was a top-level make target (e.g.
141# "mm test-art-host-oat-HelloWorld32"), if it was then it does nothing, otherwise it creates a file
142# to be printed in the passing test summary.
143define ART_TEST_PASSED
Alex Light91de25f2015-10-28 17:00:06 -0700144 ( $(call ART_TEST_ANNOUNCE_PASS,$(1)) && \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700145 (echo $(MAKECMDGOALS) | grep -q $(1) || \
146 (mkdir -p $(ART_HOST_TEST_DIR)/passed/ && touch $(ART_HOST_TEST_DIR)/passed/$(1))))
147endef
148
149# Define the command run on test success of multiple prerequisites. $(1) is the name of the test.
150# When the test is a top-level make target then a summary of the ran tests is produced. Executed by
151# the shell.
152define ART_TEST_PREREQ_FINISHED
153 (echo -e "$(1) \e[32mCOMPLETE\e[0m" && \
154 (echo $(MAKECMDGOALS) | grep -q -v $(1) || \
155 (([ -d $(ART_HOST_TEST_DIR)/passed/ ] \
156 && (echo -e "\e[92mPASSING TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/passed/) \
157 || (echo -e "\e[91mNO TESTS PASSED\e[0m")) && \
158 ([ -d $(ART_HOST_TEST_DIR)/skipped/ ] \
159 && (echo -e "\e[93mSKIPPED TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/skipped/) \
160 || (echo -e "\e[92mNO TESTS SKIPPED\e[0m")) && \
161 ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \
Ian Rogers51829152014-07-21 20:28:31 -0700162 && (echo -e "\e[91mFAILING TESTS\e[0m" >&2 && ls -1 $(ART_HOST_TEST_DIR)/failed/ >&2) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700163 || (echo -e "\e[92mNO TESTS FAILED\e[0m")) \
164 && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] && rm -r $(ART_HOST_TEST_DIR) \
165 || (rm -r $(ART_HOST_TEST_DIR) && false)))))
166endef
167
168# Define the command executed by the shell ahead of running an art test. $(1) is the name of the
169# test.
170define ART_TEST_SKIP
171 ((echo $(ART_TEST_KNOWN_BROKEN) | grep -q -v $(1) \
172 && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] || [ $(ART_TEST_KEEP_GOING) = true ])\
Alex Light91de25f2015-10-28 17:00:06 -0700173 && $(call ART_TEST_ANNOUNCE_RUN,$(1)) ) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700174 || ((mkdir -p $(ART_HOST_TEST_DIR)/skipped/ && touch $(ART_HOST_TEST_DIR)/skipped/$(1) \
175 && ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \
Alex Light91de25f2015-10-28 17:00:06 -0700176 && $(call ART_TEST_ANNOUNCE_SKIP_FAILURE,$(1)) ) \
177 || $(call ART_TEST_ANNOUNCE_SKIP_BROKEN,$(1)) ) && false))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700178endef
179
180# Create a build rule to create the dex file for a test.
181# $(1): module prefix, e.g. art-test-dex
182# $(2): input test directory in art/test, e.g. HelloWorld
183# $(3): target output module path (default module path is used on host)
184# $(4): additional dependencies
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700185# $(5): a make variable used to collate target dependencies, e.g ART_TEST_TARGET_OAT_HelloWorld_DEX
186# $(6): a make variable used to collate host dependencies, e.g ART_TEST_HOST_OAT_HelloWorld_DEX
Richard Uhler66d874d2015-01-15 09:37:19 -0800187#
Richard Uhler4d57ecf2015-03-11 12:36:24 -0700188# If the input test directory contains a file called main.list and main.jpp,
189# then a multi-dex file is created passing main.list as the --main-dex-list
190# argument to dx and main.jpp for Jack.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700191define build-art-test-dex
192 ifeq ($(ART_BUILD_TARGET),true)
193 include $(CLEAR_VARS)
194 LOCAL_MODULE := $(1)-$(2)
195 LOCAL_SRC_FILES := $(call all-java-files-under, $(2))
196 LOCAL_NO_STANDARD_LIBRARIES := true
197 LOCAL_DEX_PREOPT := false
198 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4)
199 LOCAL_MODULE_TAGS := tests
200 LOCAL_JAVA_LIBRARIES := $(TARGET_CORE_JARS)
201 LOCAL_MODULE_PATH := $(3)
202 LOCAL_DEX_PREOPT_IMAGE_LOCATION := $(TARGET_CORE_IMG_OUT)
Richard Uhler66d874d2015-01-15 09:37:19 -0800203 ifneq ($(wildcard $(LOCAL_PATH)/$(2)/main.list),)
Delphine Martin6ad2d8b2016-02-22 15:16:25 +0000204 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 -0800205 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700206 include $(BUILD_JAVA_LIBRARY)
Brian Carlstrom532714a2014-06-25 02:15:31 -0700207 $(5) := $$(LOCAL_INSTALLED_MODULE)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700208 endif
209 ifeq ($(ART_BUILD_HOST),true)
210 include $(CLEAR_VARS)
211 LOCAL_MODULE := $(1)-$(2)
212 LOCAL_SRC_FILES := $(call all-java-files-under, $(2))
213 LOCAL_NO_STANDARD_LIBRARIES := true
214 LOCAL_DEX_PREOPT := false
215 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4)
216 LOCAL_JAVA_LIBRARIES := $(HOST_CORE_JARS)
217 LOCAL_DEX_PREOPT_IMAGE := $(HOST_CORE_IMG_LOCATION)
Richard Uhler66d874d2015-01-15 09:37:19 -0800218 ifneq ($(wildcard $(LOCAL_PATH)/$(2)/main.list),)
Delphine Martin6ad2d8b2016-02-22 15:16:25 +0000219 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 -0800220 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700221 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700222 $(6) := $$(LOCAL_INSTALLED_MODULE)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700223 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700224endef
225
Igor Murashkin37743352014-11-13 14:38:00 -0800226endif # ART_ANDROID_COMMON_TEST_MK