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. |
Andreas Gampe | 1c83cbc | 2014-07-22 18:52:29 -0700 | [diff] [blame] | 28 | ART_TEST_KNOWN_BROKEN := \ |
Andreas Gampe | 1c83cbc | 2014-07-22 18:52:29 -0700 | [diff] [blame] | 29 | 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 Geoffray | 5a586cc | 2014-08-14 18:38:41 +0100 | [diff] [blame] | 36 | 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 Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 43 | |
Andreas Gampe | 928f72b | 2014-09-09 19:53:48 -0700 | [diff] [blame] | 44 | # Failing valgrind tests. |
| 45 | # Note: *all* 64b tests involving the runtime do not work currently. b/15170219. |
| 46 | |
Nicolas Geoffray | f61b537 | 2014-06-25 14:35:34 +0100 | [diff] [blame] | 47 | # List of known failing tests that when executed won't cause test execution to not finish. |
| 48 | # The test name must be the full rule name such as test-art-host-oat-optimizing-HelloWorld64. |
| 49 | ART_TEST_KNOWN_FAILING := |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 50 | |
| 51 | # Keep going after encountering a test failure? |
Andreas Gampe | e7655c5 | 2014-07-24 21:41:06 -0700 | [diff] [blame] | 52 | ART_TEST_KEEP_GOING ?= true |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 53 | |
Ian Rogers | 5242c0a | 2014-07-18 11:02:19 -0700 | [diff] [blame] | 54 | # Do you want all tests, even those that are time consuming? |
Ian Rogers | f5c44b3 | 2014-08-19 16:52:36 -0700 | [diff] [blame] | 55 | ART_TEST_FULL ?= false |
| 56 | |
| 57 | # Do you want default compiler tests run? |
| 58 | ART_TEST_DEFAULT_COMPILER ?= true |
| 59 | |
| 60 | # Do you want interpreter tests run? |
| 61 | ART_TEST_INTERPRETER ?= $(ART_TEST_FULL) |
Ian Rogers | 5242c0a | 2014-07-18 11:02:19 -0700 | [diff] [blame] | 62 | |
| 63 | # Do you want optimizing compiler tests run? |
| 64 | ART_TEST_OPTIMIZING ?= $(ART_TEST_FULL) |
| 65 | |
Andreas Gampe | c23c9c9 | 2014-10-28 14:47:25 -0700 | [diff] [blame] | 66 | # Do we want to test a PIC-compiled core image? |
| 67 | ART_TEST_PIC_IMAGE ?= $(ART_TEST_FULL) |
| 68 | |
| 69 | # Do we want to test PIC-compiled tests ("apps")? |
| 70 | ART_TEST_PIC_TEST ?= $(ART_TEST_FULL) |
| 71 | |
Ian Rogers | 5242c0a | 2014-07-18 11:02:19 -0700 | [diff] [blame] | 72 | # Do you want tracing tests run? |
| 73 | ART_TEST_TRACE ?= $(ART_TEST_FULL) |
| 74 | |
Ian Rogers | 701aa64 | 2014-07-18 11:38:13 -0700 | [diff] [blame] | 75 | # Do you want tests with GC verification enabled run? |
| 76 | ART_TEST_GC_VERIFY ?= $(ART_TEST_FULL) |
| 77 | |
Ian Rogers | 8a14b75 | 2014-07-18 15:06:53 -0700 | [diff] [blame] | 78 | # Do you want tests with the GC stress mode enabled run? |
| 79 | ART_TEST_GC_STRESS ?= $(ART_TEST_FULL) |
| 80 | |
Ian Rogers | f5c44b3 | 2014-08-19 16:52:36 -0700 | [diff] [blame] | 81 | # Do you want tests with the JNI forcecopy mode enabled run? |
| 82 | ART_TEST_JNI_FORCECOPY ?= $(ART_TEST_FULL) |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 83 | |
Ian Rogers | f5c44b3 | 2014-08-19 16:52:36 -0700 | [diff] [blame] | 84 | # Do you want run-tests with relocation disabled run? |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 85 | ART_TEST_RUN_TEST_NO_RELOCATE ?= $(ART_TEST_FULL) |
| 86 | |
Nicolas Geoffray | 41bb331 | 2014-10-24 13:49:08 +0100 | [diff] [blame] | 87 | # Do you want run-tests with prebuilding? |
| 88 | ART_TEST_RUN_TEST_PREBUILD ?= true |
| 89 | |
Ian Rogers | f5c44b3 | 2014-08-19 16:52:36 -0700 | [diff] [blame] | 90 | # Do you want run-tests with no prebuilding enabled run? |
Alex Light | 9d72253 | 2014-07-22 18:07:12 -0700 | [diff] [blame] | 91 | ART_TEST_RUN_TEST_NO_PREBUILD ?= $(ART_TEST_FULL) |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 92 | |
Alex Light | 03a112d | 2014-08-25 13:25:56 -0700 | [diff] [blame] | 93 | # Do you want run-tests without a pregenerated core.art? |
| 94 | ART_TEST_RUN_TEST_NO_IMAGE ?= $(ART_TEST_FULL) |
| 95 | |
| 96 | # Do you want run-tests with relocation enabled but patchoat failing? |
| 97 | ART_TEST_RUN_TEST_RELOCATE_NO_PATCHOAT ?= $(ART_TEST_FULL) |
| 98 | |
| 99 | # Do you want run-tests without a dex2oat? |
| 100 | ART_TEST_RUN_TEST_NO_DEX2OAT ?= $(ART_TEST_FULL) |
| 101 | |
Nicolas Geoffray | bd2c63c | 2014-10-16 18:04:12 +0100 | [diff] [blame] | 102 | # Do you want run-tests with libartd.so? |
| 103 | ART_TEST_RUN_TEST_DEBUG ?= true |
| 104 | |
| 105 | # Do you want run-tests with libart.so? |
| 106 | ART_TEST_RUN_TEST_NDEBUG ?= $(ART_TEST_FULL) |
| 107 | |
Nicolas Geoffray | 41bb331 | 2014-10-24 13:49:08 +0100 | [diff] [blame] | 108 | # Do you want run-tests with the host/target's second arch? |
| 109 | ART_TEST_RUN_TEST_2ND_ARCH ?= true |
| 110 | |
Alex Light | bfac14a | 2014-07-30 09:41:21 -0700 | [diff] [blame] | 111 | # Do you want failed tests to have their artifacts cleaned up? |
| 112 | ART_TEST_RUN_TEST_ALWAYS_CLEAN ?= true |
| 113 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 114 | # Define the command run on test failure. $(1) is the name of the test. Executed by the shell. |
| 115 | define ART_TEST_FAILED |
| 116 | ( [ -f $(ART_HOST_TEST_DIR)/skipped/$(1) ] || \ |
| 117 | (mkdir -p $(ART_HOST_TEST_DIR)/failed/ && touch $(ART_HOST_TEST_DIR)/failed/$(1) && \ |
| 118 | echo $(ART_TEST_KNOWN_FAILING) | grep -q $(1) \ |
| 119 | && (echo -e "$(1) \e[91mKNOWN FAILURE\e[0m") \ |
Ian Rogers | d2c0b09 | 2014-07-22 14:22:22 -0700 | [diff] [blame] | 120 | || (echo -e "$(1) \e[91mFAILED\e[0m" >&2 ))) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 121 | endef |
| 122 | |
| 123 | # Define the command run on test success. $(1) is the name of the test. Executed by the shell. |
| 124 | # The command checks prints "PASSED" then checks to see if this was a top-level make target (e.g. |
| 125 | # "mm test-art-host-oat-HelloWorld32"), if it was then it does nothing, otherwise it creates a file |
| 126 | # to be printed in the passing test summary. |
| 127 | define ART_TEST_PASSED |
| 128 | ( echo -e "$(1) \e[92mPASSED\e[0m" && \ |
| 129 | (echo $(MAKECMDGOALS) | grep -q $(1) || \ |
| 130 | (mkdir -p $(ART_HOST_TEST_DIR)/passed/ && touch $(ART_HOST_TEST_DIR)/passed/$(1)))) |
| 131 | endef |
| 132 | |
| 133 | # Define the command run on test success of multiple prerequisites. $(1) is the name of the test. |
| 134 | # When the test is a top-level make target then a summary of the ran tests is produced. Executed by |
| 135 | # the shell. |
| 136 | define ART_TEST_PREREQ_FINISHED |
| 137 | (echo -e "$(1) \e[32mCOMPLETE\e[0m" && \ |
| 138 | (echo $(MAKECMDGOALS) | grep -q -v $(1) || \ |
| 139 | (([ -d $(ART_HOST_TEST_DIR)/passed/ ] \ |
| 140 | && (echo -e "\e[92mPASSING TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/passed/) \ |
| 141 | || (echo -e "\e[91mNO TESTS PASSED\e[0m")) && \ |
| 142 | ([ -d $(ART_HOST_TEST_DIR)/skipped/ ] \ |
| 143 | && (echo -e "\e[93mSKIPPED TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/skipped/) \ |
| 144 | || (echo -e "\e[92mNO TESTS SKIPPED\e[0m")) && \ |
| 145 | ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \ |
Ian Rogers | 5182915 | 2014-07-21 20:28:31 -0700 | [diff] [blame] | 146 | && (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] | 147 | || (echo -e "\e[92mNO TESTS FAILED\e[0m")) \ |
| 148 | && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] && rm -r $(ART_HOST_TEST_DIR) \ |
| 149 | || (rm -r $(ART_HOST_TEST_DIR) && false))))) |
| 150 | endef |
| 151 | |
| 152 | # Define the command executed by the shell ahead of running an art test. $(1) is the name of the |
| 153 | # test. |
| 154 | define ART_TEST_SKIP |
| 155 | ((echo $(ART_TEST_KNOWN_BROKEN) | grep -q -v $(1) \ |
| 156 | && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] || [ $(ART_TEST_KEEP_GOING) = true ])\ |
| 157 | && echo -e "$(1) \e[95mRUNNING\e[0m") \ |
| 158 | || ((mkdir -p $(ART_HOST_TEST_DIR)/skipped/ && touch $(ART_HOST_TEST_DIR)/skipped/$(1) \ |
| 159 | && ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \ |
| 160 | && echo -e "$(1) \e[93mSKIPPING DUE TO EARLIER FAILURE\e[0m") \ |
| 161 | || echo -e "$(1) \e[93mSKIPPING BROKEN TEST\e[0m") && false)) |
| 162 | endef |
| 163 | |
| 164 | # Create a build rule to create the dex file for a test. |
| 165 | # $(1): module prefix, e.g. art-test-dex |
| 166 | # $(2): input test directory in art/test, e.g. HelloWorld |
| 167 | # $(3): target output module path (default module path is used on host) |
| 168 | # $(4): additional dependencies |
Ian Rogers | 1a2f84e | 2014-07-07 16:05:18 -0700 | [diff] [blame] | 169 | # $(5): a make variable used to collate target dependencies, e.g ART_TEST_TARGET_OAT_HelloWorld_DEX |
| 170 | # $(6): a make variable used to collate host dependencies, e.g ART_TEST_HOST_OAT_HelloWorld_DEX |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 171 | define build-art-test-dex |
| 172 | ifeq ($(ART_BUILD_TARGET),true) |
| 173 | include $(CLEAR_VARS) |
| 174 | LOCAL_MODULE := $(1)-$(2) |
| 175 | LOCAL_SRC_FILES := $(call all-java-files-under, $(2)) |
| 176 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 177 | LOCAL_DEX_PREOPT := false |
| 178 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4) |
| 179 | LOCAL_MODULE_TAGS := tests |
| 180 | LOCAL_JAVA_LIBRARIES := $(TARGET_CORE_JARS) |
| 181 | LOCAL_MODULE_PATH := $(3) |
| 182 | LOCAL_DEX_PREOPT_IMAGE_LOCATION := $(TARGET_CORE_IMG_OUT) |
| 183 | include $(BUILD_JAVA_LIBRARY) |
Brian Carlstrom | 532714a | 2014-06-25 02:15:31 -0700 | [diff] [blame] | 184 | $(5) := $$(LOCAL_INSTALLED_MODULE) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 185 | 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) |
| 195 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
Ian Rogers | 1a2f84e | 2014-07-07 16:05:18 -0700 | [diff] [blame] | 196 | $(6) := $$(LOCAL_INSTALLED_MODULE) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 197 | endif |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 198 | endef |
| 199 | |
Igor Murashkin | 3774335 | 2014-11-13 14:38:00 -0800 | [diff] [blame^] | 200 | endif # ART_ANDROID_COMMON_TEST_MK |