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 | |
| 17 | ifndef ANDROID_COMMON_TEST_MK |
| 18 | ANDROID_COMMON_TEST_MK = true |
| 19 | |
| 20 | include art/build/Android.common_path.mk |
| 21 | |
| 22 | # List of known broken tests that we won't attempt to execute. The test name must be the full |
| 23 | # rule name such as test-art-host-oat-optimizing-HelloWorld64. |
Andreas Gampe | 1c83cbc | 2014-07-22 18:52:29 -0700 | [diff] [blame] | 24 | ART_TEST_KNOWN_BROKEN := \ |
| 25 | test-art-host-run-test-gcstress-optimizing-no-prebuild-004-SignalTest32 \ |
| 26 | test-art-host-run-test-gcstress-optimizing-prebuild-004-SignalTest32 \ |
| 27 | test-art-host-run-test-gcstress-optimizing-norelocate-004-SignalTest32 \ |
| 28 | test-art-host-run-test-gcstress-optimizing-relocate-004-SignalTest32 \ |
| 29 | test-art-host-run-test-gcverify-optimizing-no-prebuild-004-SignalTest32 \ |
| 30 | test-art-host-run-test-gcverify-optimizing-prebuild-004-SignalTest32 \ |
| 31 | test-art-host-run-test-gcverify-optimizing-norelocate-004-SignalTest32 \ |
| 32 | test-art-host-run-test-gcverify-optimizing-relocate-004-SignalTest32 \ |
| 33 | test-art-host-run-test-optimizing-no-prebuild-004-SignalTest32 \ |
| 34 | test-art-host-run-test-optimizing-prebuild-004-SignalTest32 \ |
| 35 | test-art-host-run-test-optimizing-norelocate-004-SignalTest32 \ |
| 36 | test-art-host-run-test-optimizing-relocate-004-SignalTest32 \ |
| 37 | test-art-target-run-test-gcstress-optimizing-prebuild-004-SignalTest32 \ |
| 38 | test-art-target-run-test-gcstress-optimizing-norelocate-004-SignalTest32 \ |
| 39 | test-art-target-run-test-gcstress-default-prebuild-004-SignalTest32 \ |
| 40 | test-art-target-run-test-gcstress-default-norelocate-004-SignalTest32 \ |
| 41 | test-art-target-run-test-gcstress-optimizing-relocate-004-SignalTest32 \ |
| 42 | test-art-target-run-test-gcstress-default-relocate-004-SignalTest32 \ |
| 43 | test-art-target-run-test-gcstress-optimizing-no-prebuild-004-SignalTest32 \ |
| 44 | test-art-target-run-test-gcstress-default-no-prebuild-004-SignalTest32 |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 45 | |
Nicolas Geoffray | f61b537 | 2014-06-25 14:35:34 +0100 | [diff] [blame] | 46 | # List of known failing tests that when executed won't cause test execution to not finish. |
| 47 | # The test name must be the full rule name such as test-art-host-oat-optimizing-HelloWorld64. |
| 48 | ART_TEST_KNOWN_FAILING := |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 49 | |
| 50 | # Keep going after encountering a test failure? |
Andreas Gampe | e7655c5 | 2014-07-24 21:41:06 -0700 | [diff] [blame^] | 51 | ART_TEST_KEEP_GOING ?= true |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 52 | |
Ian Rogers | 5242c0a | 2014-07-18 11:02:19 -0700 | [diff] [blame] | 53 | # Do you want all tests, even those that are time consuming? |
| 54 | ART_TEST_FULL ?= true |
| 55 | |
| 56 | # Do you want optimizing compiler tests run? |
| 57 | ART_TEST_OPTIMIZING ?= $(ART_TEST_FULL) |
| 58 | |
| 59 | # Do you want tracing tests run? |
| 60 | ART_TEST_TRACE ?= $(ART_TEST_FULL) |
| 61 | |
Ian Rogers | 701aa64 | 2014-07-18 11:38:13 -0700 | [diff] [blame] | 62 | # Do you want tests with GC verification enabled run? |
| 63 | ART_TEST_GC_VERIFY ?= $(ART_TEST_FULL) |
| 64 | |
Ian Rogers | 8a14b75 | 2014-07-18 15:06:53 -0700 | [diff] [blame] | 65 | # Do you want tests with the GC stress mode enabled run? |
| 66 | ART_TEST_GC_STRESS ?= $(ART_TEST_FULL) |
| 67 | |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 68 | # Do you want run-tests with relocation enabled? |
| 69 | ART_TEST_RUN_TEST_RELOCATE ?= $(ART_TEST_FULL) |
| 70 | |
| 71 | # Do you want run-tests with relocation disabled? |
| 72 | ART_TEST_RUN_TEST_NO_RELOCATE ?= $(ART_TEST_FULL) |
| 73 | |
Alex Light | 9d72253 | 2014-07-22 18:07:12 -0700 | [diff] [blame] | 74 | # Do you want run-tests with prebuild disabled? |
| 75 | ART_TEST_RUN_TEST_NO_PREBUILD ?= $(ART_TEST_FULL) |
Alex Light | a59dd80 | 2014-07-02 16:28:08 -0700 | [diff] [blame] | 76 | |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 77 | # Define the command run on test failure. $(1) is the name of the test. Executed by the shell. |
| 78 | define ART_TEST_FAILED |
| 79 | ( [ -f $(ART_HOST_TEST_DIR)/skipped/$(1) ] || \ |
| 80 | (mkdir -p $(ART_HOST_TEST_DIR)/failed/ && touch $(ART_HOST_TEST_DIR)/failed/$(1) && \ |
| 81 | echo $(ART_TEST_KNOWN_FAILING) | grep -q $(1) \ |
| 82 | && (echo -e "$(1) \e[91mKNOWN FAILURE\e[0m") \ |
Ian Rogers | d2c0b09 | 2014-07-22 14:22:22 -0700 | [diff] [blame] | 83 | || (echo -e "$(1) \e[91mFAILED\e[0m" >&2 ))) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 84 | endef |
| 85 | |
| 86 | # Define the command run on test success. $(1) is the name of the test. Executed by the shell. |
| 87 | # The command checks prints "PASSED" then checks to see if this was a top-level make target (e.g. |
| 88 | # "mm test-art-host-oat-HelloWorld32"), if it was then it does nothing, otherwise it creates a file |
| 89 | # to be printed in the passing test summary. |
| 90 | define ART_TEST_PASSED |
| 91 | ( echo -e "$(1) \e[92mPASSED\e[0m" && \ |
| 92 | (echo $(MAKECMDGOALS) | grep -q $(1) || \ |
| 93 | (mkdir -p $(ART_HOST_TEST_DIR)/passed/ && touch $(ART_HOST_TEST_DIR)/passed/$(1)))) |
| 94 | endef |
| 95 | |
| 96 | # Define the command run on test success of multiple prerequisites. $(1) is the name of the test. |
| 97 | # When the test is a top-level make target then a summary of the ran tests is produced. Executed by |
| 98 | # the shell. |
| 99 | define ART_TEST_PREREQ_FINISHED |
| 100 | (echo -e "$(1) \e[32mCOMPLETE\e[0m" && \ |
| 101 | (echo $(MAKECMDGOALS) | grep -q -v $(1) || \ |
| 102 | (([ -d $(ART_HOST_TEST_DIR)/passed/ ] \ |
| 103 | && (echo -e "\e[92mPASSING TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/passed/) \ |
| 104 | || (echo -e "\e[91mNO TESTS PASSED\e[0m")) && \ |
| 105 | ([ -d $(ART_HOST_TEST_DIR)/skipped/ ] \ |
| 106 | && (echo -e "\e[93mSKIPPED TESTS\e[0m" && ls -1 $(ART_HOST_TEST_DIR)/skipped/) \ |
| 107 | || (echo -e "\e[92mNO TESTS SKIPPED\e[0m")) && \ |
| 108 | ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \ |
Ian Rogers | 5182915 | 2014-07-21 20:28:31 -0700 | [diff] [blame] | 109 | && (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] | 110 | || (echo -e "\e[92mNO TESTS FAILED\e[0m")) \ |
| 111 | && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] && rm -r $(ART_HOST_TEST_DIR) \ |
| 112 | || (rm -r $(ART_HOST_TEST_DIR) && false))))) |
| 113 | endef |
| 114 | |
| 115 | # Define the command executed by the shell ahead of running an art test. $(1) is the name of the |
| 116 | # test. |
| 117 | define ART_TEST_SKIP |
| 118 | ((echo $(ART_TEST_KNOWN_BROKEN) | grep -q -v $(1) \ |
| 119 | && ([ ! -d $(ART_HOST_TEST_DIR)/failed/ ] || [ $(ART_TEST_KEEP_GOING) = true ])\ |
| 120 | && echo -e "$(1) \e[95mRUNNING\e[0m") \ |
| 121 | || ((mkdir -p $(ART_HOST_TEST_DIR)/skipped/ && touch $(ART_HOST_TEST_DIR)/skipped/$(1) \ |
| 122 | && ([ -d $(ART_HOST_TEST_DIR)/failed/ ] \ |
| 123 | && echo -e "$(1) \e[93mSKIPPING DUE TO EARLIER FAILURE\e[0m") \ |
| 124 | || echo -e "$(1) \e[93mSKIPPING BROKEN TEST\e[0m") && false)) |
| 125 | endef |
| 126 | |
| 127 | # Create a build rule to create the dex file for a test. |
| 128 | # $(1): module prefix, e.g. art-test-dex |
| 129 | # $(2): input test directory in art/test, e.g. HelloWorld |
| 130 | # $(3): target output module path (default module path is used on host) |
| 131 | # $(4): additional dependencies |
Ian Rogers | 1a2f84e | 2014-07-07 16:05:18 -0700 | [diff] [blame] | 132 | # $(5): a make variable used to collate target dependencies, e.g ART_TEST_TARGET_OAT_HelloWorld_DEX |
| 133 | # $(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] | 134 | define build-art-test-dex |
| 135 | ifeq ($(ART_BUILD_TARGET),true) |
| 136 | include $(CLEAR_VARS) |
| 137 | LOCAL_MODULE := $(1)-$(2) |
| 138 | LOCAL_SRC_FILES := $(call all-java-files-under, $(2)) |
| 139 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 140 | LOCAL_DEX_PREOPT := false |
| 141 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4) |
| 142 | LOCAL_MODULE_TAGS := tests |
| 143 | LOCAL_JAVA_LIBRARIES := $(TARGET_CORE_JARS) |
| 144 | LOCAL_MODULE_PATH := $(3) |
| 145 | LOCAL_DEX_PREOPT_IMAGE_LOCATION := $(TARGET_CORE_IMG_OUT) |
| 146 | include $(BUILD_JAVA_LIBRARY) |
Brian Carlstrom | 532714a | 2014-06-25 02:15:31 -0700 | [diff] [blame] | 147 | $(5) := $$(LOCAL_INSTALLED_MODULE) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 148 | endif |
| 149 | ifeq ($(ART_BUILD_HOST),true) |
| 150 | include $(CLEAR_VARS) |
| 151 | LOCAL_MODULE := $(1)-$(2) |
| 152 | LOCAL_SRC_FILES := $(call all-java-files-under, $(2)) |
| 153 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 154 | LOCAL_DEX_PREOPT := false |
| 155 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4) |
| 156 | LOCAL_JAVA_LIBRARIES := $(HOST_CORE_JARS) |
| 157 | LOCAL_DEX_PREOPT_IMAGE := $(HOST_CORE_IMG_LOCATION) |
| 158 | include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) |
Ian Rogers | 1a2f84e | 2014-07-07 16:05:18 -0700 | [diff] [blame] | 159 | $(6) := $$(LOCAL_INSTALLED_MODULE) |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 160 | endif |
Ian Rogers | afd9acc | 2014-06-17 08:21:54 -0700 | [diff] [blame] | 161 | endef |
| 162 | |
| 163 | endif # ANDROID_COMMON_TEST_MK |