Revert "ci: skip "lib/test-fork-safe-execvpe.sh" on Alpine Linux"
[libnbd.git] / interop / Makefile.am
blobec8ea0b2a6033f1037bd90f54ccc86e7aa2c374d
1 # nbd client library in userspace
2 # Copyright Red Hat
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 include $(top_srcdir)/subdir-rules.mk
20 EXTRA_DIST = \
21         dirty-bitmap.sh \
22         interop-qemu-storage-daemon.sh \
23         interop-qemu-block-size.sh \
24         list-exports-nbd-config \
25         list-exports-test-dir/disk1 \
26         list-exports-test-dir/disk2 \
27         structured-read.sh \
28         $(NULL)
30 TESTS_ENVIRONMENT = \
31         LIBNBD_DEBUG=1 \
32         $(MALLOC_CHECKS) \
33         QEMU_STORAGE_DAEMON=$(QEMU_STORAGE_DAEMON) \
34         $(NULL)
35 LOG_COMPILER = $(top_builddir)/run
36 check_PROGRAMS =
37 TESTS =
39 # XXX automake subdir-objects is broken, use a workaround instead.
40 BUILT_SOURCES = requires.c
41 requires.c: $(top_srcdir)/tests/requires.c
42         ln -s -f $(top_srcdir)/tests/$@
44 # Common flags.
45 # Note there is no such thing as "AM_LDADD".
46 AM_CPPFLAGS = \
47         -I$(top_srcdir)/common/include \
48         -I$(top_srcdir)/include \
49         -I$(top_srcdir)/tests \
50         $(NULL)
51 AM_CFLAGS = \
52         $(WARNINGS_CFLAGS) \
53         $(GNUTLS_CFLAGS) \
54         $(NULL)
56 #----------------------------------------------------------------------
57 # Test interoperability with nbd-server.
59 if HAVE_NBD_SERVER
61 check_PROGRAMS += \
62         interop-nbd-server \
63         interop-nbd-server-tls \
64         list-exports-nbd-server \
65         $(NULL)
66 TESTS += \
67         interop-nbd-server \
68         interop-nbd-server-tls \
69         list-exports-nbd-server \
70         $(NULL)
72 interop_nbd_server_SOURCES = \
73         interop.c \
74         requires.c \
75         ../tests/requires.h \
76         $(NULL)
77 interop_nbd_server_CPPFLAGS = \
78         $(AM_CPPFLAGS) \
79         -DREQUIRES=' requires_nbd_server_supports_inetd ("$(NBD_SERVER)"); ' \
80         -DNEEDS_TMPFILE=1 \
81         -DSERVER=\"$(NBD_SERVER)\" \
82         -DSERVER_PARAMS='"-d", "-C", "/dev/null", "0", TMPFILE' \
83         -DEXPORT_NAME='""' \
84         $(NULL)
85 interop_nbd_server_LDADD = $(top_builddir)/lib/libnbd.la
87 interop_nbd_server_tls_SOURCES = \
88         interop.c \
89         requires.c \
90         ../tests/requires.h \
91         $(NULL)
92 interop_nbd_server_tls_CPPFLAGS = \
93         $(AM_CPPFLAGS) \
94         -DREQUIRES=' requires ("test -d $(abs_top_builddir)/tests/pki"); requires_nbd_server_supports_inetd ("$(NBD_SERVER)"); ' \
95         -DNEEDS_TMPFILE=1 \
96         -DSERVER=\"$(NBD_SERVER)\" \
97         -DSERVER_PARAMS='"-d", "-C", "nbd-server-tls.conf", "0", TMPFILE' \
98         -DEXPORT_NAME='""' \
99         -DCERTS=1 \
100         -DTLS_MODE=LIBNBD_TLS_REQUIRE \
101         $(NULL)
102 interop_nbd_server_tls_LDADD = \
103         $(top_builddir)/lib/libnbd.la \
104         $(GNUTLS_LIBS) \
105         $(NULL)
107 list_exports_nbd_server_SOURCES = \
108         list-exports.c \
109         requires.c \
110         ../tests/requires.h \
111         $(NULL)
112 list_exports_nbd_server_CPPFLAGS = \
113         $(AM_CPPFLAGS) \
114         -DREQUIRES=' requires_nbd_server_supports_inetd ("$(NBD_SERVER)"); ' \
115         -DSERVER=\"$(NBD_SERVER)\" \
116         -DSERVER_PARAMS='"-C", "$(srcdir)/list-exports-nbd-config", "-d", "0"' \
117         -DEXPORTS='"disk1", "disk2"' \
118         -DDESCRIPTIONS='"", ""' \
119         $(NULL)
120 list_exports_nbd_server_LDADD = $(top_builddir)/lib/libnbd.la
122 endif HAVE_NBD_SERVER
124 #----------------------------------------------------------------------
125 # Test interoperability with qemu-nbd.
127 if HAVE_QEMU_NBD
129 check_PROGRAMS += \
130         interop-qemu-nbd \
131         interop-qemu-nbd-tls-certs \
132         interop-qemu-nbd-tls-psk \
133         list-exports-qemu-nbd \
134         socket-activation-qemu-nbd \
135         dirty-bitmap \
136         structured-read \
137         $(NULL)
138 TESTS += \
139         interop-qemu-nbd \
140         interop-qemu-nbd-tls-certs \
141         interop-qemu-nbd-tls-psk \
142         list-exports-qemu-nbd \
143         socket-activation-qemu-nbd \
144         dirty-bitmap.sh \
145         structured-read.sh \
146         interop-qemu-block-size.sh \
147         $(NULL)
149 interop_qemu_nbd_SOURCES = \
150         interop.c \
151         requires.c \
152         ../tests/requires.h \
153         $(NULL)
154 interop_qemu_nbd_CPPFLAGS = \
155         $(AM_CPPFLAGS) \
156         -DSOCKET_ACTIVATION=1 \
157         -DNEEDS_TMPFILE=1 \
158         -DSERVER=\"$(QEMU_NBD)\" \
159         -DSERVER_PARAMS='"-f", "raw", "-x", "/", TMPFILE' \
160         -DEXPORT_NAME='"/"' \
161         $(NULL)
162 interop_qemu_nbd_LDADD = $(top_builddir)/lib/libnbd.la
164 # qemu-nbd requires absolute path to dir
165 interop_qemu_nbd_tls_certs_SOURCES = \
166         interop.c \
167         requires.c \
168         ../tests/requires.h \
169         $(NULL)
170 interop_qemu_nbd_tls_certs_CPPFLAGS = \
171         $(AM_CPPFLAGS) \
172         -DREQUIRES=' requires ("test -d $(abs_top_builddir)/tests/pki"); requires_qemu_nbd_tls_support ("$(QEMU_NBD)"); ' \
173         -DSOCKET_ACTIVATION=1 \
174         -DNEEDS_TMPFILE=1 \
175         -DSERVER=\"$(QEMU_NBD)\" \
176         -DSERVER_PARAMS='"--object", "tls-creds-x509,id=tls0,endpoint=server,dir=$(abs_top_builddir)/tests/pki", "--tls-creds", "tls0", "-f", "raw", "-x", "/", TMPFILE' \
177         -DEXPORT_NAME='"/"' \
178         -DCERTS=1 \
179         -DTLS_MODE=LIBNBD_TLS_REQUIRE \
180         $(NULL)
181 interop_qemu_nbd_tls_certs_LDADD = \
182         $(top_builddir)/lib/libnbd.la \
183         $(GNUTLS_LIBS) \
184         $(NULL)
186 # qemu-nbd requires absolute path to dir
187 interop_qemu_nbd_tls_psk_SOURCES = \
188         interop.c \
189         requires.c \
190         ../tests/requires.h \
191         $(NULL)
192 interop_qemu_nbd_tls_psk_CPPFLAGS = \
193         $(AM_CPPFLAGS) \
194         -DREQUIRES=' requires ("test -f $(abs_top_builddir)/tests/keys.psk"); requires_qemu_nbd_tls_support ("$(QEMU_NBD)"); requires_qemu_nbd_tls_psk_support ("$(QEMU_NBD)"); ' \
195         -DSOCKET_ACTIVATION=1 \
196         -DNEEDS_TMPFILE=1 \
197         -DSERVER=\"$(QEMU_NBD)\" \
198         -DSERVER_PARAMS='"--object", "tls-creds-psk,id=tls0,endpoint=server,dir=$(abs_top_builddir)/tests", "--tls-creds", "tls0", "-f", "raw", "-x", "/", TMPFILE' \
199         -DEXPORT_NAME='"/"' \
200         -DPSK=1 \
201         -DTLS_MODE=LIBNBD_TLS_REQUIRE \
202         $(NULL)
203 interop_qemu_nbd_tls_psk_LDADD = \
204         $(top_builddir)/lib/libnbd.la \
205         $(GNUTLS_LIBS) \
206         $(NULL)
208 list_exports_qemu_nbd_SOURCES = \
209         list-exports.c \
210         requires.c \
211         ../tests/requires.h \
212         $(NULL)
213 list_exports_qemu_nbd_CPPFLAGS = \
214         $(AM_CPPFLAGS) \
215         -DSOCKET_ACTIVATION=1 \
216         -DNEEDS_TMPFILE=1 \
217         -DSERVER=\"$(QEMU_NBD)\" \
218         -DSERVER_PARAMS='"-f", "raw", "-x", "testing", "-D", "data", TMPFILE' \
219         -DEXPORTS='"testing"' \
220         -DDESCRIPTIONS='"data"' \
221         $(NULL)
222 list_exports_qemu_nbd_LDADD = $(top_builddir)/lib/libnbd.la
224 socket_activation_qemu_nbd_SOURCES = socket-activation.c
225 socket_activation_qemu_nbd_CPPFLAGS = \
226         $(AM_CPPFLAGS) \
227         -DSERVER=\"$(QEMU_NBD)\" \
228         -DSERVER_PARAMS='"-f", "raw", "-x", "", tmpfile' \
229         $(NULL)
230 socket_activation_qemu_nbd_LDADD = $(top_builddir)/lib/libnbd.la
232 dirty_bitmap_SOURCES = dirty-bitmap.c
233 dirty_bitmap_LDADD = $(top_builddir)/lib/libnbd.la
235 structured_read_SOURCES = structured-read.c
236 structured_read_LDADD = $(top_builddir)/lib/libnbd.la
238 endif HAVE_QEMU_NBD
240 #----------------------------------------------------------------------
241 # Test interoperability with qemu-storage-daemon.
243 # We treat qemu-storage-daemon as effectively the same as qemu-nbd
244 # (above) since they use the same code.  But there is a single test to
245 # make sure we can use it.
247 if HAVE_QEMU_STORAGE_DAEMON
248 # It was too complicated to extend interop.c to support q-s-d (since
249 # it doesn't support stdin/stdio or systemd socket activation) so use
250 # this shell script instead.
251 TESTS += interop-qemu-storage-daemon.sh
252 endif HAVE_QEMU_STORAGE_DAEMON
254 #----------------------------------------------------------------------
255 # Test interoperability with nbdkit.
257 if HAVE_NBDKIT
259 check_PROGRAMS += \
260         interop-nbdkit \
261         interop-nbdkit-tls-certs \
262         interop-nbdkit-tls-certs-allow-enabled \
263         interop-nbdkit-tls-certs-allow-fallback \
264         interop-nbdkit-tls-psk \
265         interop-nbdkit-tls-psk-allow-enabled \
266         interop-nbdkit-tls-psk-allow-fallback \
267         socket-activation-nbdkit \
268         list-exports-nbdkit \
269         $(NULL)
270 TESTS += \
271         interop-nbdkit \
272         interop-nbdkit-tls-certs \
273         interop-nbdkit-tls-certs-allow-enabled \
274         interop-nbdkit-tls-certs-allow-fallback \
275         interop-nbdkit-tls-psk \
276         interop-nbdkit-tls-psk-allow-enabled \
277         interop-nbdkit-tls-psk-allow-fallback \
278         socket-activation-nbdkit \
279         list-exports-nbdkit \
280         $(NULL)
282 interop_nbdkit_SOURCES = \
283         interop.c \
284         requires.c \
285         ../tests/requires.h \
286         $(NULL)
287 interop_nbdkit_CPPFLAGS = \
288         $(AM_CPPFLAGS) \
289         -DNEEDS_TMPFILE=1 \
290         -DSERVER=\"$(NBDKIT)\" \
291         -DSERVER_PARAMS='"-s", "--exit-with-parent", "file", TMPFILE' \
292         $(NULL)
293 interop_nbdkit_LDADD = $(top_builddir)/lib/libnbd.la
295 interop_nbdkit_tls_certs_SOURCES = \
296         interop.c \
297         requires.c \
298         ../tests/requires.h \
299         $(NULL)
300 interop_nbdkit_tls_certs_CPPFLAGS = \
301         $(AM_CPPFLAGS) \
302         -DREQUIRES=' requires ("test -d ../tests/pki"); ' \
303         -DNEEDS_TMPFILE=1 \
304         -DSERVER=\"$(NBDKIT)\" \
305         -DSERVER_PARAMS='"--tls=require", "--tls-certificates=../tests/pki", "-s", "--exit-with-parent", "file", TMPFILE' \
306         -DCERTS=1 \
307         -DTLS_MODE=LIBNBD_TLS_REQUIRE \
308         $(NULL)
309 interop_nbdkit_tls_certs_LDADD = \
310         $(top_builddir)/lib/libnbd.la \
311         $(GNUTLS_LIBS) \
312         $(NULL)
314 interop_nbdkit_tls_certs_allow_enabled_SOURCES = \
315         interop.c \
316         requires.c \
317         ../tests/requires.h \
318         $(NULL)
319 interop_nbdkit_tls_certs_allow_enabled_CPPFLAGS = \
320         $(AM_CPPFLAGS) \
321         -DREQUIRES=' requires ("test -d ../tests/pki"); ' \
322         -DNEEDS_TMPFILE=1 \
323         -DSERVER=\"$(NBDKIT)\" \
324         -DSERVER_PARAMS='"--tls=require", "--tls-certificates=../tests/pki", "-s", "--exit-with-parent", "file", TMPFILE' \
325         -DCERTS=1 \
326         -DTLS_MODE=LIBNBD_TLS_ALLOW \
327         $(NULL)
328 interop_nbdkit_tls_certs_allow_enabled_LDADD = \
329         $(top_builddir)/lib/libnbd.la \
330         $(GNUTLS_LIBS) \
331         $(NULL)
333 interop_nbdkit_tls_certs_allow_fallback_SOURCES = \
334         interop.c \
335         requires.c \
336         ../tests/requires.h \
337         $(NULL)
338 interop_nbdkit_tls_certs_allow_fallback_CPPFLAGS = \
339         $(AM_CPPFLAGS) \
340         -DREQUIRES=' requires ("test -d ../tests/pki"); ' \
341         -DNEEDS_TMPFILE=1 \
342         -DSERVER=\"$(NBDKIT)\" \
343         -DSERVER_PARAMS='"--tls=off", "-s", "--exit-with-parent", "file", TMPFILE' \
344         -DCERTS=1 \
345         -DTLS_MODE=LIBNBD_TLS_ALLOW \
346         -DTLS_FALLBACK=1 \
347         $(NULL)
348 interop_nbdkit_tls_certs_allow_fallback_LDADD = \
349         $(top_builddir)/lib/libnbd.la \
350         $(GNUTLS_LIBS) \
351         $(NULL)
353 interop_nbdkit_tls_psk_SOURCES = \
354         interop.c \
355         requires.c \
356         ../tests/requires.h \
357         $(NULL)
358 interop_nbdkit_tls_psk_CPPFLAGS = \
359         $(AM_CPPFLAGS) \
360         -DREQUIRES=' requires ("test -f ../tests/keys.psk"); ' \
361         -DNEEDS_TMPFILE=1 \
362         -DSERVER=\"$(NBDKIT)\" \
363         -DSERVER_PARAMS='"--tls=require", "--tls-psk=../tests/keys.psk", "-s", "--exit-with-parent", "file", TMPFILE' \
364         -DPSK=1 \
365         -DTLS_MODE=LIBNBD_TLS_REQUIRE \
366         $(NULL)
367 interop_nbdkit_tls_psk_LDADD = \
368         $(top_builddir)/lib/libnbd.la \
369         $(GNUTLS_LIBS) \
370         $(NULL)
372 interop_nbdkit_tls_psk_allow_enabled_SOURCES = \
373         interop.c \
374         requires.c \
375         ../tests/requires.h \
376         $(NULL)
377 interop_nbdkit_tls_psk_allow_enabled_CPPFLAGS = \
378         $(AM_CPPFLAGS) \
379         -DREQUIRES=' requires ("test -f ../tests/keys.psk"); ' \
380         -DNEEDS_TMPFILE=1 \
381         -DSERVER=\"$(NBDKIT)\" \
382         -DSERVER_PARAMS='"--tls=require", "--tls-psk=../tests/keys.psk", "-s", "--exit-with-parent", "file", TMPFILE' \
383         -DPSK=1 \
384         -DTLS_MODE=LIBNBD_TLS_ALLOW \
385         $(NULL)
386 interop_nbdkit_tls_psk_allow_enabled_LDADD = \
387         $(top_builddir)/lib/libnbd.la \
388         $(GNUTLS_LIBS) \
389         $(NULL)
391 interop_nbdkit_tls_psk_allow_fallback_SOURCES = \
392         interop.c \
393         requires.c \
394         ../tests/requires.h \
395         $(NULL)
396 interop_nbdkit_tls_psk_allow_fallback_CPPFLAGS = \
397         $(AM_CPPFLAGS) \
398         -DREQUIRES=' requires ("test -f ../tests/keys.psk"); ' \
399         -DNEEDS_TMPFILE=1 \
400         -DSERVER=\"$(NBDKIT)\" \
401         -DSERVER_PARAMS='"--tls=off", "-s", "--exit-with-parent", "file", TMPFILE' \
402         -DPSK=1 \
403         -DTLS_MODE=LIBNBD_TLS_ALLOW \
404         -DTLS_FALLBACK=1 \
405         $(NULL)
406 interop_nbdkit_tls_psk_allow_fallback_LDADD = \
407         $(top_builddir)/lib/libnbd.la \
408         $(GNUTLS_LIBS) \
409         $(NULL)
411 socket_activation_nbdkit_SOURCES = socket-activation.c
412 socket_activation_nbdkit_CPPFLAGS = \
413         $(AM_CPPFLAGS) \
414         -DSERVER=\"$(NBDKIT)\" \
415         -DSERVER_PARAMS='"file", tmpfile' \
416         $(NULL)
417 socket_activation_nbdkit_LDADD = $(top_builddir)/lib/libnbd.la
419 # This test requires nbdkit >= 1.22, checked at runtime.
420 list_exports_nbdkit_SOURCES = \
421         list-exports.c \
422         requires.c \
423         ../tests/requires.h \
424         $(NULL)
425 list_exports_nbdkit_CPPFLAGS = \
426         $(AM_CPPFLAGS) \
427         -DREQUIRES=' requires ("$(NBDKIT) file --version"); requires ("minor=`$(NBDKIT) --dump-config | grep ^version_minor | cut -d= -f2`; echo $$minor; test $$minor -ge 22"); ' \
428         -DSERVER=\"$(NBDKIT)\" \
429         -DSERVER_PARAMS='"-s", "--exit-with-parent", "file", "dir=$(srcdir)/list-exports-test-dir"' \
430         -DEXPORTS='"disk1", "disk2"' \
431         -DDESCRIPTIONS='"", ""' \
432         $(NULL)
433 list_exports_nbdkit_LDADD = $(top_builddir)/lib/libnbd.la
435 endif HAVE_NBDKIT
437 check-valgrind:
438         LIBNBD_VALGRIND=1 $(MAKE) check