blob: 1957971f416c0993a8b16a2b5852b71d5605a7c7 [file] [log] [blame]
Brian Carlstrombbf1e412011-09-18 14:14:51 -07001#
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
19ART_TEST_DEX_FILES :=
20
21# $(1): directory
22define 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
31endef
32$(foreach dir,$(TEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,$(dir))))
33
34########################################################################
35
Brian Carlstrombc2f3e32011-09-22 17:16:54 -070036# $(1): input jar or apk filename
Brian Carlstrom27ec9612011-09-19 20:20:38 -070037# $(2): boot oat
38# $(3): boot dex files
39define build-art-oat
Brian Carlstrombc2f3e32011-09-22 17:16:54 -070040# 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 Carlstrom27ec9612011-09-19 20:20:38 -070042 @echo "target dex2oat: $$@ ($$<)"
43 $(hide) $(DEX2OAT) -Xms16m -Xmx16m $(addprefix --boot-dex-file=,$(3)) --boot=$(2) $(addprefix --dex-file=,$$<) --image=$$@ --strip-prefix=$(PRODUCT_OUT)
44endef
45
46########################################################################
Brian Carlstrombbf1e412011-09-18 14:14:51 -070047ART_TEST_OAT_FILES :=
48
49# $(1): directory
50define build-art-test-oat
Brian Carlstrombc2f3e32011-09-22 17:16:54 -070051 $(call build-art-oat,$(TARGET_OUT_JAVA_LIBRARIES)/art-test-dex-$(1).jar,$(TARGET_CORE_OAT),$(TARGET_CORE_DEX))
Brian Carlstrom27ec9612011-09-19 20:20:38 -070052 ART_TEST_OAT_FILES += $(TARGET_OUT_JAVA_LIBRARIES)/art-test-dex-$(1).oat
Brian Carlstrombbf1e412011-09-18 14:14:51 -070053endef
54$(foreach dir,$(TEST_DEX_DIRECTORIES), $(eval $(call build-art-test-oat,$(dir))))
55
56########################################################################
57
58ART_TEST_OAT_TARGETS :=
59
60# $(1): directory
61# $(2): arguments
62define declare-test-test-target
63.PHONY: test-art-target-oat-$(1)
64test-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 Carlstrom27ec9612011-09-19 20:20:38 -070067 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 Carlstrombbf1e412011-09-18 14:14:51 -070068 $(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
71ART_TEST_OAT_TARGETS += test-art-target-oat-$(1)
72endef
73
74$(eval $(call declare-test-test-target,HelloWorld,))
75$(eval $(call declare-test-test-target,Fibonacci,10))
buzbeec0fe6c72011-09-18 20:19:14 -070076$(eval $(call declare-test-test-target,IntMath,))
Brian Carlstrom25c33252011-09-18 15:58:35 -070077$(eval $(call declare-test-test-target,Invoke,))
Brian Carlstrombbf1e412011-09-18 14:14:51 -070078$(eval $(call declare-test-test-target,ExceptionTest,))
Elliott Hughes29f27422011-09-18 16:02:18 -070079$(eval $(call declare-test-test-target,SystemMethods,))
Shih-wei Liao9407c602011-09-16 10:36:43 -070080# 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 Carlstrombbf1e412011-09-18 14:14:51 -070083
Shih-wei Liao97731202011-09-27 15:00:09 -070084# TODO: Re-enable this when RegisterMap is working for thread run.
85# $(eval $(call declare-test-test-target,MemUsage,))
Shih-wei Liao8ab83282011-09-25 00:05:53 -070086
Brian Carlstrombbf1e412011-09-18 14:14:51 -070087########################################################################