1# Copyright (C) 2014 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH := $(call my-dir)
16include $(CLEAR_VARS)
17
18# shim classes. We use one that exposes the common functionality.
19LOCAL_SHIM_CLASSES := \
20  src/902-hello-transformation/src/art/Redefinition.java \
21  src/903-hello-tagging/src/art/Main.java \
22  src/989-method-trace-throw/src/art/Trace.java \
23  src/993-breakpoints/src/art/Breakpoint.java \
24  src/1902-suspend/src/art/Suspension.java \
25  src/1911-get-local-var-table/src/art/Locals.java \
26  src/1912-get-set-local-primitive/src/art/StackTrace.java \
27  src/1923-frame-pop/src/art/FramePop.java \
28  src/1927-exception-event/src/art/Exceptions.java \
29  src/1930-monitor-info/src/art/Monitors.java \
30  src/1934-jvmti-signal-thread/src/art/Threads.java \
31
32LOCAL_SRC_FILES := $(LOCAL_SHIM_CLASSES)
33
34# Actual test classes.
35LOCAL_SRC_FILES += \
36  src/901-hello-ti-agent/src/art/Test901.java \
37  src/902-hello-transformation/src/art/Test902.java \
38  src/903-hello-tagging/src/art/Test903.java \
39  src/904-object-allocation/src/art/Test904.java \
40  src/905-object-free/src/art/Test905.java \
41  src/906-iterate-heap/src/art/Test906.java \
42  src/907-get-loaded-classes/src/art/Test907.java \
43    src/907-get-loaded-classes/src/art/Cerr.java \
44  src/908-gc-start-finish/src/art/Test908.java \
45  src/910-methods/src/art/Test910.java \
46  src/911-get-stack-trace/src/art/Test911.java \
47    src/911-get-stack-trace/src/art/AllTraces.java \
48    src/911-get-stack-trace/src/art/ControlData.java \
49    src/911-get-stack-trace/src/art/Frames.java \
50    src/911-get-stack-trace/src/art/OtherThread.java \
51    src/911-get-stack-trace/src/art/PrintThread.java \
52    src/911-get-stack-trace/src/art/Recurse.java \
53    src/911-get-stack-trace/src/art/SameThread.java \
54    src/911-get-stack-trace/src/art/ThreadListTraces.java \
55  src/912-classes/src-art/art/Test912.java \
56    src/912-classes/src-art/art/DexData.java \
57  src/913-heaps/src/art/Test913.java \
58  src/914-hello-obsolescence/src/art/Test914.java \
59  src/915-obsolete-2/src/art/Test915.java \
60  src/917-fields-transformation/src/art/Test917.java \
61  src/918-fields/src/art/Test918.java \
62  src/919-obsolete-fields/src/art/Test919.java \
63  src/920-objects/src/art/Test920.java \
64  src/922-properties/src/art/Test922.java \
65  src/923-monitors/src/art/Test923.java \
66  src/924-threads/src/art/Test924.java \
67  src/925-threadgroups/src/art/Test925.java \
68  src/926-multi-obsolescence/src/art/Test926.java \
69  src/927-timers/src/art/Test927.java \
70  src/928-jni-table/src/art/Test928.java \
71  src/930-hello-retransform/src/art/Test930.java \
72  src/931-agent-thread/src/art/Test931.java \
73  src/932-transform-saves/src/art/Test932.java \
74  src/933-misc-events/src/art/Test933.java \
75  src/940-recursive-obsolete/src/art/Test940.java \
76  src/942-private-recursive/src/art/Test942.java \
77  src/944-transform-classloaders/src/art/Test944.java \
78  src/945-obsolete-native/src/art/Test945.java \
79  src/947-reflect-method/src/art/Test947.java \
80  src/951-threaded-obsolete/src/art/Test951.java \
81  src/982-ok-no-retransform/src/art/Test982.java \
82  src/983-source-transform-verify/src/art/Test983.java \
83  src/984-obsolete-invoke/src/art/Test984.java \
84  src/985-re-obsolete/src/art/Test985.java \
85  src/986-native-method-bind/src/art/Test986.java \
86  src/988-method-trace/src/art/Test988.java \
87    src/988-method-trace/src/art/Test988Intrinsics.java \
88  src/989-method-trace-throw/src/art/Test989.java \
89  src/990-field-trace/src/art/Test990.java \
90  src/991-field-trace-2/src/art/Test991.java \
91  src/992-source-data/src/art/Test992.java \
92    src/992-source-data/src/art/Target2.java \
93  src/993-breakpoints/src/art/Test993.java \
94  src/994-breakpoint-line/src/art/Test994.java \
95  src/995-breakpoints-throw/src/art/Test995.java \
96  src/996-breakpoint-obsolete/src/art/Test996.java \
97  src/997-single-step/src/art/Test997.java \
98  src/1900-track-alloc/src/art/Test1900.java \
99  src/1901-get-bytecodes/src/art/Test1901.java \
100  src/1902-suspend/src/art/Test1902.java \
101  src/1903-suspend-self/src/art/Test1903.java \
102  src/1904-double-suspend/src/art/Test1904.java \
103  src/1906-suspend-list-me-first/src/art/Test1906.java \
104  src/1907-suspend-list-self-twice/src/art/Test1907.java \
105  src/1908-suspend-native-resume-self/src/art/Test1908.java \
106  src/1909-per-agent-tls/src/art/Test1909.java \
107  src/1910-transform-with-default/src/art/Test1910.java \
108  src/1911-get-local-var-table/src/art/Test1911.java \
109  src/1912-get-set-local-primitive/src/art/Test1912.java \
110  src/1913-get-set-local-objects/src/art/Test1913.java \
111  src/1914-get-local-instance/src/art/Test1914.java \
112  src/1915-get-set-local-current-thread/src/art/Test1915.java \
113  src/1916-get-set-current-frame/src/art/Test1916.java \
114  src/1917-get-stack-frame/src/art/Test1917.java \
115  src/1920-suspend-native-monitor/src/art/Test1920.java \
116  src/1921-suspend-native-recursive-monitor/src/art/Test1921.java \
117  src/1922-owned-monitors-info/src/art/Test1922.java \
118  src/1923-frame-pop/src/art/Test1923.java \
119  src/1924-frame-pop-toggle/src/art/Test1924.java \
120  src/1925-self-frame-pop/src/art/Test1925.java \
121  src/1926-missed-frame-pop/src/art/Test1926.java \
122  src/1927-exception-event/src/art/Test1927.java \
123  src/1928-exception-event-exception/src/art/Test1928.java \
124  src/1930-monitor-info/src/art/Test1930.java \
125  src/1931-monitor-events/src/art/Test1931.java \
126  src/1932-monitor-events-misc/src/art/Test1932.java \
127  src/1933-monitor-current-contended/src/art/Test1933.java \
128  src/1934-jvmti-signal-thread/src/art/Test1934.java \
129  src/1936-thread-end-events/src/art/Test1936.java \
130  src/1937-transform-soft-fail/src/art/Test1937.java \
131  src/1939-proxy-frames/src/art/Test1939.java \
132  src/1941-dispose-stress/src/art/Test1941.java \
133  src/1942-suspend-raw-monitor-exit/src/art/Test1942.java \
134  src/1943-suspend-raw-monitor-wait/src/art/Test1943.java \
135
136JVMTI_RUN_TEST_GENERATED_NUMBERS := \
137  901 \
138  902 \
139  903 \
140  904 \
141  905 \
142  906 \
143  907 \
144  908 \
145  910 \
146  911 \
147  912 \
148  913 \
149  914 \
150  915 \
151  917 \
152  918 \
153  919 \
154  920 \
155  922 \
156  923 \
157  924 \
158  925 \
159  926 \
160  927 \
161  928 \
162  930 \
163  931 \
164  932 \
165  933 \
166  940 \
167  942 \
168  944 \
169  945 \
170  947 \
171  951 \
172  982 \
173  983 \
174  984 \
175  985 \
176  986 \
177  988 \
178  989 \
179  990 \
180  991 \
181  992 \
182  993 \
183  994 \
184  995 \
185  996 \
186  997 \
187  1900 \
188  1901 \
189  1902 \
190  1903 \
191  1904 \
192  1906 \
193  1907 \
194  1908 \
195  1909 \
196  1910 \
197  1911 \
198  1912 \
199  1913 \
200  1914 \
201  1915 \
202  1916 \
203  1917 \
204  1920 \
205  1921 \
206  1922 \
207  1923 \
208  1924 \
209  1925 \
210  1926 \
211  1927 \
212  1928 \
213  1930 \
214  1931 \
215  1932 \
216  1933 \
217  1934 \
218  1936 \
219  1937 \
220  1939 \
221  1941 \
222  1942 \
223  1943 \
224
225# Try to enforce that the directories correspond to the Java files we pull in.
226JVMTI_RUN_TEST_DIR_CHECK := $(sort $(foreach DIR,$(addprefix src/,$(JVMTI_RUN_TEST_GENERATED_NUMBERS)), \
227  $(filter $(DIR)%,$(LOCAL_SRC_FILES))))
228ifneq ($(sort $(LOCAL_SRC_FILES)),$(JVMTI_RUN_TEST_DIR_CHECK))
229  $(error Missing file, compare $(sort $(LOCAL_SRC_FILES)) with $(JVMTI_RUN_TEST_DIR_CHECK))
230endif
231
232LOCAL_MODULE_CLASS := JAVA_LIBRARIES
233LOCAL_MODULE_TAGS := optional
234LOCAL_JAVA_LANGUAGE_VERSION := 1.8
235LOCAL_MODULE := run-test-jvmti-java
236
237GENERATED_SRC_DIR := $(call local-generated-sources-dir)
238JVMTI_RUN_TEST_GENERATED_FILES := \
239  $(foreach NR,$(JVMTI_RUN_TEST_GENERATED_NUMBERS),$(GENERATED_SRC_DIR)/results.$(NR).expected.txt)
240
241define GEN_JVMTI_RUN_TEST_GENERATED_FILE
242
243GEN_INPUT := $(wildcard $(LOCAL_PATH)/src/$(1)*/expected.txt)
244ifeq (true,$(ANDROID_COMPILE_WITH_JACK))
245GEN_EXTRA_DIFF := $(wildcard $(LOCAL_PATH)/src/$(1)*/expected_jack.diff)
246else ifeq (true,$(USE_D8))
247GEN_EXTRA_DIFF := $(wildcard $(LOCAL_PATH)/src/$(1)*/expected_d8.diff)
248else
249GEN_EXTRA_DIFF :=
250endif
251
252GEN_OUTPUT := $(GENERATED_SRC_DIR)/results.$(1).expected.txt
253$$(GEN_OUTPUT): PRIVATE_GEN_EXTRA_DIFF := $$(GEN_EXTRA_DIFF)
254$$(GEN_OUTPUT): $$(GEN_INPUT) $$(GEN_EXTRA_DIFF)
255	cp $$< $$@
256ifneq (,$$(GEN_EXTRA_DIFF))
257	(cd $$(dir $$@) && patch $$(notdir $$@)) < $$(PRIVATE_GEN_EXTRA_DIFF)
258endif
259
260GEN_INPUT :=
261GEN_OUTPUT :=
262
263endef
264
265$(foreach NR,$(JVMTI_RUN_TEST_GENERATED_NUMBERS),\
266  $(eval $(call GEN_JVMTI_RUN_TEST_GENERATED_FILE,$(NR))))
267LOCAL_JAVA_RESOURCE_FILES := $(JVMTI_RUN_TEST_GENERATED_FILES)
268
269# Avoid linking against any @hide APIs.
270LOCAL_SDK_VERSION := current
271
272include $(BUILD_JAVA_LIBRARY)
273
274include $(CLEAR_VARS)
275include $(call all-makefiles-under,$(LOCAL_PATH))
276