Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -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 | ######################################################################## |
| 18 | |
Brian Carlstrom | b279337 | 2012-03-17 18:27:16 -0700 | [diff] [blame] | 19 | ART_TEST_TARGET_DEX_FILES := |
| 20 | ART_TEST_HOST_DEX_FILES := |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 21 | |
Brian Carlstrom | 32b4b2a | 2012-01-31 16:21:40 -0800 | [diff] [blame] | 22 | # $(1): module prefix |
| 23 | # $(2): input test directory |
Brian Carlstrom | b279337 | 2012-03-17 18:27:16 -0700 | [diff] [blame] | 24 | # $(3): target output module path (default module path is used on host) |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 25 | define build-art-test-dex |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 26 | ifeq ($(ART_BUILD_TARGET),true) |
| 27 | include $(CLEAR_VARS) |
| 28 | LOCAL_MODULE := $(1)-$(2) |
| 29 | LOCAL_MODULE_TAGS := tests |
| 30 | LOCAL_SRC_FILES := $(call all-java-files-under, test/$(2)) |
| 31 | LOCAL_JAVA_LIBRARIES := $(TARGET_CORE_JARS) |
| 32 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 33 | LOCAL_MODULE_PATH := $(3) |
| 34 | LOCAL_DEX_PREOPT_IMAGE := $(TARGET_CORE_IMG_OUT) |
| 35 | LOCAL_DEX_PREOPT := false |
| 36 | include $(BUILD_JAVA_LIBRARY) |
| 37 | ART_TEST_TARGET_DEX_FILES += $(3)/$$(LOCAL_MODULE).jar |
| 38 | endif |
Brian Carlstrom | b279337 | 2012-03-17 18:27:16 -0700 | [diff] [blame] | 39 | |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 40 | ifeq ($(ART_BUILD_HOST),true) |
| 41 | include $(CLEAR_VARS) |
| 42 | LOCAL_MODULE := $(1)-$(2) |
| 43 | LOCAL_SRC_FILES := $(call all-java-files-under, test/$(2)) |
| 44 | LOCAL_JAVA_LIBRARIES := $(HOST_CORE_JARS) |
| 45 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 46 | LOCAL_DEX_PREOPT_IMAGE := $(HOST_CORE_IMG_OUT) |
| 47 | LOCAL_BUILD_HOST_DEX := true |
| 48 | include $(BUILD_HOST_JAVA_LIBRARY) |
| 49 | ART_TEST_HOST_DEX_FILES += $$(LOCAL_MODULE_PATH)/$$(LOCAL_MODULE).jar |
| 50 | endif |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 51 | endef |
jeffhao | 50808a3 | 2012-05-30 17:03:05 -0700 | [diff] [blame] | 52 | $(foreach dir,$(TEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,art-test-dex,$(dir),$(ART_NATIVETEST_OUT)))) |
| 53 | $(foreach dir,$(TEST_OAT_DIRECTORIES), $(eval $(call build-art-test-dex,oat-test-dex,$(dir),$(ART_TEST_OUT)))) |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 54 | |
| 55 | ######################################################################## |
| 56 | |
Brian Carlstrom | b279337 | 2012-03-17 18:27:16 -0700 | [diff] [blame] | 57 | ART_TEST_TARGET_OAT_TARGETS := |
| 58 | ART_TEST_HOST_OAT_TARGETS := |
Ian Rogers | 85d9ba6 | 2013-01-16 22:32:12 -0800 | [diff] [blame] | 59 | ART_TEST_HOST_INTERPRETER_OAT_TARGETS := |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 60 | |
| 61 | # $(1): directory |
| 62 | # $(2): arguments |
Brian Carlstrom | b279337 | 2012-03-17 18:27:16 -0700 | [diff] [blame] | 63 | define declare-test-art-oat-targets |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 64 | .PHONY: test-art-target-oat-$(1) |
Brian Carlstrom | 32b4b2a | 2012-01-31 16:21:40 -0800 | [diff] [blame] | 65 | test-art-target-oat-$(1): $(ART_TEST_OUT)/oat-test-dex-$(1).jar test-art-target-sync |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 66 | adb shell touch $(ART_TEST_DIR)/test-art-target-oat-$(1) |
| 67 | adb shell rm $(ART_TEST_DIR)/test-art-target-oat-$(1) |
Brian Carlstrom | 32b4b2a | 2012-01-31 16:21:40 -0800 | [diff] [blame] | 68 | adb shell sh -c "oatexecd -Ximage:$(ART_TEST_DIR)/core.art -classpath $(ART_TEST_DIR)/oat-test-dex-$(1).jar -Djava.library.path=$(ART_TEST_DIR) $(1) $(2) && touch $(ART_TEST_DIR)/test-art-target-oat-$(1)" |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 69 | $(hide) (adb pull $(ART_TEST_DIR)/test-art-target-oat-$(1) /tmp/ && echo test-art-target-oat-$(1) PASSED) || (echo test-art-target-oat-$(1) FAILED && exit 1) |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 70 | $(hide) rm /tmp/test-art-target-oat-$(1) |
| 71 | |
Brian Carlstrom | 38a3a0c | 2013-02-06 16:47:36 -0800 | [diff] [blame] | 72 | $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar.oat: $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar $(HOST_CORE_IMG_OUT) | $(DEX2OAT) |
Brian Carlstrom | 3f47c12 | 2013-03-07 00:02:40 -0800 | [diff] [blame] | 73 | $(DEX2OAT) --runtime-arg -Xms16m --runtime-arg -Xmx16m --boot-image=$(HOST_CORE_IMG_OUT) --dex-file=$$< --oat-file=$$@ --instruction-set=$(HOST_ARCH) --host --host-prefix="" --android-root=$(HOST_OUT) |
Brian Carlstrom | 38a3a0c | 2013-02-06 16:47:36 -0800 | [diff] [blame] | 74 | |
Brian Carlstrom | b279337 | 2012-03-17 18:27:16 -0700 | [diff] [blame] | 75 | .PHONY: test-art-host-oat-$(1) |
Brian Carlstrom | 38a3a0c | 2013-02-06 16:47:36 -0800 | [diff] [blame] | 76 | test-art-host-oat-$(1): $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar.oat test-art-host-dependencies |
Brian Carlstrom | b279337 | 2012-03-17 18:27:16 -0700 | [diff] [blame] | 77 | mkdir -p /tmp/android-data/test-art-host-oat-$(1) |
| 78 | ANDROID_DATA=/tmp/android-data/test-art-host-oat-$(1) \ |
| 79 | ANDROID_ROOT=$(HOST_OUT) \ |
| 80 | LD_LIBRARY_PATH=$(HOST_OUT_SHARED_LIBRARIES) \ |
Brian Carlstrom | 5d93cf9 | 2012-06-12 12:05:05 -0700 | [diff] [blame] | 81 | oatexecd -Ximage:$(shell pwd)/$(HOST_CORE_IMG_OUT) -classpath $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar -Djava.library.path=$(HOST_OUT_SHARED_LIBRARIES) $(1) $(2) \ |
| 82 | && echo test-art-host-oat-$(1) PASSED || (echo test-art-host-oat-$(1) FAILED && exit 1) |
Brian Carlstrom | 3bbbe82 | 2012-03-17 23:22:53 -0700 | [diff] [blame] | 83 | $(hide) rm -r /tmp/android-data/test-art-host-oat-$(1) |
Brian Carlstrom | b279337 | 2012-03-17 18:27:16 -0700 | [diff] [blame] | 84 | |
Ian Rogers | 85d9ba6 | 2013-01-16 22:32:12 -0800 | [diff] [blame] | 85 | .PHONY: test-art-host-interpreter-oat-$(1) |
Brian Carlstrom | 38a3a0c | 2013-02-06 16:47:36 -0800 | [diff] [blame] | 86 | test-art-host-interpreter-oat-$(1): $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar.oat test-art-host-dependencies |
Ian Rogers | 85d9ba6 | 2013-01-16 22:32:12 -0800 | [diff] [blame] | 87 | mkdir -p /tmp/android-data/test-art-host-interpreter-oat-$(1) |
Ian Rogers | 85d9ba6 | 2013-01-16 22:32:12 -0800 | [diff] [blame] | 88 | ANDROID_DATA=/tmp/android-data/test-art-host-interpreter-oat-$(1) \ |
| 89 | ANDROID_ROOT=$(HOST_OUT) \ |
| 90 | LD_LIBRARY_PATH=$(HOST_OUT_SHARED_LIBRARIES) \ |
| 91 | oatexecd -Ximage:$(shell pwd)/$(HOST_CORE_IMG_OUT) -Xint -classpath $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar -Djava.library.path=$(HOST_OUT_SHARED_LIBRARIES) $(1) $(2) \ |
| 92 | && echo test-art-host-interpreter-oat-$(1) PASSED || (echo test-art-host-interpreter-oat-$(1) FAILED && exit 1) |
| 93 | $(hide) rm -r /tmp/android-data/test-art-host-interpreter-oat-$(1) |
Brian Carlstrom | b279337 | 2012-03-17 18:27:16 -0700 | [diff] [blame] | 94 | |
| 95 | ART_TEST_TARGET_OAT_TARGETS += test-art-target-oat-$(1) |
| 96 | ART_TEST_HOST_OAT_TARGETS += test-art-host-oat-$(1) |
Ian Rogers | 85d9ba6 | 2013-01-16 22:32:12 -0800 | [diff] [blame] | 97 | ART_TEST_HOST_INTERPRETER_OAT_TARGETS += test-art-host-interpreter-oat-$(1) |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 98 | endef |
Brian Carlstrom | b279337 | 2012-03-17 18:27:16 -0700 | [diff] [blame] | 99 | $(foreach dir,$(TEST_OAT_DIRECTORIES), $(eval $(call declare-test-art-oat-targets,$(dir)))) |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 100 | |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 101 | ######################################################################## |