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 | |
| 19 | ART_TEST_DEX_FILES := |
| 20 | |
| 21 | # $(1): directory |
| 22 | define build-art-test-dex |
| 23 | include $(CLEAR_VARS) |
| 24 | LOCAL_MODULE := art-test-dex-$(1) |
| 25 | LOCAL_MODULE_TAGS := optional |
| 26 | LOCAL_SRC_FILES := $(call all-java-files-under, test/$(1)) |
| 27 | LOCAL_JAVA_LIBRARIES := core |
| 28 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 29 | include $(BUILD_JAVA_LIBRARY) |
| 30 | ART_TEST_DEX_FILES += $(TARGET_OUT_JAVA_LIBRARIES)/$$(LOCAL_MODULE).jar |
| 31 | endef |
| 32 | $(foreach dir,$(TEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,$(dir)))) |
| 33 | |
| 34 | ######################################################################## |
| 35 | |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 36 | # $(1): input jar or apk filename |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 37 | # $(2): boot oat |
| 38 | # $(3): boot dex files |
| 39 | define build-art-oat |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 40 | # TODO: change DEX2OATD (and perhaps $(2) boot oat) to order-only prerequisite when output is stable |
| 41 | $(patsubst %.apk,%.oat,$(patsubst %.jar,%.oat,$(1))): $(1) $(2) $(DEX2OAT) |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 42 | @echo "target dex2oat: $$@ ($$<)" |
| 43 | $(hide) $(DEX2OAT) -Xms16m -Xmx16m $(addprefix --boot-dex-file=,$(3)) --boot=$(2) $(addprefix --dex-file=,$$<) --image=$$@ --strip-prefix=$(PRODUCT_OUT) |
| 44 | endef |
| 45 | |
| 46 | ######################################################################## |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 47 | ART_TEST_OAT_FILES := |
| 48 | |
| 49 | # $(1): directory |
| 50 | define build-art-test-oat |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 51 | $(call build-art-oat,$(TARGET_OUT_JAVA_LIBRARIES)/art-test-dex-$(1).jar,$(TARGET_CORE_OAT),$(TARGET_CORE_DEX)) |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 52 | ART_TEST_OAT_FILES += $(TARGET_OUT_JAVA_LIBRARIES)/art-test-dex-$(1).oat |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 53 | endef |
| 54 | $(foreach dir,$(TEST_DEX_DIRECTORIES), $(eval $(call build-art-test-oat,$(dir)))) |
| 55 | |
| 56 | ######################################################################## |
| 57 | |
| 58 | ART_TEST_OAT_TARGETS := |
| 59 | |
| 60 | # $(1): directory |
| 61 | # $(2): arguments |
| 62 | define declare-test-test-target |
| 63 | .PHONY: test-art-target-oat-$(1) |
| 64 | test-art-target-oat-$(1): test-art-target-sync |
| 65 | adb shell touch /sdcard/test-art-target-oat-$(1) |
| 66 | adb shell rm /sdcard/test-art-target-oat-$(1) |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 67 | adb shell sh -c "oatexecd -Xbootclasspath:/system/framework/core.jar -Xbootimage:/system/framework/core.oat -classpath /system/framework/art-test-dex-$(1).jar -Ximage:/system/framework/art-test-dex-$(1).oat $(1) $(2) && touch /sdcard/test-art-target-oat-$(1)" |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 68 | $(hide) (adb pull /sdcard/test-art-target-oat-$(1) /tmp/ && echo test-art-target-oat-$(1) PASSED) || (echo test-art-target-oat-$(1) FAILED && exit 1) |
| 69 | $(hide) rm /tmp/test-art-target-oat-$(1) |
| 70 | |
| 71 | ART_TEST_OAT_TARGETS += test-art-target-oat-$(1) |
| 72 | endef |
| 73 | |
| 74 | $(eval $(call declare-test-test-target,HelloWorld,)) |
| 75 | $(eval $(call declare-test-test-target,Fibonacci,10)) |
buzbee | c0fe6c7 | 2011-09-18 20:19:14 -0700 | [diff] [blame] | 76 | $(eval $(call declare-test-test-target,IntMath,)) |
Brian Carlstrom | 25c3325 | 2011-09-18 15:58:35 -0700 | [diff] [blame] | 77 | $(eval $(call declare-test-test-target,Invoke,)) |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 78 | $(eval $(call declare-test-test-target,ExceptionTest,)) |
Elliott Hughes | 29f2742 | 2011-09-18 16:02:18 -0700 | [diff] [blame] | 79 | $(eval $(call declare-test-test-target,SystemMethods,)) |
Shih-wei Liao | 9407c60 | 2011-09-16 10:36:43 -0700 | [diff] [blame] | 80 | # TODO: Re-enable the test when System.LoadLibrary is working. |
| 81 | # $(eval $(call declare-test-test-target,StackWalk,)) |
| 82 | # $(eval $(call declare-test-test-target,StackWalk2,)) |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 83 | |
Shih-wei Liao | 9773120 | 2011-09-27 15:00:09 -0700 | [diff] [blame] | 84 | # TODO: Re-enable this when RegisterMap is working for thread run. |
| 85 | # $(eval $(call declare-test-test-target,MemUsage,)) |
Shih-wei Liao | 8ab8328 | 2011-09-25 00:05:53 -0700 | [diff] [blame] | 86 | |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 87 | ######################################################################## |