1 # nbd client library in userspace
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
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 \
33 QEMU_STORAGE_DAEMON=$(QEMU_STORAGE_DAEMON) \
35 LOG_COMPILER = $(top_builddir)/run
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/$@
45 # Note there is no such thing as "AM_LDADD".
47 -I$(top_srcdir)/common/include \
48 -I$(top_srcdir)/include \
49 -I$(top_srcdir)/tests \
56 #----------------------------------------------------------------------
57 # Test interoperability with nbd-server.
63 interop-nbd-server-tls \
64 list-exports-nbd-server \
68 interop-nbd-server-tls \
69 list-exports-nbd-server \
72 interop_nbd_server_SOURCES = \
77 interop_nbd_server_CPPFLAGS = \
79 -DREQUIRES=' requires_nbd_server_supports_inetd ("$(NBD_SERVER)"); ' \
81 -DSERVER=\"$(NBD_SERVER)\" \
82 -DSERVER_PARAMS='"-d", "-C", "/dev/null", "0", TMPFILE' \
85 interop_nbd_server_LDADD = $(top_builddir)/lib/libnbd.la
87 interop_nbd_server_tls_SOURCES = \
92 interop_nbd_server_tls_CPPFLAGS = \
94 -DREQUIRES=' requires ("test -d $(abs_top_builddir)/tests/pki"); requires_nbd_server_supports_inetd ("$(NBD_SERVER)"); ' \
96 -DSERVER=\"$(NBD_SERVER)\" \
97 -DSERVER_PARAMS='"-d", "-C", "nbd-server-tls.conf", "0", TMPFILE' \
100 -DTLS_MODE=LIBNBD_TLS_REQUIRE \
102 interop_nbd_server_tls_LDADD = \
103 $(top_builddir)/lib/libnbd.la \
107 list_exports_nbd_server_SOURCES = \
110 ../tests/requires.h \
112 list_exports_nbd_server_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='"", ""' \
120 list_exports_nbd_server_LDADD = $(top_builddir)/lib/libnbd.la
122 endif HAVE_NBD_SERVER
124 #----------------------------------------------------------------------
125 # Test interoperability with qemu-nbd.
131 interop-qemu-nbd-tls-certs \
132 interop-qemu-nbd-tls-psk \
133 list-exports-qemu-nbd \
134 socket-activation-qemu-nbd \
140 interop-qemu-nbd-tls-certs \
141 interop-qemu-nbd-tls-psk \
142 list-exports-qemu-nbd \
143 socket-activation-qemu-nbd \
146 interop-qemu-block-size.sh \
149 interop_qemu_nbd_SOURCES = \
152 ../tests/requires.h \
154 interop_qemu_nbd_CPPFLAGS = \
156 -DSOCKET_ACTIVATION=1 \
158 -DSERVER=\"$(QEMU_NBD)\" \
159 -DSERVER_PARAMS='"-f", "raw", "-x", "/", TMPFILE' \
160 -DEXPORT_NAME='"/"' \
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 = \
168 ../tests/requires.h \
170 interop_qemu_nbd_tls_certs_CPPFLAGS = \
172 -DREQUIRES=' requires ("test -d $(abs_top_builddir)/tests/pki"); requires_qemu_nbd_tls_support ("$(QEMU_NBD)"); ' \
173 -DSOCKET_ACTIVATION=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='"/"' \
179 -DTLS_MODE=LIBNBD_TLS_REQUIRE \
181 interop_qemu_nbd_tls_certs_LDADD = \
182 $(top_builddir)/lib/libnbd.la \
186 # qemu-nbd requires absolute path to dir
187 interop_qemu_nbd_tls_psk_SOURCES = \
190 ../tests/requires.h \
192 interop_qemu_nbd_tls_psk_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 \
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='"/"' \
201 -DTLS_MODE=LIBNBD_TLS_REQUIRE \
203 interop_qemu_nbd_tls_psk_LDADD = \
204 $(top_builddir)/lib/libnbd.la \
208 list_exports_qemu_nbd_SOURCES = \
211 ../tests/requires.h \
213 list_exports_qemu_nbd_CPPFLAGS = \
215 -DSOCKET_ACTIVATION=1 \
217 -DSERVER=\"$(QEMU_NBD)\" \
218 -DSERVER_PARAMS='"-f", "raw", "-x", "testing", "-D", "data", TMPFILE' \
219 -DEXPORTS='"testing"' \
220 -DDESCRIPTIONS='"data"' \
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 = \
227 -DSERVER=\"$(QEMU_NBD)\" \
228 -DSERVER_PARAMS='"-f", "raw", "-x", "", tmpfile' \
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
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.
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 \
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 \
282 interop_nbdkit_SOURCES = \
285 ../tests/requires.h \
287 interop_nbdkit_CPPFLAGS = \
290 -DSERVER=\"$(NBDKIT)\" \
291 -DSERVER_PARAMS='"-s", "--exit-with-parent", "file", TMPFILE' \
293 interop_nbdkit_LDADD = $(top_builddir)/lib/libnbd.la
295 interop_nbdkit_tls_certs_SOURCES = \
298 ../tests/requires.h \
300 interop_nbdkit_tls_certs_CPPFLAGS = \
302 -DREQUIRES=' requires ("test -d ../tests/pki"); ' \
304 -DSERVER=\"$(NBDKIT)\" \
305 -DSERVER_PARAMS='"--tls=require", "--tls-certificates=../tests/pki", "-s", "--exit-with-parent", "file", TMPFILE' \
307 -DTLS_MODE=LIBNBD_TLS_REQUIRE \
309 interop_nbdkit_tls_certs_LDADD = \
310 $(top_builddir)/lib/libnbd.la \
314 interop_nbdkit_tls_certs_allow_enabled_SOURCES = \
317 ../tests/requires.h \
319 interop_nbdkit_tls_certs_allow_enabled_CPPFLAGS = \
321 -DREQUIRES=' requires ("test -d ../tests/pki"); ' \
323 -DSERVER=\"$(NBDKIT)\" \
324 -DSERVER_PARAMS='"--tls=require", "--tls-certificates=../tests/pki", "-s", "--exit-with-parent", "file", TMPFILE' \
326 -DTLS_MODE=LIBNBD_TLS_ALLOW \
328 interop_nbdkit_tls_certs_allow_enabled_LDADD = \
329 $(top_builddir)/lib/libnbd.la \
333 interop_nbdkit_tls_certs_allow_fallback_SOURCES = \
336 ../tests/requires.h \
338 interop_nbdkit_tls_certs_allow_fallback_CPPFLAGS = \
340 -DREQUIRES=' requires ("test -d ../tests/pki"); ' \
342 -DSERVER=\"$(NBDKIT)\" \
343 -DSERVER_PARAMS='"--tls=off", "-s", "--exit-with-parent", "file", TMPFILE' \
345 -DTLS_MODE=LIBNBD_TLS_ALLOW \
348 interop_nbdkit_tls_certs_allow_fallback_LDADD = \
349 $(top_builddir)/lib/libnbd.la \
353 interop_nbdkit_tls_psk_SOURCES = \
356 ../tests/requires.h \
358 interop_nbdkit_tls_psk_CPPFLAGS = \
360 -DREQUIRES=' requires ("test -f ../tests/keys.psk"); ' \
362 -DSERVER=\"$(NBDKIT)\" \
363 -DSERVER_PARAMS='"--tls=require", "--tls-psk=../tests/keys.psk", "-s", "--exit-with-parent", "file", TMPFILE' \
365 -DTLS_MODE=LIBNBD_TLS_REQUIRE \
367 interop_nbdkit_tls_psk_LDADD = \
368 $(top_builddir)/lib/libnbd.la \
372 interop_nbdkit_tls_psk_allow_enabled_SOURCES = \
375 ../tests/requires.h \
377 interop_nbdkit_tls_psk_allow_enabled_CPPFLAGS = \
379 -DREQUIRES=' requires ("test -f ../tests/keys.psk"); ' \
381 -DSERVER=\"$(NBDKIT)\" \
382 -DSERVER_PARAMS='"--tls=require", "--tls-psk=../tests/keys.psk", "-s", "--exit-with-parent", "file", TMPFILE' \
384 -DTLS_MODE=LIBNBD_TLS_ALLOW \
386 interop_nbdkit_tls_psk_allow_enabled_LDADD = \
387 $(top_builddir)/lib/libnbd.la \
391 interop_nbdkit_tls_psk_allow_fallback_SOURCES = \
394 ../tests/requires.h \
396 interop_nbdkit_tls_psk_allow_fallback_CPPFLAGS = \
398 -DREQUIRES=' requires ("test -f ../tests/keys.psk"); ' \
400 -DSERVER=\"$(NBDKIT)\" \
401 -DSERVER_PARAMS='"--tls=off", "-s", "--exit-with-parent", "file", TMPFILE' \
403 -DTLS_MODE=LIBNBD_TLS_ALLOW \
406 interop_nbdkit_tls_psk_allow_fallback_LDADD = \
407 $(top_builddir)/lib/libnbd.la \
411 socket_activation_nbdkit_SOURCES = socket-activation.c
412 socket_activation_nbdkit_CPPFLAGS = \
414 -DSERVER=\"$(NBDKIT)\" \
415 -DSERVER_PARAMS='"file", tmpfile' \
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 = \
423 ../tests/requires.h \
425 list_exports_nbdkit_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='"", ""' \
433 list_exports_nbdkit_LDADD = $(top_builddir)/lib/libnbd.la
438 LIBNBD_VALGRIND=1 $(MAKE) check