Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 1 | # |
| 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 Murashkin | 3774335 | 2014-11-13 14:38:00 -0800 | [diff] [blame] | 17 | ifndef ART_ANDROID_COMMON_TEST_MK |
| 18 | ART_ANDROID_COMMON_TEST_MK = true |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 19 | |
| 20 | include art/build/Android.common_path.mk |
| 21 | |
Andreas Gampe | 1fe5e5c | 2014-07-11 21:14:35 -0700 | [diff] [blame] | 22 | # 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). |
| 24 | ART_TARGET_CFLAGS += -DART_TARGET_NATIVETEST_DIR=${ART_TARGET_NATIVETEST_DIR} |
| 25 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 26 | # 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 Chartier | bdeb9b7 | 2015-01-07 17:42:07 -0800 | [diff] [blame] | 28 | ART_TEST_KNOWN_BROKEN := |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 29 | |
Andreas Gampe | 928f72b | 2014-09-09 19:53:48 -0700 | [diff] [blame] | 30 | # Failing valgrind tests. |
| 31 | # Note: *all* 64b tests involving the runtime do not work currently. b/15170219. |
| 32 | |
Nicolas Geoffray | f61b537 | 2014-06-25 14:35:34 +0100 | [diff] [blame] | 33 | # 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. |
| 35 | ART_TEST_KNOWN_FAILING := |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 36 | |
| 37 | # Keep going after encountering a test failure? |
Andreas Gampe | e7655c5 | 2014-07-24 21:41:06 -0700 | [diff] [blame] | 38 | ART_TEST_KEEP_GOING ?= true |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 39 | |
Ian Rogers | 5242c0a | 2014-07-18 11:02:19 -0700 | [diff] [blame] | 40 | # Do you want all tests, even those that are time consuming? |
Ian Rogers | f5c44b3 | 2014-08-19 16:52:36 -0700 | [diff] [blame] | 41 | ART_TEST_FULL ?= false |
| 42 | |
Alex Light | 91de25f | 2015-10-28 17:00:06 -0700 | [diff] [blame^] | 43 | # Do you want run-test to be quieter? run-tests will only show output if they fail. |
| 44 | ART_TEST_QUIET ?= true |
| 45 | |
Ian Rogers | f5c44b3 | 2014-08-19 16:52:36 -0700 | [diff] [blame] | 46 | # Do you want default compiler tests run? |
| 47 | ART_TEST_DEFAULT_COMPILER ?= true |
| 48 | |
| 49 | # Do you want interpreter tests run? |
| 50 | ART_TEST_INTERPRETER ?= $(ART_TEST_FULL) |
Igor Murashkin | 7617abd | 2015-07-10 18:27:47 -0700 | [diff] [blame] | 51 | ART_TEST_INTERPRETER_ACCESS_CHECKS ?= $(ART_TEST_FULL) |
Ian Rogers | 5242c0a | 2014-07-18 11:02:19 -0700 | [diff] [blame] | 52 | |
Mathieu Chartier | 3fc1b12 | 2015-02-26 10:58:08 -0800 | [diff] [blame] | 53 | # Do you want JIT tests run? |
| 54 | ART_TEST_JIT ?= $(ART_TEST_FULL) |
| 55 | |
Ian Rogers | 5242c0a | 2014-07-18 11:02:19 -0700 | [diff] [blame] | 56 | # Do you want optimizing compiler tests run? |
| 57 | ART_TEST_OPTIMIZING ?= $(ART_TEST_FULL) |
| 58 | |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 59 | # Do we want to test a PIC-compiled core image? |
| 60 | ART_TEST_PIC_IMAGE ?= $(ART_TEST_FULL) |
| 61 | |
| 62 | # Do we want to test PIC-compiled tests ("apps")? |
| 63 | ART_TEST_PIC_TEST ?= $(ART_TEST_FULL) |
| 64 | |
Ian Rogers | 5242c0a | 2014-07-18 11:02:19 -0700 | [diff] [blame] | 65 | # Do you want tracing tests run? |
| 66 | ART_TEST_TRACE ?= $(ART_TEST_FULL) |
| 67 | |
Andreas Gampe | 7526d78 | 2015-06-22 22:53:45 -0700 | [diff] [blame] | 68 | # Do you want tracing tests (streaming mode) run? |
| 69 | ART_TEST_TRACE_STREAM ?= $(ART_TEST_FULL) |
| 70 | |
Ian Rogers | 701aa64 | 2014-07-18 11:38:13 -0700 | [diff] [blame] | 71 | # Do you want tests with GC verification enabled run? |
| 72 | ART_TEST_GC_VERIFY ?= $(ART_TEST_FULL) |
| 73 | |
Ian Rogers | 8a14b75 | 2014-07-18 15:06:53 -0700 | [diff] [blame] | 74 | # Do you want tests with the GC stress mode enabled run? |
| 75 | ART_TEST_GC_STRESS ?= $(ART_TEST_FULL) |
| 76 | |
Ian Rogers | f5c44b3 | 2014-08-19 16:52:36 -0700 | [diff] [blame] | 77 | # Do you want tests with the JNI forcecopy mode enabled run? |
| 78 | ART_TEST_JNI_FORCECOPY ?= $(ART_TEST_FULL) |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 79 | |
Ian Rogers | f5c44b3 | 2014-08-19 16:52:36 -0700 | [diff] [blame] | 80 | # Do you want run-tests with relocation disabled run? |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 81 | ART_TEST_RUN_TEST_NO_RELOCATE ?= $(ART_TEST_FULL) |
| 82 | |
Nicolas Geoffray | 41bb331 | 2014-10-24 13:49:08 +0100 | [diff] [blame] | 83 | # Do you want run-tests with prebuilding? |
| 84 | ART_TEST_RUN_TEST_PREBUILD ?= true |
| 85 | |
Ian Rogers | f5c44b3 | 2014-08-19 16:52:36 -0700 | [diff] [blame] | 86 | # Do you want run-tests with no prebuilding enabled run? |
Alex Light | 9d72253 | 2014-07-22 18:07:12 -0700 | [diff] [blame] | 87 | ART_TEST_RUN_TEST_NO_PREBUILD ?= $(ART_TEST_FULL) |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 88 | |
Alex Light | 03a112d | 2014-08-25 13:25:56 -0700 | [diff] [blame] | 89 | # Do you want run-tests without a pregenerated core.art? |
| 90 | ART_TEST_RUN_TEST_NO_IMAGE ?= $(ART_TEST_FULL) |
| 91 | |
| 92 | # Do you want run-tests with relocation enabled but patchoat failing? |
| 93 | ART_TEST_RUN_TEST_RELOCATE_NO_PATCHOAT ?= $(ART_TEST_FULL) |
| 94 | |
| 95 | # Do you want run-tests without a dex2oat? |
| 96 | ART_TEST_RUN_TEST_NO_DEX2OAT ?= $(ART_TEST_FULL) |
| 97 | |
Nicolas Geoffray | bd2c63c | 2014-10-16 18:04:12 +0100 | [diff] [blame] | 98 | # Do you want run-tests with libartd.so? |
| 99 | ART_TEST_RUN_TEST_DEBUG ?= true |
| 100 | |
| 101 | # Do you want run-tests with libart.so? |
| 102 | ART_TEST_RUN_TEST_NDEBUG ?= $(ART_TEST_FULL) |
| 103 | |
Nicolas Geoffray | 41bb331 | 2014-10-24 13:49:08 +0100 | [diff] [blame] | 104 | # Do you want run-tests with the host/target's second arch? |
| 105 | ART_TEST_RUN_TEST_2ND_ARCH ?= true |
| 106 | |
Alex Light | bfac14a | 2014-07-30 09:41:21 -0700 | [diff] [blame] | 107 | # Do you want failed tests to have their artifacts cleaned up? |
| 108 | ART_TEST_RUN_TEST_ALWAYS_CLEAN ?= true |
| 109 | |
Nicolas Geoffray | 43c162f | 2015-03-09 12:21:26 +0000 | [diff] [blame] | 110 | # Do you want run-tests with the --debuggable flag |
| 111 | ART_TEST_RUN_TEST_DEBUGGABLE ?= $(ART_TEST_FULL) |
| 112 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 113 | # Define the command run on test failure. $(1) is the name of the test. Executed by the shell. |
| 114 | define ART_TEST_FAILED |
| 115 | ( [ -f $(ART_HOST_TEST_DIR)/skipped/$(1) ] || \ |
| 116 | (mkdir -p $(ART_HOST_TEST_DIR)/failed/ && touch $(ART_HOST_TEST_DIR)/failed/$(1) && \ |
| 117 | echo $(ART_TEST_KNOWN_FAILING) | grep -q $(1) \ |
| 118 | && (echo -e "$(1) \e[91mKNOWN FAILURE\e[0m") \ |
Ian Rogers | d2c0b09 | 2014-07-22 14:22:22 -0700 | [diff] [blame] | 119 | || (echo -e "$(1) \e[91mFAILED\e[0m" >&2 ))) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 120 | endef |
| 121 | |
Alex Light | 91de25f | 2015-10-28 17:00:06 -0700 | [diff] [blame^] | 122 | ifeq ($(ART_TEST_QUIET),true) |
| 123 | ART_TEST_ANNOUNCE_PASS := ( true ) |
| 124 | ART_TEST_ANNOUNCE_RUN := ( true ) |
| 125 | ART_TEST_ANNOUNCE_SKIP_FAILURE := ( true ) |
| 126 | ART_TEST_ANNOUNCE_SKIP_BROKEN := ( true ) |
| 127 | else |
| 128 | # Note the use of '=' and not ':=' is intentional since these are actually functions. |
| 129 | ART_TEST_ANNOUNCE_PASS = ( echo -e "$(1) \e[92mPASSED\e[0m" ) |
| 130 | ART_TEST_ANNOUNCE_RUN = ( echo -e "$(1) \e[95mRUNNING\e[0m") |
| 131 | ART_TEST_ANNOUNCE_SKIP_FAILURE = ( echo -e "$(1) \e[93mSKIPPING DUE TO EARLIER FAILURE\e[0m" ) |
| 132 | ART_TEST_ANNOUNCE_SKIP_BROKEN = ( echo -e "$(1) \e[93mSKIPPING BROKEN TEST\e[0m" ) |
| 133 | endif |
| 134 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 135 | # Define the command run on test success. $(1) is the name of the test. Executed by the shell. |
| 136 | # The command checks prints "PASSED" then checks to see if this was a top-level make target (e.g. |
| 137 | # "mm test-art-host-oat-HelloWorld32"), if it was then it does nothing, otherwise it creates a file |
| 138 | # to be printed in the passing test summary. |
| 139 | define ART_TEST_PASSED |
Alex Light | 91de25f | 2015-10-28 17:00:06 -0700 | [diff] [blame^] | 140 | ( $(call ART_TEST_ANNOUNCE_PASS,$(1)) && \ |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 141 | (echo $(MAKECMDGOALS) | grep -q $(1) || \ |
| 142 | (mkdir -p $(ART_HOST_TEST_DIR)/passed/ && touch $(ART_HOST_TEST_DIR)/passed/$(1)))) |
| 143 | endef |
| 144 | |
| 145 | # Define the command run on test success of multiple prerequisites. $(1) is the name of the test. |
| 146 | # When the test is a top-level make target then a summary of the ran tests is produced. Executed by |
| 147 | # the shell. |
| 148 | define ART_TEST_PREREQ_FINISHED |
| 149 | (echo -e "$(1) \e[32mCOMPLETE\e[0m" && \ |
| 150 | (echo $(MAKECMDGOALS) | grep -q -v $(1) || \ |
| 151 | (([ -d $(ART_HOST_TEST_DIR)/passed/ ] \ |
| 152 | && (echo -e "\e[92mPASSING TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/passed/) \ |
| 153 | || (echo -e "\e[91mNO TESTS PASSED\e[0m")) && \ |
| 154 | ([ -d $(ART_HOST_TEST_DIR)/skipped/ ] \ |
| 155 | && (echo -e "\e[93mSKIPPED TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/skipped/) \ |
| 156 | || (echo -e "\e[92mNO TESTS SKIPPED\e[0m")) && \ |
| 157 | ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \ |
Ian Rogers | 5182915 | 2014-07-21 20:28:31 -0700 | [diff] [blame] | 158 | && (echo -e "\e[91mFAILING TESTS\e[0m" >&2 && ls -1 $(ART_HOST_TEST_DIR)/failed/ >&2) \ |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 159 | || (echo -e "\e[92mNO TESTS FAILED\e[0m")) \ |
| 160 | && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] && rm -r $(ART_HOST_TEST_DIR) \ |
| 161 | || (rm -r $(ART_HOST_TEST_DIR) && false))))) |
| 162 | endef |
| 163 | |
| 164 | # Define the command executed by the shell ahead of running an art test. $(1) is the name of the |
| 165 | # test. |
| 166 | define ART_TEST_SKIP |
| 167 | ((echo $(ART_TEST_KNOWN_BROKEN) | grep -q -v $(1) \ |
| 168 | && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] || [ $(ART_TEST_KEEP_GOING) = true ])\ |
Alex Light | 91de25f | 2015-10-28 17:00:06 -0700 | [diff] [blame^] | 169 | && $(call ART_TEST_ANNOUNCE_RUN,$(1)) ) \ |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 170 | || ((mkdir -p $(ART_HOST_TEST_DIR)/skipped/ && touch $(ART_HOST_TEST_DIR)/skipped/$(1) \ |
| 171 | && ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \ |
Alex Light | 91de25f | 2015-10-28 17:00:06 -0700 | [diff] [blame^] | 172 | && $(call ART_TEST_ANNOUNCE_SKIP_FAILURE,$(1)) ) \ |
| 173 | || $(call ART_TEST_ANNOUNCE_SKIP_BROKEN,$(1)) ) && false)) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 174 | endef |
| 175 | |
| 176 | # Create a build rule to create the dex file for a test. |
| 177 | # $(1): module prefix, e.g. art-test-dex |
| 178 | # $(2): input test directory in art/test, e.g. HelloWorld |
| 179 | # $(3): target output module path (default module path is used on host) |
| 180 | # $(4): additional dependencies |
Ian Rogers | 1a2f84e | 2014-07-07 16:05:18 -0700 | [diff] [blame] | 181 | # $(5): a make variable used to collate target dependencies, e.g ART_TEST_TARGET_OAT_HelloWorld_DEX |
| 182 | # $(6): a make variable used to collate host dependencies, e.g ART_TEST_HOST_OAT_HelloWorld_DEX |
Richard Uhler | 66d874d | 2015-01-15 09:37:19 -0800 | [diff] [blame] | 183 | # |
Richard Uhler | 4d57ecf | 2015-03-11 12:36:24 -0700 | [diff] [blame] | 184 | # If the input test directory contains a file called main.list and main.jpp, |
| 185 | # then a multi-dex file is created passing main.list as the --main-dex-list |
| 186 | # argument to dx and main.jpp for Jack. |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 187 | define build-art-test-dex |
| 188 | ifeq ($(ART_BUILD_TARGET),true) |
| 189 | include $(CLEAR_VARS) |
| 190 | LOCAL_MODULE := $(1)-$(2) |
| 191 | LOCAL_SRC_FILES := $(call all-java-files-under, $(2)) |
| 192 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 193 | LOCAL_DEX_PREOPT := false |
| 194 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4) |
| 195 | LOCAL_MODULE_TAGS := tests |
| 196 | LOCAL_JAVA_LIBRARIES := $(TARGET_CORE_JARS) |
| 197 | LOCAL_MODULE_PATH := $(3) |
| 198 | LOCAL_DEX_PREOPT_IMAGE_LOCATION := $(TARGET_CORE_IMG_OUT) |
Richard Uhler | 66d874d | 2015-01-15 09:37:19 -0800 | [diff] [blame] | 199 | ifneq ($(wildcard $(LOCAL_PATH)/$(2)/main.list),) |
| 200 | LOCAL_DX_FLAGS := --multi-dex --main-dex-list=$(LOCAL_PATH)/$(2)/main.list --minimal-main-dex |
Richard Uhler | 4d57ecf | 2015-03-11 12:36:24 -0700 | [diff] [blame] | 201 | LOCAL_JACK_FLAGS := -D jack.dex.output.policy=minimal-multidex -D jack.preprocessor=true -D jack.preprocessor.file=$(LOCAL_PATH)/$(2)/main.jpp |
Richard Uhler | 66d874d | 2015-01-15 09:37:19 -0800 | [diff] [blame] | 202 | endif |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 203 | include $(BUILD_JAVA_LIBRARY) |
Brian Carlstrom | 532714a | 2014-06-25 02:15:31 -0700 | [diff] [blame] | 204 | $(5) := $$(LOCAL_INSTALLED_MODULE) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 205 | endif |
| 206 | ifeq ($(ART_BUILD_HOST),true) |
| 207 | include $(CLEAR_VARS) |
| 208 | LOCAL_MODULE := $(1)-$(2) |
| 209 | LOCAL_SRC_FILES := $(call all-java-files-under, $(2)) |
| 210 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 211 | LOCAL_DEX_PREOPT := false |
| 212 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4) |
| 213 | LOCAL_JAVA_LIBRARIES := $(HOST_CORE_JARS) |
| 214 | LOCAL_DEX_PREOPT_IMAGE := $(HOST_CORE_IMG_LOCATION) |
Richard Uhler | 66d874d | 2015-01-15 09:37:19 -0800 | [diff] [blame] | 215 | ifneq ($(wildcard $(LOCAL_PATH)/$(2)/main.list),) |
| 216 | LOCAL_DX_FLAGS := --multi-dex --main-dex-list=$(LOCAL_PATH)/$(2)/main.list --minimal-main-dex |
Richard Uhler | 4d57ecf | 2015-03-11 12:36:24 -0700 | [diff] [blame] | 217 | LOCAL_JACK_FLAGS := -D jack.dex.output.policy=minimal-multidex -D jack.preprocessor=true -D jack.preprocessor.file=$(LOCAL_PATH)/$(2)/main.jpp |
Richard Uhler | 66d874d | 2015-01-15 09:37:19 -0800 | [diff] [blame] | 218 | endif |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 219 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
Ian Rogers | 1a2f84e | 2014-07-07 16:05:18 -0700 | [diff] [blame] | 220 | $(6) := $$(LOCAL_INSTALLED_MODULE) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 221 | endif |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 222 | endef |
| 223 | |
Igor Murashkin | 3774335 | 2014-11-13 14:38:00 -0800 | [diff] [blame] | 224 | endif # ART_ANDROID_COMMON_TEST_MK |