1prefix ?= /usr 2datadir ?= $(prefix)/share 3 4INSTALL=install 5 6CPPFLAGS ?= 7override CPPFLAGS += -D_GNU_SOURCE -D__SANE_USERSPACE_TYPES__ \ 8 -I../src/include/ -include ../config-host.h 9CFLAGS ?= -g -O2 10XCFLAGS = 11override CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare \ 12 -L../src/ 13CXXFLAGS ?= 14override CXXFLAGS += $(CFLAGS) -std=c++11 15 16test_targets += \ 17 232c93d07b74-test \ 18 35fa71a030ca-test \ 19 500f9fbadef8-test \ 20 7ad0e4b2f83c-test \ 21 8a9973408177-test \ 22 917257daa0fe-test \ 23 a0908ae19763-test \ 24 a4c0b3decb33-test \ 25 accept \ 26 accept-link \ 27 accept-reuse \ 28 accept-test \ 29 across-fork splice \ 30 b19062a56726-test \ 31 b5837bd5311d-test \ 32 ce593a6c480a-test \ 33 close-opath \ 34 connect \ 35 cq-full \ 36 cq-overflow \ 37 cq-peek-batch \ 38 cq-ready \ 39 cq-size \ 40 d4ae271dfaae-test \ 41 d77a67ed5f27-test \ 42 defer \ 43 double-poll-crash \ 44 eeed8b54e0df-test \ 45 eventfd \ 46 eventfd-disable \ 47 eventfd-ring \ 48 fadvise \ 49 fallocate \ 50 fc2a85cb02ef-test \ 51 file-register \ 52 file-update \ 53 files-exit-hang-poll \ 54 files-exit-hang-timeout \ 55 fixed-link \ 56 fsync \ 57 hardlink \ 58 io-cancel \ 59 io_uring_enter \ 60 io_uring_register \ 61 io_uring_setup \ 62 iopoll \ 63 lfs-openat \ 64 lfs-openat-write \ 65 link \ 66 link-timeout \ 67 link_drain \ 68 madvise \ 69 mkdir \ 70 multicqes_drain \ 71 nop \ 72 nop-all-sizes \ 73 open-close \ 74 openat2 \ 75 personality \ 76 pipe-eof \ 77 pipe-reuse \ 78 poll \ 79 poll-cancel \ 80 poll-cancel-ton \ 81 poll-link \ 82 poll-many \ 83 poll-mshot-update \ 84 poll-ring \ 85 poll-v-poll \ 86 probe \ 87 read-write \ 88 register-restrictions \ 89 rename \ 90 ring-leak \ 91 ring-leak2 \ 92 rw_merge_test \ 93 self \ 94 send_recv \ 95 send_recvmsg \ 96 shared-wq \ 97 short-read \ 98 shutdown \ 99 sigfd-deadlock \ 100 socket-rw \ 101 socket-rw-eagain \ 102 sq-full \ 103 sq-poll-dup \ 104 sq-poll-kthread \ 105 sq-poll-share \ 106 sqpoll-disable-exit \ 107 sqpoll-exit-hang \ 108 sqpoll-sleep \ 109 sq-space_left \ 110 stdout \ 111 submit-reuse \ 112 symlink \ 113 teardowns \ 114 thread-exit \ 115 timeout \ 116 timeout-new \ 117 timeout-overflow \ 118 unlink \ 119 wakeup-hang \ 120 sendmsg_fs_cve \ 121 rsrc_tags \ 122 # EOL 123 124all_targets += $(test_targets) 125 126include ../Makefile.quiet 127 128ifneq ($(MAKECMDGOALS),clean) 129include ../config-host.mak 130endif 131 132ifdef CONFIG_HAVE_STATX 133test_targets += statx 134endif 135all_targets += statx 136 137ifdef CONFIG_HAVE_CXX 138test_targets += sq-full-cpp 139endif 140all_targets += sq-full-cpp 141 142helpers = helpers.o 143 144all: ${helpers} $(test_targets) 145 146helpers.o: helpers.c helpers.c 147 $(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< -luring 148 149%: %.c ${helpers} helpers.h 150 $(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< ${helpers} -luring $(XCFLAGS) 151 152%: %.cc ${helpers} helpers.h 153 $(QUIET_CXX)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $< ${helpers} -luring $(XCFLAGS) 154 155test_srcs := \ 156 helpers.c \ 157 232c93d07b74-test.c \ 158 35fa71a030ca-test.c \ 159 500f9fbadef8-test.c \ 160 7ad0e4b2f83c-test.c \ 161 8a9973408177-test.c \ 162 917257daa0fe-test.c \ 163 a0908ae19763-test.c \ 164 a4c0b3decb33-test.c \ 165 accept-link.c \ 166 accept-reuse.c \ 167 accept-test.c \ 168 accept.c \ 169 across-fork.c \ 170 b19062a56726-test.c \ 171 b5837bd5311d-test.c \ 172 ce593a6c480a-test.c \ 173 close-opath.c \ 174 connect.c \ 175 cq-full.c \ 176 cq-overflow.c \ 177 cq-peek-batch.c \ 178 cq-ready.c\ 179 cq-size.c \ 180 d4ae271dfaae-test.c \ 181 d77a67ed5f27-test.c \ 182 defer.c \ 183 double-poll-crash.c \ 184 eeed8b54e0df-test.c \ 185 eventfd-disable.c \ 186 eventfd-ring.c \ 187 eventfd.c \ 188 fadvise.c \ 189 fallocate.c \ 190 fc2a85cb02ef-test.c \ 191 file-register.c \ 192 file-update.c \ 193 files-exit-hang-poll.c \ 194 files-exit-hang-timeout.c \ 195 fixed-link.c \ 196 fsync.c \ 197 hardlink.c \ 198 io-cancel.c \ 199 io_uring_enter.c \ 200 io_uring_register.c \ 201 io_uring_setup.c \ 202 iopoll.c \ 203 lfs-openat-write.c \ 204 lfs-openat.c \ 205 link-timeout.c \ 206 link.c \ 207 link_drain.c \ 208 madvise.c \ 209 mkdir.c \ 210 multicqes_drain.c \ 211 nop-all-sizes.c \ 212 nop.c \ 213 open-close.c \ 214 openat2.c \ 215 personality.c \ 216 pipe-eof.c \ 217 pipe-reuse.c \ 218 poll-cancel-ton.c \ 219 poll-cancel.c \ 220 poll-link.c \ 221 poll-many.c \ 222 poll-mshot-update.c \ 223 poll-ring.c \ 224 poll-v-poll.c \ 225 poll.c \ 226 probe.c \ 227 read-write.c \ 228 register-restrictions.c \ 229 rename.c \ 230 ring-leak.c \ 231 ring-leak2.c \ 232 rw_merge_test.c \ 233 self.c \ 234 send_recvmsg.c \ 235 shared-wq.c \ 236 short-read.c \ 237 shutdown.c \ 238 sigfd-deadlock.c \ 239 socket-rw.c \ 240 socket-rw-eagain.c \ 241 splice.c \ 242 sq-full-cpp.cc \ 243 sq-full.c \ 244 sq-poll-dup.c \ 245 sq-poll-kthread.c \ 246 sq-poll-share.c \ 247 sqpoll-disable-exit.c \ 248 sqpoll-exit-hang.c \ 249 sqpoll-sleep.c \ 250 sq-space_left.c \ 251 statx.c \ 252 stdout.c \ 253 submit-reuse.c \ 254 symlink.c \ 255 teardowns.c \ 256 thread-exit.c \ 257 timeout-new.c \ 258 timeout-overflow.c \ 259 timeout.c \ 260 unlink.c \ 261 wakeup-hang.c \ 262 sendmsg_fs_cve.c \ 263 rsrc_tags.c \ 264 # EOL 265 266test_objs := $(patsubst %.c,%.ol,$(patsubst %.cc,%.ol,$(test_srcs))) 267 26835fa71a030ca-test: XCFLAGS = -lpthread 269232c93d07b74-test: XCFLAGS = -lpthread 270send_recv: XCFLAGS = -lpthread 271send_recvmsg: XCFLAGS = -lpthread 272poll-link: XCFLAGS = -lpthread 273accept-link: XCFLAGS = -lpthread 274submit-reuse: XCFLAGS = -lpthread 275poll-v-poll: XCFLAGS = -lpthread 276across-fork: XCFLAGS = -lpthread 277ce593a6c480a-test: XCFLAGS = -lpthread 278wakeup-hang: XCFLAGS = -lpthread 279pipe-eof: XCFLAGS = -lpthread 280timeout-new: XCFLAGS = -lpthread 281thread-exit: XCFLAGS = -lpthread 282ring-leak2: XCFLAGS = -lpthread 283poll-mshot-update: XCFLAGS = -lpthread 284 285install: $(test_targets) runtests.sh runtests-loop.sh 286 $(INSTALL) -D -d -m 755 $(datadir)/liburing-test/ 287 $(INSTALL) -D -m 755 $(test_targets) $(datadir)/liburing-test/ 288 $(INSTALL) -D -m 755 runtests.sh $(datadir)/liburing-test/ 289 $(INSTALL) -D -m 755 runtests-loop.sh $(datadir)/liburing-test/ 290clean: 291 @rm -f $(all_targets) $(test_objs) helpers.o 292 293runtests: all 294 @./runtests.sh $(test_targets) 295runtests-loop: all 296 @./runtests-loop.sh $(test_targets) 297