blob: 389740103ace70f7d4c5806d6c1b4449c3e6fbc7 [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
17ifndef ANDROID_COMMON_TEST_MK
18ANDROID_COMMON_TEST_MK = true
19
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.
Andreas Gampe1c83cbc2014-07-22 18:52:29 -070028ART_TEST_KNOWN_BROKEN := \
Andreas Gampe1c83cbc2014-07-22 18:52:29 -070029 test-art-target-run-test-gcstress-optimizing-prebuild-004-SignalTest32 \
30 test-art-target-run-test-gcstress-optimizing-norelocate-004-SignalTest32 \
31 test-art-target-run-test-gcstress-default-prebuild-004-SignalTest32 \
32 test-art-target-run-test-gcstress-default-norelocate-004-SignalTest32 \
33 test-art-target-run-test-gcstress-optimizing-relocate-004-SignalTest32 \
34 test-art-target-run-test-gcstress-default-relocate-004-SignalTest32 \
35 test-art-target-run-test-gcstress-optimizing-no-prebuild-004-SignalTest32 \
Nicolas Geoffray5a586cc2014-08-14 18:38:41 +010036 test-art-target-run-test-gcstress-default-no-prebuild-004-SignalTest32 \
37 test-art-host-run-test-gcstress-default-prebuild-114-ParallelGC32 \
38 test-art-host-run-test-gcstress-interpreter-prebuild-114-ParallelGC32 \
39 test-art-host-run-test-gcstress-optimizing-prebuild-114-ParallelGC32 \
40 test-art-host-run-test-gcstress-default-prebuild-114-ParallelGC64 \
41 test-art-host-run-test-gcstress-interpreter-prebuild-114-ParallelGC64 \
42 test-art-host-run-test-gcstress-optimizing-prebuild-114-ParallelGC64
Ian Rogersafd9acc2014-06-17 08:21:54 -070043
Andreas Gampe928f72b2014-09-09 19:53:48 -070044# Failing valgrind tests.
45# Note: *all* 64b tests involving the runtime do not work currently. b/15170219.
46
47# Optimizing compiler codegen is not destructed and can leak non-arena-ed structures.
48ART_TEST_KNOWN_BROKEN += \
49 valgrind-test-art-host-gtest-codegen_test32 \
50 valgrind-test-art-host-gtest-find_loops_test32 \
51 valgrind-test-art-host-gtest-linearize_test32 \
52 valgrind-test-art-host-gtest-live_ranges_test32 \
53 valgrind-test-art-host-gtest-liveness_test32 \
54 valgrind-test-art-host-gtest-register_allocator_test32
55
Nicolas Geoffrayf61b5372014-06-25 14:35:34 +010056# List of known failing tests that when executed won't cause test execution to not finish.
57# The test name must be the full rule name such as test-art-host-oat-optimizing-HelloWorld64.
58ART_TEST_KNOWN_FAILING :=
Ian Rogersafd9acc2014-06-17 08:21:54 -070059
60# Keep going after encountering a test failure?
Andreas Gampee7655c52014-07-24 21:41:06 -070061ART_TEST_KEEP_GOING ?= true
Ian Rogersafd9acc2014-06-17 08:21:54 -070062
Ian Rogers5242c0a2014-07-18 11:02:19 -070063# Do you want all tests, even those that are time consuming?
Ian Rogersf5c44b32014-08-19 16:52:36 -070064ART_TEST_FULL ?= false
65
66# Do you want default compiler tests run?
67ART_TEST_DEFAULT_COMPILER ?= true
68
69# Do you want interpreter tests run?
70ART_TEST_INTERPRETER ?= $(ART_TEST_FULL)
Ian Rogers5242c0a2014-07-18 11:02:19 -070071
72# Do you want optimizing compiler tests run?
73ART_TEST_OPTIMIZING ?= $(ART_TEST_FULL)
74
75# Do you want tracing tests run?
76ART_TEST_TRACE ?= $(ART_TEST_FULL)
77
Ian Rogers701aa642014-07-18 11:38:13 -070078# Do you want tests with GC verification enabled run?
79ART_TEST_GC_VERIFY ?= $(ART_TEST_FULL)
80
Ian Rogers8a14b752014-07-18 15:06:53 -070081# Do you want tests with the GC stress mode enabled run?
82ART_TEST_GC_STRESS ?= $(ART_TEST_FULL)
83
Ian Rogersf5c44b32014-08-19 16:52:36 -070084# Do you want tests with the JNI forcecopy mode enabled run?
85ART_TEST_JNI_FORCECOPY ?= $(ART_TEST_FULL)
Alex Lighta59dd802014-07-02 16:28:08 -070086
Ian Rogersf5c44b32014-08-19 16:52:36 -070087# Do you want run-tests with relocation disabled run?
Alex Lighta59dd802014-07-02 16:28:08 -070088ART_TEST_RUN_TEST_NO_RELOCATE ?= $(ART_TEST_FULL)
89
Ian Rogersf5c44b32014-08-19 16:52:36 -070090# Do you want run-tests with no prebuilding enabled run?
Alex Light9d722532014-07-22 18:07:12 -070091ART_TEST_RUN_TEST_NO_PREBUILD ?= $(ART_TEST_FULL)
Alex Lighta59dd802014-07-02 16:28:08 -070092
Alex Light03a112d2014-08-25 13:25:56 -070093# Do you want run-tests without a pregenerated core.art?
94ART_TEST_RUN_TEST_NO_IMAGE ?= $(ART_TEST_FULL)
95
96# Do you want run-tests with relocation enabled but patchoat failing?
97ART_TEST_RUN_TEST_RELOCATE_NO_PATCHOAT ?= $(ART_TEST_FULL)
98
99# Do you want run-tests without a dex2oat?
100ART_TEST_RUN_TEST_NO_DEX2OAT ?= $(ART_TEST_FULL)
101
Alex Lightbfac14a2014-07-30 09:41:21 -0700102# Do you want failed tests to have their artifacts cleaned up?
103ART_TEST_RUN_TEST_ALWAYS_CLEAN ?= true
104
Ian Rogersafd9acc2014-06-17 08:21:54 -0700105# Define the command run on test failure. $(1) is the name of the test. Executed by the shell.
106define ART_TEST_FAILED
107 ( [ -f $(ART_HOST_TEST_DIR)/skipped/$(1) ] || \
108 (mkdir -p $(ART_HOST_TEST_DIR)/failed/ && touch $(ART_HOST_TEST_DIR)/failed/$(1) && \
109 echo $(ART_TEST_KNOWN_FAILING) | grep -q $(1) \
110 && (echo -e "$(1) \e[91mKNOWN FAILURE\e[0m") \
Ian Rogersd2c0b092014-07-22 14:22:22 -0700111 || (echo -e "$(1) \e[91mFAILED\e[0m" >&2 )))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700112endef
113
114# Define the command run on test success. $(1) is the name of the test. Executed by the shell.
115# The command checks prints "PASSED" then checks to see if this was a top-level make target (e.g.
116# "mm test-art-host-oat-HelloWorld32"), if it was then it does nothing, otherwise it creates a file
117# to be printed in the passing test summary.
118define ART_TEST_PASSED
119 ( echo -e "$(1) \e[92mPASSED\e[0m" && \
120 (echo $(MAKECMDGOALS) | grep -q $(1) || \
121 (mkdir -p $(ART_HOST_TEST_DIR)/passed/ && touch $(ART_HOST_TEST_DIR)/passed/$(1))))
122endef
123
124# Define the command run on test success of multiple prerequisites. $(1) is the name of the test.
125# When the test is a top-level make target then a summary of the ran tests is produced. Executed by
126# the shell.
127define ART_TEST_PREREQ_FINISHED
128 (echo -e "$(1) \e[32mCOMPLETE\e[0m" && \
129 (echo $(MAKECMDGOALS) | grep -q -v $(1) || \
130 (([ -d $(ART_HOST_TEST_DIR)/passed/ ] \
131 && (echo -e "\e[92mPASSING TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/passed/) \
132 || (echo -e "\e[91mNO TESTS PASSED\e[0m")) && \
133 ([ -d $(ART_HOST_TEST_DIR)/skipped/ ] \
134 && (echo -e "\e[93mSKIPPED TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/skipped/) \
135 || (echo -e "\e[92mNO TESTS SKIPPED\e[0m")) && \
136 ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \
Ian Rogers51829152014-07-21 20:28:31 -0700137 && (echo -e "\e[91mFAILING TESTS\e[0m" >&2 && ls -1 $(ART_HOST_TEST_DIR)/failed/ >&2) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700138 || (echo -e "\e[92mNO TESTS FAILED\e[0m")) \
139 && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] && rm -r $(ART_HOST_TEST_DIR) \
140 || (rm -r $(ART_HOST_TEST_DIR) && false)))))
141endef
142
143# Define the command executed by the shell ahead of running an art test. $(1) is the name of the
144# test.
145define ART_TEST_SKIP
146 ((echo $(ART_TEST_KNOWN_BROKEN) | grep -q -v $(1) \
147 && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] || [ $(ART_TEST_KEEP_GOING) = true ])\
148 && echo -e "$(1) \e[95mRUNNING\e[0m") \
149 || ((mkdir -p $(ART_HOST_TEST_DIR)/skipped/ && touch $(ART_HOST_TEST_DIR)/skipped/$(1) \
150 && ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \
151 && echo -e "$(1) \e[93mSKIPPING DUE TO EARLIER FAILURE\e[0m") \
152 || echo -e "$(1) \e[93mSKIPPING BROKEN TEST\e[0m") && false))
153endef
154
155# Create a build rule to create the dex file for a test.
156# $(1): module prefix, e.g. art-test-dex
157# $(2): input test directory in art/test, e.g. HelloWorld
158# $(3): target output module path (default module path is used on host)
159# $(4): additional dependencies
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700160# $(5): a make variable used to collate target dependencies, e.g ART_TEST_TARGET_OAT_HelloWorld_DEX
161# $(6): a make variable used to collate host dependencies, e.g ART_TEST_HOST_OAT_HelloWorld_DEX
Ian Rogersafd9acc2014-06-17 08:21:54 -0700162define build-art-test-dex
163 ifeq ($(ART_BUILD_TARGET),true)
164 include $(CLEAR_VARS)
165 LOCAL_MODULE := $(1)-$(2)
166 LOCAL_SRC_FILES := $(call all-java-files-under, $(2))
167 LOCAL_NO_STANDARD_LIBRARIES := true
168 LOCAL_DEX_PREOPT := false
169 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4)
170 LOCAL_MODULE_TAGS := tests
171 LOCAL_JAVA_LIBRARIES := $(TARGET_CORE_JARS)
172 LOCAL_MODULE_PATH := $(3)
173 LOCAL_DEX_PREOPT_IMAGE_LOCATION := $(TARGET_CORE_IMG_OUT)
174 include $(BUILD_JAVA_LIBRARY)
Brian Carlstrom532714a2014-06-25 02:15:31 -0700175 $(5) := $$(LOCAL_INSTALLED_MODULE)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700176 endif
177 ifeq ($(ART_BUILD_HOST),true)
178 include $(CLEAR_VARS)
179 LOCAL_MODULE := $(1)-$(2)
180 LOCAL_SRC_FILES := $(call all-java-files-under, $(2))
181 LOCAL_NO_STANDARD_LIBRARIES := true
182 LOCAL_DEX_PREOPT := false
183 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4)
184 LOCAL_JAVA_LIBRARIES := $(HOST_CORE_JARS)
185 LOCAL_DEX_PREOPT_IMAGE := $(HOST_CORE_IMG_LOCATION)
186 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700187 $(6) := $$(LOCAL_INSTALLED_MODULE)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700188 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700189endef
190
191endif # ANDROID_COMMON_TEST_MK