• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1prefix ?= /usr
2datadir ?= $(prefix)/share
3
4INSTALL=install
5
6ifneq ($(MAKECMDGOALS),clean)
7include ../config-host.mak
8endif
9
10CPPFLAGS ?=
11
12override CPPFLAGS += \
13	-D_GNU_SOURCE \
14	-D__SANE_USERSPACE_TYPES__ \
15	-I../src/include/ \
16	-include ../config-host.h \
17	-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
18
19CFLAGS ?= -g -O3 -Wall -Wextra
20XCFLAGS = -Wno-unused-parameter -Wno-sign-compare
21
22ifdef CONFIG_HAVE_STRINGOP_OVERFLOW
23	XCFLAGS += -Wstringop-overflow=0
24endif
25
26ifdef CONFIG_HAVE_ARRAY_BOUNDS
27	XCFLAGS += -Warray-bounds=0
28endif
29
30CXXFLAGS ?= $(CFLAGS)
31override CFLAGS += $(XCFLAGS) -DLIBURING_BUILD_TEST
32override CXXFLAGS += $(XCFLAGS) -std=c++11 -DLIBURING_BUILD_TEST
33
34LDFLAGS ?=
35override LDFLAGS += -L../src/ -luring -lpthread
36
37# Please keep this list sorted alphabetically.
38test_srcs := \
39	232c93d07b74.c \
40	35fa71a030ca.c \
41	500f9fbadef8.c \
42	7ad0e4b2f83c.c \
43	8a9973408177.c \
44	917257daa0fe.c \
45	a0908ae19763.c \
46	a4c0b3decb33.c \
47	accept.c \
48	accept-link.c \
49	accept-non-empty.c \
50	accept-reuse.c \
51	accept-test.c \
52	across-fork.c \
53	b19062a56726.c \
54	b5837bd5311d.c \
55	bind-listen.c \
56	buf-ring.c \
57	buf-ring-nommap.c \
58	buf-ring-put.c \
59	ce593a6c480a.c \
60	close-opath.c \
61	connect.c \
62	connect-rep.c \
63	coredump.c \
64	cq-full.c \
65	cq-overflow.c \
66	cq-peek-batch.c \
67	cq-ready.c \
68	cq-size.c \
69	d4ae271dfaae.c \
70	d77a67ed5f27.c \
71	defer.c \
72	defer-taskrun.c \
73	defer-tw-timeout.c \
74	double-poll-crash.c \
75	drop-submit.c \
76	eeed8b54e0df.c \
77	empty-eownerdead.c \
78	eploop.c \
79	eventfd.c \
80	eventfd-disable.c \
81	eventfd-reg.c \
82	eventfd-ring.c \
83	evloop.c \
84	exec-target.c \
85	exit-no-cleanup.c \
86	fadvise.c \
87	fallocate.c \
88	fc2a85cb02ef.c \
89	fd-install.c \
90	fd-pass.c \
91	file-register.c \
92	files-exit-hang-poll.c \
93	files-exit-hang-timeout.c \
94	file-update.c \
95	file-verify.c \
96	fixed-buf-iter.c \
97	fixed-buf-merge.c \
98	fixed-hugepage.c \
99	fixed-link.c \
100	fixed-reuse.c \
101	fpos.c \
102	fsnotify.c \
103	fsync.c \
104	futex.c \
105	hardlink.c \
106	ignore-single-mmap.c \
107	init-mem.c \
108	io-cancel.c \
109	iopoll.c \
110	iopoll-leak.c \
111	iopoll-overflow.c \
112	io_uring_enter.c \
113	io_uring_passthrough.c \
114	io_uring_register.c \
115	io_uring_setup.c \
116	lfs-openat.c \
117	lfs-openat-write.c \
118	link.c \
119	link_drain.c \
120	link-timeout.c \
121	madvise.c \
122	mkdir.c \
123	msg-ring.c \
124	msg-ring-fd.c \
125	msg-ring-flags.c \
126	msg-ring-overflow.c \
127	multicqes_drain.c \
128	no-mmap-inval.c \
129	nolibc.c \
130	nop-all-sizes.c \
131	nop.c \
132	ooo-file-unreg.c \
133	openat2.c \
134	open-close.c \
135	open-direct-link.c \
136	open-direct-pick.c \
137	personality.c \
138	pipe-bug.c \
139	pipe-eof.c \
140	pipe-reuse.c \
141	poll.c \
142	poll-cancel.c \
143	poll-cancel-all.c \
144	poll-cancel-ton.c \
145	poll-link.c \
146	poll-many.c \
147	poll-mshot-overflow.c \
148	poll-mshot-update.c \
149	poll-race.c \
150	poll-race-mshot.c \
151	poll-ring.c \
152	poll-v-poll.c \
153	probe.c \
154	read-before-exit.c \
155	read-mshot.c \
156	read-mshot-empty.c \
157	read-write.c \
158	recv-msgall.c \
159	recv-msgall-stream.c \
160	recv-multishot.c \
161	reg-fd-only.c \
162	reg-hint.c \
163	reg-reg-ring.c \
164	regbuf-merge.c \
165	register-restrictions.c \
166	rename.c \
167	ringbuf-read.c \
168	ringbuf-status.c \
169	ring-leak2.c \
170	ring-leak.c \
171	rsrc_tags.c \
172	rw_merge_test.c \
173	self.c \
174	recvsend_bundle.c \
175	send_recv.c \
176	send_recvmsg.c \
177	send-zerocopy.c \
178	shared-wq.c \
179	short-read.c \
180	shutdown.c \
181	sigfd-deadlock.c \
182	single-issuer.c \
183	skip-cqe.c \
184	socket.c \
185	socket-io-cmd.c \
186	socket-getsetsock-cmd.c \
187	socket-rw.c \
188	socket-rw-eagain.c \
189	socket-rw-offset.c \
190	splice.c \
191	sq-full.c \
192	sq-full-cpp.cc \
193	sqpoll-disable-exit.c \
194	sqpoll-exec.c \
195	sq-poll-dup.c \
196	sqpoll-exit-hang.c \
197	sq-poll-kthread.c \
198	sq-poll-share.c \
199	sqpoll-sleep.c \
200	sq-space_left.c \
201	stdout.c \
202	submit-and-wait.c \
203	submit-link-fail.c \
204	submit-reuse.c \
205	symlink.c \
206	sync-cancel.c \
207	teardowns.c \
208	thread-exit.c \
209	timeout.c \
210	timeout-new.c \
211	truncate.c \
212	tty-write-dpoll.c \
213	unlink.c \
214	version.c \
215	waitid.c \
216	wakeup-hang.c \
217	wq-aff.c \
218	xattr.c \
219	# EOL
220
221all_targets :=
222include ../Makefile.quiet
223
224ifdef CONFIG_HAVE_STATX
225	test_srcs += statx.c
226else ifdef CONFIG_HAVE_GLIBC_STATX
227	test_srcs += statx.c
228endif
229all_targets += statx.t
230
231ifdef CONFIG_HAVE_CXX
232	test_srcs += sq-full-cpp.cc
233endif
234all_targets += sq-full-cpp.t
235
236
237test_targets := $(patsubst %.c,%,$(test_srcs))
238test_targets := $(patsubst %.cc,%,$(test_targets))
239run_test_targets := $(patsubst %,%.run_test,$(test_targets))
240test_targets := $(patsubst %,%.t,$(test_targets))
241all_targets += $(test_targets)
242helpers = helpers.o
243
244all: $(test_targets)
245
246helpers.o: helpers.c
247	$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
248
249LIBURING := $(shell if [ -e ../src/liburing.a ]; then echo ../src/liburing.a; fi)
250
251%.t: %.c $(helpers) helpers.h $(LIBURING)
252	$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(helpers) $(LDFLAGS)
253
254#
255# Clang++ is not happy with -Wmissing-prototypes:
256#
257#   cc1plus: warning: command-line option '-Wmissing-prototypes' \
258#   is valid for C/ObjC but not for C++
259#
260%.t: %.cc $(helpers) helpers.h $(LIBURING)
261	$(QUIET_CXX)$(CXX) \
262	$(patsubst -Wmissing-prototypes,,$(CPPFLAGS)) \
263	$(patsubst -Wmissing-prototypes,,$(CXXFLAGS)) \
264	-o $@ $< $(helpers) $(LDFLAGS)
265
266
267install: $(test_targets) runtests.sh runtests-loop.sh
268	$(INSTALL) -D -d -m 755 $(datadir)/liburing-test/
269	$(INSTALL) -D -m 755 $(test_targets) $(datadir)/liburing-test/
270	$(INSTALL) -D -m 755 runtests.sh  $(datadir)/liburing-test/
271	$(INSTALL) -D -m 755 runtests-loop.sh  $(datadir)/liburing-test/
272
273uninstall:
274	@rm -rf $(datadir)/liburing-test/
275
276clean:
277	@rm -f $(all_targets) helpers.o output/*
278	@rm -rf output/
279
280runtests: all
281	@./runtests.sh $(test_targets)
282
283runtests-loop: all
284	@./runtests-loop.sh $(test_targets)
285
286%.run_test: %.t
287	@./runtests-quiet.sh $<
288
289runtests-parallel: $(run_test_targets)
290	@echo "All tests passed"
291
292.PHONY: all install clean runtests runtests-loop runtests-parallel
293