[Libguestfs] [PATCH libnbd 3/5] interop: Add interop tests for nbdkit.

Richard W.M. Jones rjones at redhat.com
Tue Sep 17 22:35:32 UTC 2019


Although the main test suite already depends on nbdkit rather heavily
and therefore it's pretty well tested, add a separate set of interop
tests.  The purpose will become clear in a subsequent commit.
---
 .gitignore          |  3 +++
 README              |  4 +--
 interop/Makefile.am | 60 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 53aa206..ab47370 100644
--- a/.gitignore
+++ b/.gitignore
@@ -60,6 +60,9 @@ Makefile.in
 /html/*.?.html
 /include/libnbd.h
 /interop/dirty-bitmap
+/interop/interop-nbdkit
+/interop/interop-nbdkit-tls-certs
+/interop/interop-nbdkit-tls-psk
 /interop/interop-nbd-server
 /interop/interop-qemu-nbd
 /interop/interop-qemu-nbd-tls-certs
diff --git a/README b/README
index d6d1704..1c9d816 100644
--- a/README
+++ b/README
@@ -87,8 +87,8 @@ Optional, only needed to run the test suite:
  * nbdkit >= 1.12, the nbdkit basic plugins and the nbdkit basic
    filters are recommended as they are needed to run the test suite.
 
- * nbd-server and qemu-nbd if you want to do interoperability testing
-   against these servers.
+ * nbdkit, nbd-server and qemu-nbd if you want to do interoperability
+   testing against these servers.
 
  * A C++ compiler is needed if you want to test that the library works
    from C++.
diff --git a/interop/Makefile.am b/interop/Makefile.am
index 7bb44d9..9cb8071 100644
--- a/interop/Makefile.am
+++ b/interop/Makefile.am
@@ -129,5 +129,65 @@ structured_read_LDADD = $(top_builddir)/lib/libnbd.la
 
 endif HAVE_QEMU_NBD
 
+if HAVE_NBDKIT
+
+check_PROGRAMS += \
+	interop-nbdkit \
+	$(NULL)
+TESTS += \
+	interop-nbdkit \
+	$(NULL)
+
+# See above comment about files in ../tests/Makefile.am
+if HAVE_GNUTLS
+if HAVE_CERTTOOL
+check_PROGRAMS += \
+	interop-nbdkit-tls-certs \
+	$(NULL)
+TESTS += \
+	interop-nbdkit-tls-certs \
+	$(NULL)
+endif
+if HAVE_PSKTOOL
+check_PROGRAMS += \
+	interop-nbdkit-tls-psk \
+	$(NULL)
+TESTS += \
+	interop-nbdkit-tls-psk \
+	$(NULL)
+endif
+endif
+
+interop_nbdkit_SOURCES = interop.c
+interop_nbdkit_CPPFLAGS = \
+	-I$(top_srcdir)/include \
+	-DSERVER=\"$(NBDKIT)\" \
+	-DSERVER_PARAMS='"-s", "--exit-with-parent", "file", tmpfile' \
+	$(NULL)
+interop_nbdkit_CFLAGS = $(WARNINGS_CFLAGS)
+interop_nbdkit_LDADD = $(top_builddir)/lib/libnbd.la
+
+interop_nbdkit_tls_certs_SOURCES = interop.c
+interop_nbdkit_tls_certs_CPPFLAGS = \
+	-I$(top_srcdir)/include \
+	-DSERVER=\"$(NBDKIT)\" \
+	-DSERVER_PARAMS='"--tls=require", "--tls-certificates=../tests/pki", "-s", "--exit-with-parent", "file", tmpfile' \
+	-DCERTS=1 \
+	$(NULL)
+interop_nbdkit_tls_certs_CFLAGS = $(WARNINGS_CFLAGS)
+interop_nbdkit_tls_certs_LDADD = $(top_builddir)/lib/libnbd.la
+
+interop_nbdkit_tls_psk_SOURCES = interop.c
+interop_nbdkit_tls_psk_CPPFLAGS = \
+	-I$(top_srcdir)/include \
+	-DSERVER=\"$(NBDKIT)\" \
+	-DSERVER_PARAMS='"--tls=require", "--tls-psk=../tests/keys.psk", "-s", "--exit-with-parent", "file", tmpfile' \
+	-DPSK=1 \
+	$(NULL)
+interop_nbdkit_tls_psk_CFLAGS = $(WARNINGS_CFLAGS)
+interop_nbdkit_tls_psk_LDADD = $(top_builddir)/lib/libnbd.la
+
+endif HAVE_NBDKIT
+
 check-valgrind:
 	LIBNBD_VALGRIND=1 $(MAKE) check
-- 
2.23.0




More information about the Libguestfs mailing list