• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2007 The Android Open Source Project
2
3LOCAL_PATH:= $(call my-dir)
4include $(CLEAR_VARS)
5
6# List of test cases.  Note that closures are not supported on ARM, so
7# none of "closure*" or "cls*" will work there.
8FFI_TEST_BASE := $(LOCAL_PATH)
9FFI_TEST_FILES := \
10		closure_fn0.c \
11		closure_fn1.c \
12		closure_fn2.c \
13		closure_fn3.c \
14		closure_fn4.c \
15		closure_fn5.c \
16		closure_fn6.c \
17		cls_12byte.c \
18		cls_16byte.c \
19		cls_18byte.c \
20		cls_19byte.c \
21		cls_1_1byte.c \
22		cls_20byte.c \
23		cls_20byte1.c \
24		cls_24byte.c \
25		cls_2byte.c \
26		cls_3_1byte.c \
27		cls_3byte1.c \
28		cls_3byte2.c \
29		cls_4_1byte.c \
30		cls_4byte.c \
31		cls_5_1_byte.c \
32		cls_5byte.c \
33		cls_64byte.c \
34		cls_6_1_byte.c \
35		cls_6byte.c \
36		cls_7_1_byte.c \
37		cls_7byte.c \
38		cls_8byte.c \
39		cls_9byte1.c \
40		cls_9byte2.c \
41		cls_align_double.c \
42		cls_align_float.c \
43		cls_align_longdouble.c \
44		cls_align_pointer.c \
45		cls_align_sint16.c \
46		cls_align_sint32.c \
47		cls_align_sint64.c \
48		cls_align_uint16.c \
49		cls_align_uint32.c \
50		cls_align_uint64.c \
51		cls_double.c \
52		cls_float.c \
53		cls_multi_schar.c \
54		cls_multi_sshort.c \
55		cls_multi_sshortchar.c \
56		cls_multi_uchar.c \
57		cls_multi_ushort.c \
58		cls_multi_ushortchar.c \
59		cls_schar.c \
60		cls_sint.c \
61		cls_sshort.c \
62		cls_uchar.c \
63		cls_uint.c \
64		cls_ulonglong.c \
65		cls_ushort.c \
66		float.c \
67		float1.c \
68		float2.c \
69		float3.c \
70		float4.c \
71		many.c \
72		negint.c \
73		nested_struct.c \
74		nested_struct1.c \
75		nested_struct10.c \
76		nested_struct2.c \
77		nested_struct3.c \
78		nested_struct4.c \
79		nested_struct5.c \
80		nested_struct6.c \
81		nested_struct7.c \
82		nested_struct8.c \
83		nested_struct9.c \
84		problem1.c \
85		promotion.c \
86		pyobjc-tc.c \
87		return_dbl.c \
88		return_dbl1.c \
89		return_dbl2.c \
90		return_fl.c \
91		return_fl1.c \
92		return_fl2.c \
93		return_fl3.c \
94		return_ll.c \
95		return_ll1.c \
96		return_sc.c \
97		return_uc.c \
98		return_ul.c \
99		strlen.c \
100		struct1.c \
101		struct2.c \
102		struct3.c \
103		struct4.c \
104		struct5.c \
105		struct6.c \
106		struct7.c \
107		struct8.c \
108		struct9.c
109
110#		many_win32.c \
111#		strlen_win32.c \
112#
113
114# define this to make it stop on the first error
115#FFI_EXIT := exit 1
116FFI_EXIT := true
117
118#
119# Build and run each test individually.  This doesn't work for device builds.
120# The alternative is to build and install all of the little tests on the
121# device, but that seems silly.
122#
123ffitests:
124	@echo "Testing with LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) /tmp/android-ffi-test"
125	@(for file in $(FFI_TEST_FILES); do \
126		echo -n $$file ;\
127		$(CC) -g -Iexternal/libffi/$(TARGET_OS)-$(TARGET_ARCH) \
128			-o /tmp/android-ffi-test \
129			$(FFI_TEST_BASE)/libffi.call/$$file \
130			-L$(TARGET_OUT_SHARED_LIBRARIES) -lffi ;\
131		LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) /tmp/android-ffi-test > /tmp/android-ffi-out ;\
132		if [ "$$?" -eq 0 ]; then \
133		    echo " OK" ;\
134		else \
135		    echo " FAIL" ;\
136			cat /tmp/android-ffi-out ;\
137			$(FFI_EXIT) ;\
138		fi ;\
139		done ;\
140	)
141	rm -f /tmp/android-ffi-test
142
143#
144# Build and install one test, so we have something to try on the device.
145#
146LOCAL_MODULE := ffitest_struct5
147LOCAL_SRC_FILES := libffi.call/struct5.c
148LOCAL_C_INCLUDES := external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
149LOCAL_SHARED_LIBRARIES := libffi
150
151LOCAL_MODULE_TAGS := tests
152
153include $(BUILD_EXECUTABLE)
154