Skip to content

Commit 34a7c82

Browse files
Steven Jacksonmetan-ucw
Steven Jackson
authored andcommittedJan 31, 2017
android: exclude tests which don't build
Android's NDK is missing many features. It implements s subset of libpthread and librt, but they'res contained in libc. Rather than forcing existing and future tests to use a conditional or variable to add -lpthread I've just created a stub library. Tests which don't work have been filtered out based on $(ANDROID) being set, eventually they should be filtered via autotools checks. In most cases I've excluded entire directories when only a few tests fail, it's going to take time to go through them all and the patch would touch too much of the code base in one go. Signed-off-by: Steven Jackson <sj@oscode.net> Acked-by: Cyril Hrubis <chrubis@suse.cz>
1 parent 9f41dcf commit 34a7c82

File tree

19 files changed

+99
-0
lines changed

19 files changed

+99
-0
lines changed
 

‎INSTALL

+7
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,13 @@ uClinux Users
250250
Specify UCLINUX=1 when calling make; -DUCLINUX=1 use is deprecated and highly
251251
discouraged.
252252

253+
Android Users
254+
-------------
255+
Specify ANDROID=1 when calling make. Many tests which would otherwise work are
256+
currently not built because they share a directory with an incompatible test.
257+
258+
The shell scripts expect /bin/sh to exist, so create a symlink.
259+
253260
Variables in Makefile
254261
----------------------
255262

‎include/mk/env_post.mk

+9
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ ifeq ($(UCLINUX),1)
4141
CPPFLAGS += -D__UCLIBC__ -DUCLINUX
4242
endif
4343

44+
ifeq ($(ANDROID),1)
45+
# There are many undeclared functions, it's best not to accidentally overlook
46+
# them.
47+
CFLAGS += -Werror-implicit-function-declaration
48+
49+
LDFLAGS += -L$(top_builddir)/lib/android_libpthread
50+
LDFLAGS += -L$(top_builddir)/lib/android_librt
51+
endif
52+
4453
MAKE_TARGETS ?= $(notdir $(patsubst %.c,%,$(wildcard $(abs_srcdir)/*.c)))
4554

4655
MAKE_TARGETS := $(filter-out $(FILTER_OUT_MAKE_TARGETS),$(MAKE_TARGETS))

‎lib/Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ include $(top_srcdir)/include/mk/env_pre.mk
2626

2727
CFLAGS += -I.
2828

29+
ifneq ($(ANDROID),1)
30+
FILTER_OUT_DIRS += android_libpthread android_librt
31+
else
32+
FILTER_OUT_LIBSRCS += tlibio.c tst_path_has_mnt_flags.c
33+
endif
34+
2935
LIB := libltp.a
3036

3137
pc_file := $(DESTDIR)/$(datarootdir)/pkgconfig/ltp.pc

‎lib/newlib_tests/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@ LDLIBS += -lltp
88
test08: CFLAGS+=-pthread
99
test09: CFLAGS+=-pthread
1010

11+
ifeq ($(ANDROID),1)
12+
FILTER_OUT_MAKE_TARGETS += test08
13+
endif
14+
15+
1116
include $(top_srcdir)/include/mk/generic_leaf_target.mk

‎lib/tst_res.c

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ int TEST_ERRNO;
8080
assert(strlen(buf) > 0); \
8181
} while (0)
8282

83+
#if defined(__ANDROID__) && !defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
84+
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
85+
#endif
86+
8387
static pthread_mutex_t tmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
8488

8589
static void check_env(void);

‎testcases/kernel/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ endif
6161

6262
endif
6363

64+
ifeq ($(ANDROID),1)
65+
FILTER_OUT_DIRS += containers controllers device-drivers fs io ipc mem \
66+
sched security timers
67+
endif
68+
6469
MAKE_DEPS := include/linux_syscall_numbers.h
6570

6671
include:

‎testcases/kernel/syscalls/Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,16 @@ ifeq ($(UCLIBC),1)
3333
FILTER_OUT_DIRS += profil
3434
endif
3535

36+
ifeq ($(ANDROID), 1)
37+
FILTER_OUT_DIRS += \
38+
accept4 adjtimex cma confstr fcntl fmtmsg futex getcontext getcpu \
39+
getdomainname getdtablesize gethostid getgroups get_mempolicy ipc \
40+
linkat kill mallopt memmap mq_notify mq_open mq_timedreceive \
41+
mq_timedsend mq_unlink mmap mremap open openat profil ptrace quotactl \
42+
readahead remap_file_pages rt_sigsuspend rt_sigtimedwait \
43+
sched_getaffinity sched_setaffinity sendmsg setgroups setns sighold \
44+
sigrelse sigsuspend sigtimedwait sigwait sigwaitinfo stime \
45+
setdomainname sethostname symlinkat ulimit ustat vfork vhangup vmsplice
46+
endif
47+
3648
include $(top_srcdir)/include/mk/generic_trunk_target.mk

‎testcases/kernel/syscalls/creat/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ top_srcdir ?= ../../../..
2020

2121
include $(top_srcdir)/include/mk/testcases.mk
2222

23+
ifeq ($(ANDROID),1)
24+
FILTER_OUT_MAKE_TARGETS += creat05
25+
endif
26+
2327
include $(top_srcdir)/include/mk/generic_leaf_target.mk

‎testcases/kernel/syscalls/dup/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ top_srcdir ?= ../../../..
2020

2121
include $(top_srcdir)/include/mk/testcases.mk
2222

23+
ifeq ($(ANDROID), 1)
24+
FILTER_OUT_MAKE_TARGETS += dup06
25+
endif
26+
2327
include $(top_srcdir)/include/mk/generic_leaf_target.mk

‎testcases/kernel/syscalls/dup2/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ top_srcdir ?= ../../../..
2020

2121
include $(top_srcdir)/include/mk/testcases.mk
2222

23+
ifeq ($(ANDROID),1)
24+
FILTER_OUT_MAKE_TARGETS += dup201 dup205
25+
endif
26+
2327
include $(top_srcdir)/include/mk/generic_leaf_target.mk

‎testcases/kernel/syscalls/gettid/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ top_srcdir ?= ../../../..
2424

2525
include $(top_srcdir)/include/mk/testcases.mk
2626

27+
ifeq ($(ANDROID), 1)
28+
FILTER_OUT_MAKE_TARGETS += gettid01
29+
endif
30+
2731
include $(top_srcdir)/include/mk/generic_leaf_target.mk

‎testcases/kernel/syscalls/ioctl/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,8 @@ include $(top_srcdir)/include/mk/testcases.mk
2222

2323
INSTALL_TARGETS += test_ioctl
2424

25+
ifeq ($(ANDROID),1)
26+
FILTER_OUT_MAKE_TARGETS += ioctl02
27+
endif
28+
2529
include $(top_srcdir)/include/mk/generic_leaf_target.mk

‎testcases/kernel/syscalls/pipe/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ top_srcdir ?= ../../../..
2020

2121
include $(top_srcdir)/include/mk/testcases.mk
2222

23+
ifeq ($(ANDROID),1)
24+
FILTER_OUT_MAKE_TARGETS += pipe06 pipe07
25+
endif
26+
2327
include $(top_srcdir)/include/mk/generic_leaf_target.mk

‎testcases/kernel/syscalls/setrlimit/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ top_srcdir ?= ../../../..
2020

2121
include $(top_srcdir)/include/mk/testcases.mk
2222

23+
ifeq ($(ANDROID),1)
24+
FILTER_OUT_MAKE_TARGETS += setrlimit01
25+
endif
26+
2327
include $(top_srcdir)/include/mk/generic_leaf_target.mk

‎testcases/misc/math/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222

2323
top_srcdir ?= ../../..
2424

25+
ifeq ($(ANDROID),1)
26+
FILTER_OUT_DIRS := abs float
27+
endif
28+
2529
include $(top_srcdir)/include/mk/env_pre.mk
2630

2731
include $(top_srcdir)/include/mk/generic_trunk_target.mk

‎testcases/network/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ INSTALL_TARGETS += $(addprefix $(DIR)/bin.,sm med lg jmb)
3535

3636
RM += -r
3737

38+
ifeq ($(ANDROID),1)
39+
FILTER_OUT_DIRS += lib6 rpc sockets
40+
endif
41+
3842
$(INSTALL_TARGETS): | generate
3943

4044
.PHONY: generate

‎testcases/network/multicast/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@
2323
top_srcdir ?= ../../..
2424

2525
include $(top_srcdir)/include/mk/env_pre.mk
26+
27+
ifeq ($(ANDROID),1)
28+
FILTER_OUT_DIRS += mc_gethost
29+
endif
30+
2631
include $(top_srcdir)/include/mk/generic_trunk_target.mk

‎testcases/network/stress/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@
2323
top_srcdir ?= ../../..
2424

2525
include $(top_srcdir)/include/mk/env_pre.mk
26+
27+
ifeq ($(ANDROID), 1)
28+
FILTER_OUT_DIRS += ns-tools
29+
endif
30+
2631
include $(top_srcdir)/include/mk/generic_trunk_target.mk

‎utils/benchmark/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@
2121
top_srcdir ?= ../..
2222

2323
include $(top_srcdir)/include/mk/env_pre.mk
24+
25+
ifeq ($(ANDROID),1)
26+
FILTER_OUT_DIRS += ebizzy-0.3
27+
endif
28+
2429
include $(top_srcdir)/include/mk/generic_trunk_target.mk

0 commit comments

Comments
 (0)
Please sign in to comment.