2 # Copyright (C) 2013-2020 Red Hat Inc.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # * Neither the name of Red Hat nor the names of its contributors may be
16 # used to endorse or promote products derived from this software without
17 # specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
20 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22 # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
23 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 include $(top_srcdir)/common-rules.mk
34 #----------------------------------------------------------------------
35 # This directory contains most of the nbdkit tests.
39 # TESTS Tests that don't have any special requirements.
41 # LIBNBD_TESTS Tests that link to the libnbd C library should be
42 # added to this variable.
44 # LIBGUESTFS_TESTS Tests that link to libguestfs C library should be
45 # added to this variable.
47 # check_*, noinst_*, EXTRA_PROGRAMS: These are the usual automake
48 # variables. Consult the automake manual for the meaning of these.
61 # Ensure we're testing the local copy by running everything through
62 # the nbdkit helper script in the top build directory.
64 # Use the 'direct' backend, and ensure maximum libguestfs debugging.
66 # Enable libnbd debugging.
68 PATH=$(abs_top_builddir):$(PATH) \
71 LIBGUESTFS_ATTACH_METHOD=appliance \
77 # All files that need to go into the tarball must be added here.
79 generate-file-data.sh \
91 test-cache-max-size.sh \
92 test-cache-on-read.sh \
93 test-cacheextents.sh \
100 test-data-extents.sh \
103 test-debug-flags.sh \
104 test-dump-config.sh \
105 test-dump-plugin.sh \
106 test-dump-plugin-example4.sh \
111 test-error-triggered.sh \
113 test-export-name.sh \
115 test-file-extents.sh \
121 test-help-plugin.sh \
122 test-info-address.sh \
123 test-info-base64.sh \
126 test-info-uptime.sh \
127 test-info-conntime.sh \
133 test-linuxdisk-copy-out.sh \
137 test-memory-largest.sh \
138 test-memory-largest-for-qemu.sh \
139 test-nbd-extents.sh \
141 test-nbd-tls-psk.sh \
142 test-nbdkit-backend-debug.sh \
145 test-null-extents.sh \
146 test_ocaml_plugin.ml \
149 test-offset-extents.sh \
150 test-parallel-file.sh \
151 test-parallel-nbd.sh \
152 test-parallel-sh.sh \
155 test-partitioning1.sh \
156 test-partitioning2.sh \
157 test-partitioning3.sh \
158 test-partitioning4.sh \
159 test-partitioning5.sh \
160 test-partitioning6.sh \
162 test-pattern-largest.sh \
163 test-pattern-largest-for-qemu.sh \
164 test-probe-filter.sh \
165 test-probe-plugin.sh \
166 test-python-exception.sh \
169 test-python-plugin.py \
172 test-rate-dynamic.sh \
175 test-readahead-copy.sh \
176 test-readahead-test-plugin.sh \
177 test-readahead-test-request.py \
179 test-retry-extents.sh \
181 test-retry-readonly.sh \
182 test-retry-reopen-fail.sh \
183 test-retry-zero-flags.sh \
188 test-shebang-perl.sh \
189 test-shebang-python.sh \
190 test-shebang-ruby.sh \
195 test-single-from-file.sh \
197 test-random-sock.sh \
204 test-truncate-extents.sh \
208 test-version-filter.sh \
209 test-version-plugin.sh \
214 #----------------------------------------------------------------------
215 # Use 'make check' to run the ordinary tests as non-root. The
216 # following are special commands for particular scenarios:
218 # To run all the tests under valgrind, use the following rule:
220 NBDKIT_VALGRIND=1 $(MAKE) check
222 # To run only tests which require root, use:
224 $(MAKE) check TESTS="test-file-block test-swap.sh"
227 # Run a basic check against a real copy of VDDK. You must set
228 # vddkdir to point to the library location, eg:
230 # make check-vddk vddkdir=vmware-vix-disklib-distrib
232 $(MAKE) check TESTS=test-vddk-real.sh
235 #----------------------------------------------------------------------
236 # Basic server command line and start-up tests.
241 test-dump-config.sh \
247 test-help-plugin.sh \
248 test-version-plugin.sh \
249 test-version-filter.sh \
250 test-probe-filter.sh \
251 test-probe-plugin.sh \
252 test-dump-plugin.sh \
255 test-single-from-file.sh \
257 test-random-sock.sh \
262 test-socket-activation \
264 test-debug-flags.sh \
270 test-socket-activation \
273 test_socket_activation_SOURCES = test-socket-activation.c
274 test_socket_activation_CPPFLAGS = \
275 -I$(top_srcdir)/common/include \
276 -I$(top_srcdir)/common/protocol \
278 test_socket_activation_CFLAGS = $(WARNINGS_CFLAGS)
282 # Test the header files can be included on their own.
284 test-just-plugin-header \
285 test-just-filter-header
288 test-just-plugin-header \
289 test-just-filter-header
292 test_just_plugin_header_SOURCES = \
293 test-just-plugin-header.c \
295 test_just_plugin_header_CPPFLAGS = \
296 -I$(top_srcdir)/include \
298 test_just_plugin_header_CFLAGS = $(WARNINGS_CFLAGS)
300 test_just_filter_header_SOURCES = \
301 test-just-filter-header.c \
303 test_just_filter_header_CPPFLAGS = \
304 -I$(top_srcdir)/include \
306 test_just_filter_header_CFLAGS = $(WARNINGS_CFLAGS)
309 # This builds a plugin using an ANSI (ISO C90) compiler to ensure that
310 # the header file is compatible. The plugin does nothing very
311 # interesting, it's mainly a compile test.
315 # check_LTLIBRARIES won't build a shared library (see automake manual).
316 # So we have to do this and add a dependency.
317 noinst_LTLIBRARIES += test-ansi-c-plugin.la
318 test-ansi-c.sh: test-ansi-c-plugin.la
320 test_ansi_c_plugin_la_SOURCES = \
321 test-ansi-c-plugin.c \
322 $(top_srcdir)/include/nbdkit-plugin.h \
324 test_ansi_c_plugin_la_CPPFLAGS = \
326 -I$(top_srcdir)/include \
328 test_ansi_c_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
329 # For use of the -rpath option, see:
330 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
331 test_ansi_c_plugin_la_LDFLAGS = \
332 -module -avoid-version -shared -rpath /nowhere \
334 endif CAN_TEST_ANSI_C
337 # This builds a plugin and a filter using the C++ compiler. They
338 # don't do anything interesting when run.
342 # check_LTLIBRARIES won't build a shared library (see automake manual).
343 # So we have to do this and add a dependency.
344 noinst_LTLIBRARIES += test-cxx-plugin.la test-cxx-filter.la
345 test-cxx.sh: test-cxx-plugin.la test-cxx-filter.la
347 test_cxx_plugin_la_SOURCES = \
348 test-cxx-plugin.cpp \
349 $(top_srcdir)/include/nbdkit-plugin.h \
351 test_cxx_plugin_la_CPPFLAGS = \
352 -I$(top_srcdir)/include \
354 test_cxx_plugin_la_CXXFLAGS = $(WARNINGS_CFLAGS)
355 # For use of the -rpath option, see:
356 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
357 test_cxx_plugin_la_LDFLAGS = \
358 -module -avoid-version -shared -rpath /nowhere \
361 test_cxx_filter_la_SOURCES = \
362 test-cxx-filter.cpp \
363 $(top_srcdir)/include/nbdkit-filter.h \
365 test_cxx_filter_la_CPPFLAGS = \
366 -I$(top_srcdir)/include \
368 test_cxx_filter_la_CXXFLAGS = $(WARNINGS_CFLAGS)
369 # For use of the -rpath option, see:
370 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
371 test_cxx_filter_la_LDFLAGS = \
372 -module -avoid-version -shared -rpath /nowhere \
376 # Exit with parent test.
377 check_PROGRAMS += test-exit-with-parent
378 TESTS += test-exit-with-parent
380 test_exit_with_parent_SOURCES = \
381 test-exit-with-parent.c test.h \
383 test_exit_with_parent_CPPFLAGS = \
384 -I$(top_srcdir)/common/include \
386 test_exit_with_parent_CFLAGS = \
388 $(LIBGUESTFS_CFLAGS) \
391 # PKI files for the TLS tests.
392 check_DATA += pki/.stamp
393 pki/.stamp: $(srcdir)/make-pki.sh
394 SRCDIR=$(srcdir) $(srcdir)/make-pki.sh
396 # PSK keys for the TLS-PSK tests.
397 check_DATA += keys.psk
398 keys.psk: $(srcdir)/make-psk.sh
399 SRCDIR=$(srcdir) $(srcdir)/make-psk.sh
401 # Keys are expensive to recreate so only delete them when we do
402 # ‘make distclean’.
403 DISTCLEANFILES = keys.psk
404 distclean-local: distclean-local-tls
408 #----------------------------------------------------------------------
409 # Tests of C plugins or tests which require plugins.
413 # Common data shared by multiple tests
414 check_DATA += file-data
415 CLEANFILES += file-data
416 file-data: generate-file-data.sh
417 $(srcdir)/generate-file-data.sh $@
419 # While most tests need libguestfs, testing parallel I/O is easier when
420 # using qemu-io to kick off asynchronous requests.
422 test-parallel-file.sh \
423 test-parallel-nbd.sh \
424 test-parallel-sh.sh \
427 # Common test library.
428 check_LTLIBRARIES += libtest.la
429 libtest_la_SOURCES = test.c test.h
430 libtest_la_CFLAGS = $(WARNINGS_CFLAGS)
432 # Basic connection test.
433 LIBNBD_TESTS += test-connect
435 test_connect_SOURCES = test-connect.c
436 test_connect_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
437 test_connect_LDADD = $(LIBNBD_LIBS)
439 # newstyle protocol test.
440 LIBNBD_TESTS += test-newstyle
442 test_newstyle_SOURCES = test-newstyle.c
443 test_newstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
444 test_newstyle_LDADD = $(LIBNBD_LIBS)
446 # oldstyle protocol test.
447 LIBNBD_TESTS += test-oldstyle
449 test_oldstyle_SOURCES = test-oldstyle.c
450 test_oldstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
451 test_oldstyle_LDADD = $(LIBNBD_LIBS)
454 TESTS += test-eflags.sh
457 TESTS += test-export-name.sh
459 # common disk image shared with several tests
464 rm -rf disk.tmp $@ $@-t
466 echo -n "hello,world" > disk.tmp/hello.txt
467 $(top_builddir)/nbdkit -fv -U - linuxdisk disk.tmp size=100M \
468 --run 'qemu-img convert $$nbd $@-t'
474 LIBGUESTFS_TESTS += test-curl
476 test_curl_SOURCES = \
482 test_curl_CPPFLAGS = \
483 -I$(top_srcdir)/common/utils
486 $(LIBGUESTFS_CFLAGS) \
489 test_curl_LDFLAGS = \
490 $(top_builddir)/common/utils/libutils.la \
500 LIBGUESTFS_TESTS += test-data
503 test-data-base64.sh \
504 test-data-extents.sh \
509 test_data_SOURCES = test-data.c test.h
510 test_data_CPPFLAGS = -I$(top_srcdir)/common/include
511 test_data_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
512 test_data_LDADD = libtest.la $(LIBGUESTFS_LIBS)
515 TESTS += test-eval.sh
521 LIBGUESTFS_TESTS += test-ext2
522 check_DATA += ext2.img
523 CLEANFILES += ext2.img
530 mkfs ext4 /dev/sda : \
533 upload $< /disks/disk.img
536 test_ext2_SOURCES = test-ext2.c test.h
537 test_ext2_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
538 test_ext2_LDADD = libtest.la $(LIBGUESTFS_LIBS)
544 LIBNBD_TESTS += test-file
545 LIBGUESTFS_TESTS += test-file-block
547 test_file_SOURCES = test-file.c
548 test_file_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
549 test_file_LDADD = $(LIBNBD_LIBS)
551 test_file_block_SOURCES = test-file-block.c test.h
552 test_file_block_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
553 test_file_block_LDADD = libtest.la $(LIBGUESTFS_LIBS)
555 TESTS += test-file-extents.sh
557 # floppy plugin test.
558 TESTS += test-floppy.sh
561 TESTS += test-full.sh
565 LIBGUESTFS_TESTS += test-gzip
566 check_DATA += disk.gz
567 CLEANFILES += disk.gz
569 test_gzip_SOURCES = test-gzip.c test.h
570 test_gzip_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
571 test_gzip_LDADD = libtest.la $(LIBGUESTFS_LIBS)
580 test-info-address.sh \
581 test-info-base64.sh \
584 test-info-uptime.sh \
585 test-info-conntime.sh \
593 # linuxdisk plugin test.
596 test-linuxdisk-copy-out.sh \
599 # memory plugin test.
600 LIBGUESTFS_TESTS += test-memory
601 TESTS += test-memory-largest.sh test-memory-largest-for-qemu.sh
603 test_memory_SOURCES = test-memory.c test.h
604 test_memory_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
605 test_memory_LDADD = libtest.la $(LIBGUESTFS_LIBS)
607 # partitioning plugin test.
609 test-partitioning1.sh \
610 test-partitioning2.sh \
611 test-partitioning3.sh \
612 test-partitioning4.sh \
613 test-partitioning5.sh \
614 test-partitioning6.sh \
617 # pattern plugin test.
620 test-pattern-largest.sh \
621 test-pattern-largest-for-qemu.sh \
626 LIBGUESTFS_TESTS += test-nbd
628 test-nbd-extents.sh \
630 test-nbd-tls-psk.sh \
633 test_nbd_SOURCES = test-nbd.c test.h
634 test_nbd_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
635 test_nbd_LDADD = libtest.la $(LIBGUESTFS_LIBS)
636 endif HAVE_NBD_PLUGIN
639 LIBNBD_TESTS += test-null
640 TESTS += test-null-extents.sh
642 test_null_SOURCES = test-null.c
643 test_null_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
644 test_null_LDADD = $(LIBNBD_LIBS)
646 # random plugin test.
647 LIBNBD_TESTS += test-random
649 test_random_SOURCES = test-random.c
650 test_random_CPPFLAGS = -I $(top_srcdir)/common/include
651 test_random_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
652 test_random_LDADD = $(LIBNBD_LIBS)
654 # split files plugin test.
655 check_DATA += split1 split2 split3
656 CLEANFILES += split1 split2 split3
659 dd if=$< of=$@-t bs=1 count=100
663 dd if=$< of=$@-t bs=1 count=100 skip=100
667 dd if=$< of=$@-t bs=1 skip=200
669 LIBNBD_TESTS += test-split
671 test_split_SOURCES = test-split.c
672 test_split_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
673 test_split_LDADD = $(LIBNBD_LIBS)
677 # Uses ‘disk’ so we have to make it conditional on guestfish.
681 ssh/ssh_host_rsa_key ssh/ssh_host_rsa_key.pub \
682 ssh/authorized_keys \
684 SSH_RANDOM_PORT := $(shell bash -c 'echo $$(( 10000 + $$RANDOM ))')
688 ssh/authorized_keys \
691 ssh/ssh_host_rsa_key ssh/ssh_host_rsa_key.pub \
692 ssh/id_rsa ssh/id_rsa.pub \
693 stamp-ssh-host-key stamp-ssh-user-key \
696 ssh/sshd_config: ssh/sshd_config.in Makefile
699 -e 's,__abs_builddir__,$(abs_builddir),g' \
700 -e 's,__RANDOM_PORT__,$(SSH_RANDOM_PORT),g' \
704 ssh/ssh_host_rsa_key ssh/ssh_host_rsa_key.pub: stamp-ssh-host-key
707 rm -f ssh/ssh_host_rsa_key
708 rm -f ssh/ssh_host_rsa_key.pub
709 ssh-keygen -t rsa -f ssh/ssh_host_rsa_key -N ''
712 ssh/authorized_keys: ssh/id_rsa.pub
717 ssh/id_rsa ssh/id_rsa.pub: stamp-ssh-user-key
722 ssh-keygen -t rsa -f ssh/id_rsa -N ''
726 # streaming plugin test.
728 LIBNBD_TESTS += test-streaming
730 test_streaming_SOURCES = test-streaming.c
731 test_streaming_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
732 test_streaming_LDADD = $(LIBNBD_LIBS)
736 # This only tests that the plugin can be loaded against a
737 # dummy VDDK library, it is not a detailed test.
739 # check_LTLIBRARIES won't build a shared library (see automake manual).
740 # So we have to do this and add a dependency.
741 noinst_LTLIBRARIES += libvixDiskLib.la
747 libvixDiskLib_la_SOURCES = \
750 libvixDiskLib_la_CPPFLAGS = \
751 -I$(top_srcdir)/plugins/vddk \
753 libvixDiskLib_la_CXXFLAGS = $(WARNINGS_CFLAGS)
754 # For use of the -rpath option, see:
755 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
756 libvixDiskLib_la_LDFLAGS = \
757 -shared -version-number 6:0:0 -rpath /nowhere \
762 TESTS += test-zero.sh
764 # -D nbdkit.backend.* settings.
765 TESTS += test-nbdkit-backend-debug.sh
767 #----------------------------------------------------------------------
768 # Tests of language plugins.
773 LIBGUESTFS_TESTS += test-ocaml
775 # This is somewhat different from the other tests because we have
776 # to build an actual plugin here.
777 test_ocaml_SOURCES = test-ocaml.c test.h
778 test_ocaml_CFLAGS = \
780 $(LIBGUESTFS_CFLAGS) \
782 test_ocaml_LDADD = libtest.la $(LIBGUESTFS_LIBS)
784 check_SCRIPTS += test-ocaml-plugin.so
785 test-ocaml-plugin.so: test_ocaml_plugin.cmx ../plugins/ocaml/libnbdkitocaml.la ../plugins/ocaml/NBDKit.cmi ../plugins/ocaml/NBDKit.cmx
786 $(OCAMLOPT) $(OCAMLOPTFLAGS) -I ../plugins/ocaml \
787 -output-obj -runtime-variant _pic -o $@ \
789 -cclib -L../plugins/ocaml/.libs -cclib -lnbdkitocaml
790 test_ocaml_plugin.cmx: test_ocaml_plugin.ml ../plugins/ocaml/NBDKit.cmi
791 $(OCAMLOPT) $(OCAMLOPTFLAGS) -I ../plugins/ocaml -c $< -o $@
799 test-dump-plugin-example4.sh \
800 test-shebang-perl.sh \
802 LIBGUESTFS_TESTS += test-perl
804 test_perl_SOURCES = test-lang-plugins.c test.h
806 -DLANG='"perl"' -DSCRIPT='"$(srcdir)/test.pl"' \
808 $(LIBGUESTFS_CFLAGS) \
810 test_perl_LDADD = libtest.la $(LIBGUESTFS_LIBS)
814 # python plugin test.
819 test-python-exception.sh \
820 test-shebang-python.sh \
828 # Ruby tests are disabled. See "WARNING" section in
829 # plugins/ruby/nbdkit-ruby-plugin.pod
831 #LIBGUESTFS_TESTS += \
834 #TESTS += test-shebang-ruby.sh
835 EXTRA_PROGRAMS += test-ruby
837 test_ruby_SOURCES = test-lang-plugins.c test.h
839 -DLANG='"ruby"' -DSCRIPT='"$(srcdir)/test.rb"' \
841 $(LIBGUESTFS_CFLAGS) \
843 test_ruby_LDADD = libtest.la $(LIBGUESTFS_LIBS)
847 # Shell (sh) plugin test.
848 LIBGUESTFS_TESTS += test-shell
849 check_DATA += test-shell.img
850 CLEANFILES += test-shell.img
852 test_shell_SOURCES = test-lang-plugins.c test.h
853 test_shell_CFLAGS = \
854 -DLANG='"sh"' -DSCRIPT='"$(srcdir)/test-shell.sh"' \
856 $(LIBGUESTFS_CFLAGS) \
858 test_shell_LDADD = libtest.la $(LIBGUESTFS_LIBS)
861 truncate -s 1048576 $@
871 LIBGUESTFS_TESTS += test-tcl
873 test_tcl_SOURCES = test-lang-plugins.c test.h
875 -DLANG='"tcl"' -DSCRIPT='"$(srcdir)/test.tcl"' \
877 $(LIBGUESTFS_CFLAGS) \
879 test_tcl_LDADD = libtest.la $(LIBGUESTFS_LIBS)
886 LIBGUESTFS_TESTS += test-lua
888 test_lua_SOURCES = test-lang-plugins.c test.h
890 -DLANG='"lua"' -DSCRIPT='"$(srcdir)/test.lua"' \
892 $(LIBGUESTFS_CFLAGS) \
894 test_lua_LDADD = libtest.la $(LIBGUESTFS_LIBS)
898 #----------------------------------------------------------------------
901 # Generic test of filter layers.
902 check_PROGRAMS += test-layers
903 TESTS += test-layers.sh test-layers
905 test_layers_SOURCES = \
908 test_layers_CPPFLAGS = \
909 -I$(top_srcdir)/common/include \
910 -I$(top_srcdir)/common/protocol \
911 -I$(top_srcdir)/common/utils \
912 -I$(top_srcdir)/server \
914 test_layers_CFLAGS = \
918 test_layers_LDFLAGS = \
921 test_layers_LDADD = \
922 $(top_builddir)/common/utils/libutils.la \
924 test_layers_DEPENDENCIES = \
925 test-layers-plugin.la \
926 test-layers-filter1.la \
927 test-layers-filter2.la \
928 test-layers-filter3.la \
931 # check_LTLIBRARIES won't build a shared library (see automake manual).
932 # So we have to do this and add a dependency.
933 noinst_LTLIBRARIES += \
934 test-layers-plugin.la \
935 test-layers-filter1.la \
936 test-layers-filter2.la \
937 test-layers-filter3.la \
940 test_layers_plugin_la_SOURCES = \
941 test-layers-plugin.c \
942 $(top_srcdir)/include/nbdkit-plugin.h \
944 test_layers_plugin_la_CPPFLAGS = -I$(top_srcdir)/include
945 test_layers_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
946 # For use of the -rpath option, see:
947 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
948 test_layers_plugin_la_LDFLAGS = \
949 -module -avoid-version -shared -rpath /nowhere \
952 test_layers_filter1_la_SOURCES = \
953 test-layers-filter.c \
954 $(top_srcdir)/include/nbdkit-filter.h \
956 test_layers_filter1_la_CPPFLAGS = -I$(top_srcdir)/include
957 test_layers_filter1_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter1"'
958 # For use of the -rpath option, see:
959 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
960 test_layers_filter1_la_LDFLAGS = \
961 -module -avoid-version -shared -rpath /nowhere \
964 test_layers_filter2_la_SOURCES = \
965 test-layers-filter.c \
966 $(top_srcdir)/include/nbdkit-filter.h \
968 test_layers_filter2_la_CPPFLAGS = -I$(top_srcdir)/include
969 test_layers_filter2_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter2"'
970 # For use of the -rpath option, see:
971 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
972 test_layers_filter2_la_LDFLAGS = \
973 -module -avoid-version -shared -rpath /nowhere \
976 test_layers_filter3_la_SOURCES = \
977 test-layers-filter.c \
978 $(top_srcdir)/include/nbdkit-filter.h \
980 test_layers_filter3_la_CPPFLAGS = -I$(top_srcdir)/include
981 test_layers_filter3_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter3"'
982 # For use of the -rpath option, see:
983 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
984 test_layers_filter3_la_LDFLAGS = \
985 -module -avoid-version -shared -rpath /nowhere \
988 # blocksize filter test.
989 TESTS += test-blocksize.sh
994 test-cache-on-read.sh \
996 TESTS += test-cache-max-size.sh
998 # cacheextents filter test.
999 TESTS += test-cacheextents.sh
1007 # delay filter tests.
1008 TESTS += test-shutdown.sh
1009 LIBNBD_TESTS += test-delay
1011 test_delay_SOURCES = test-delay.c
1012 test_delay_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
1013 test_delay_LDADD = $(LIBNBD_LIBS)
1015 # error filter test.
1020 test-error-triggered.sh \
1023 # extentlist filter test.
1024 TESTS += test-extentlist.sh
1027 TESTS += test-fua.sh
1030 TESTS += test-ip-filter.sh
1033 TESTS += test-log.sh
1036 TESTS += test-nofilter.sh
1039 # nozero filter test.
1040 TESTS += test-nozero.sh
1041 endif HAVE_NBD_PLUGIN
1043 # offset filter test.
1044 LIBGUESTFS_TESTS += test-offset
1046 test_offset_SOURCES = test-offset.c test.h
1047 test_offset_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
1048 test_offset_LDADD = libtest.la $(LIBGUESTFS_LIBS)
1052 test-offset-extents.sh \
1055 # partition filter test.
1056 TESTS += test-partition1.sh
1057 TESTS += test-partition2.sh
1062 test-rate-dynamic.sh \
1065 # readahead filter test.
1068 test-readahead-copy.sh \
1071 # retry filter test.
1074 test-retry-readonly.sh \
1075 test-retry-extents.sh \
1076 test-retry-size.sh \
1077 test-retry-reopen-fail.sh \
1078 test-retry-zero-flags.sh \
1081 # truncate filter tests.
1087 test-truncate-extents.sh \
1092 LIBGUESTFS_TESTS += test-xz
1093 check_DATA += disk.xz
1094 CLEANFILES += disk.xz
1096 test_xz_SOURCES = test-xz.c test.h
1097 test_xz_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
1098 test_xz_LDADD = libtest.la $(LIBGUESTFS_LIBS)
1102 # We choose a very small block size here only for testing. Normally
1103 # you should choose a 16M block size.
1104 xz --best --block-size=32768 -c disk > $@
1108 LIBGUESTFS_TESTS += test-xz-curl
1110 test_xz_curl_SOURCES = \
1116 test_xz_curl_CPPFLAGS = \
1117 -I$(top_srcdir)/common/utils
1118 test_xz_curl_CFLAGS = \
1119 $(WARNINGS_CFLAGS) \
1120 $(LIBGUESTFS_CFLAGS) \
1123 test_xz_curl_LDFLAGS = \
1124 $(top_builddir)/common/utils/libutils.la \
1127 test_xz_curl_LDADD = \
1129 $(LIBGUESTFS_LIBS) \
1137 #----------------------------------------------------------------------
1138 # Tests of old plugins.
1141 test-old-plugins-x86_64-Linux-v1.0.0.sh \
1142 test-old-plugins-x86_64-Linux-v1.2.8.sh \
1143 test-old-plugins-x86_64-Linux-v1.8.4.sh \
1144 test-old-plugins-x86_64-Linux-v1.12.8.sh \
1147 test-old-plugins-%.sh:
1149 f=`echo "$@" | $(SED) 's/test-old-plugins-\(.*\).sh/\1/'`; \
1150 echo 'script=$@ exec $$srcdir/test-old-plugins.sh' "$$f" > $@-t
1155 old-plugins/README \
1156 old-plugins/*/*/*/nbdkit-file-plugin.so \
1157 test-old-plugins.sh \
1160 test-old-plugins-*.sh \
1163 #----------------------------------------------------------------------
1166 check_PROGRAMS += $(LIBNBD_TESTS)
1167 TESTS += $(LIBNBD_TESTS)
1171 check_PROGRAMS += $(LIBGUESTFS_TESTS)
1172 TESTS += $(LIBGUESTFS_TESTS)
1173 endif HAVE_LIBGUESTFS