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 \
114 test-export-name.sh \
116 test-file-extents.sh \
123 test-help-plugin.sh \
124 test-info-address.sh \
125 test-info-base64.sh \
128 test-info-uptime.sh \
129 test-info-conntime.sh \
135 test-linuxdisk-copy-out.sh \
139 test-memory-init.sh \
140 test-memory-largest.sh \
141 test-memory-largest-for-qemu.sh \
142 test-nbd-extents.sh \
144 test-nbd-tls-psk.sh \
145 test-nbdkit-backend-debug.sh \
148 test-null-extents.sh \
149 test_ocaml_plugin.ml \
152 test-offset-extents.sh \
153 test-parallel-file.sh \
154 test-parallel-nbd.sh \
155 test-parallel-sh.sh \
158 test-partitioning1.sh \
159 test-partitioning2.sh \
160 test-partitioning3.sh \
161 test-partitioning4.sh \
162 test-partitioning5.sh \
163 test-partitioning6.sh \
165 test-pattern-largest.sh \
166 test-pattern-largest-for-qemu.sh \
167 test-probe-filter.sh \
168 test-probe-plugin.sh \
169 test-python-exception.sh \
172 test-python-plugin.py \
175 test-rate-dynamic.sh \
178 test-readahead-copy.sh \
179 test-readahead-test-plugin.sh \
180 test-readahead-test-request.py \
182 test-retry-extents.sh \
184 test-retry-readonly.sh \
185 test-retry-reopen-fail.sh \
186 test-retry-zero-flags.sh \
191 test-shebang-perl.sh \
192 test-shebang-python.sh \
193 test-shebang-ruby.sh \
198 test-single-from-file.sh \
199 test-split-extents.sh \
201 test-random-sock.sh \
208 test-truncate-extents.sh \
212 test-version-filter.sh \
213 test-version-plugin.sh \
218 #----------------------------------------------------------------------
219 # Use 'make check' to run the ordinary tests as non-root. The
220 # following are special commands for particular scenarios:
222 # To run all the tests under valgrind, use the following rule:
224 NBDKIT_VALGRIND=1 $(MAKE) check
226 # To run only tests which require root, use:
228 $(MAKE) check TESTS="test-file-block test-swap.sh"
231 # Run a basic check against a real copy of VDDK. You must set
232 # vddkdir to point to the library location, eg:
234 # make check-vddk vddkdir=vmware-vix-disklib-distrib
236 $(MAKE) check TESTS=test-vddk-real.sh
239 #----------------------------------------------------------------------
240 # Basic server command line and start-up tests.
245 test-dump-config.sh \
251 test-help-plugin.sh \
252 test-version-plugin.sh \
253 test-version-filter.sh \
254 test-probe-filter.sh \
255 test-probe-plugin.sh \
256 test-dump-plugin.sh \
259 test-single-from-file.sh \
261 test-random-sock.sh \
266 test-socket-activation \
268 test-debug-flags.sh \
274 test-socket-activation \
277 test_socket_activation_SOURCES = test-socket-activation.c
278 test_socket_activation_CPPFLAGS = \
279 -I$(top_srcdir)/common/include \
280 -I$(top_srcdir)/common/protocol \
282 test_socket_activation_CFLAGS = $(WARNINGS_CFLAGS)
286 # Test the header files can be included on their own.
288 test-just-plugin-header \
289 test-just-filter-header
292 test-just-plugin-header \
293 test-just-filter-header
296 test_just_plugin_header_SOURCES = \
297 test-just-plugin-header.c \
299 test_just_plugin_header_CPPFLAGS = \
300 -I$(top_srcdir)/include \
302 test_just_plugin_header_CFLAGS = $(WARNINGS_CFLAGS)
304 test_just_filter_header_SOURCES = \
305 test-just-filter-header.c \
307 test_just_filter_header_CPPFLAGS = \
308 -I$(top_srcdir)/include \
310 test_just_filter_header_CFLAGS = $(WARNINGS_CFLAGS)
313 # This builds a plugin using an ANSI (ISO C90) compiler to ensure that
314 # the header file is compatible. The plugin does nothing very
315 # interesting, it's mainly a compile test.
319 # check_LTLIBRARIES won't build a shared library (see automake manual).
320 # So we have to do this and add a dependency.
321 noinst_LTLIBRARIES += test-ansi-c-plugin.la
322 test-ansi-c.sh: test-ansi-c-plugin.la
324 test_ansi_c_plugin_la_SOURCES = \
325 test-ansi-c-plugin.c \
326 $(top_srcdir)/include/nbdkit-plugin.h \
328 test_ansi_c_plugin_la_CPPFLAGS = \
330 -I$(top_srcdir)/include \
332 test_ansi_c_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
333 # For use of the -rpath option, see:
334 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
335 test_ansi_c_plugin_la_LDFLAGS = \
336 -module -avoid-version -shared -rpath /nowhere \
338 endif CAN_TEST_ANSI_C
341 # This builds a plugin and a filter using the C++ compiler. They
342 # don't do anything interesting when run.
346 # check_LTLIBRARIES won't build a shared library (see automake manual).
347 # So we have to do this and add a dependency.
348 noinst_LTLIBRARIES += test-cxx-plugin.la test-cxx-filter.la
349 test-cxx.sh: test-cxx-plugin.la test-cxx-filter.la
351 test_cxx_plugin_la_SOURCES = \
352 test-cxx-plugin.cpp \
353 $(top_srcdir)/include/nbdkit-plugin.h \
355 test_cxx_plugin_la_CPPFLAGS = \
356 -I$(top_srcdir)/include \
358 test_cxx_plugin_la_CXXFLAGS = $(WARNINGS_CFLAGS)
359 # For use of the -rpath option, see:
360 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
361 test_cxx_plugin_la_LDFLAGS = \
362 -module -avoid-version -shared -rpath /nowhere \
365 test_cxx_filter_la_SOURCES = \
366 test-cxx-filter.cpp \
367 $(top_srcdir)/include/nbdkit-filter.h \
369 test_cxx_filter_la_CPPFLAGS = \
370 -I$(top_srcdir)/include \
372 test_cxx_filter_la_CXXFLAGS = $(WARNINGS_CFLAGS)
373 # For use of the -rpath option, see:
374 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
375 test_cxx_filter_la_LDFLAGS = \
376 -module -avoid-version -shared -rpath /nowhere \
380 # Exit with parent test.
381 check_PROGRAMS += test-exit-with-parent
382 TESTS += test-exit-with-parent
384 test_exit_with_parent_SOURCES = \
385 test-exit-with-parent.c test.h \
387 test_exit_with_parent_CPPFLAGS = \
388 -I$(top_srcdir)/common/include \
390 test_exit_with_parent_CFLAGS = \
392 $(LIBGUESTFS_CFLAGS) \
395 # PKI files for the TLS tests.
396 check_DATA += pki/.stamp
397 pki/.stamp: $(srcdir)/make-pki.sh
398 SRCDIR=$(srcdir) $(srcdir)/make-pki.sh
400 # PSK keys for the TLS-PSK tests.
401 check_DATA += keys.psk
402 keys.psk: $(srcdir)/make-psk.sh
403 SRCDIR=$(srcdir) $(srcdir)/make-psk.sh
405 # Keys are expensive to recreate so only delete them when we do
406 # ‘make distclean’.
407 DISTCLEANFILES = keys.psk
408 distclean-local: distclean-local-tls
412 #----------------------------------------------------------------------
413 # Tests of C plugins or tests which require plugins.
417 # Common data shared by multiple tests
418 check_DATA += file-data
419 CLEANFILES += file-data
420 file-data: generate-file-data.sh
421 $(srcdir)/generate-file-data.sh $@
423 # While most tests need libguestfs, testing parallel I/O is easier when
424 # using qemu-io to kick off asynchronous requests.
426 test-parallel-file.sh \
427 test-parallel-nbd.sh \
428 test-parallel-sh.sh \
431 # Common test library.
432 check_LTLIBRARIES += libtest.la
433 libtest_la_SOURCES = test.c test.h
434 libtest_la_CFLAGS = $(WARNINGS_CFLAGS)
436 # Basic connection test.
437 LIBNBD_TESTS += test-connect
439 test_connect_SOURCES = test-connect.c
440 test_connect_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
441 test_connect_LDADD = $(LIBNBD_LIBS)
443 # newstyle protocol test.
444 LIBNBD_TESTS += test-newstyle
446 test_newstyle_SOURCES = test-newstyle.c
447 test_newstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
448 test_newstyle_LDADD = $(LIBNBD_LIBS)
450 # oldstyle protocol test.
451 LIBNBD_TESTS += test-oldstyle
453 test_oldstyle_SOURCES = test-oldstyle.c
454 test_oldstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
455 test_oldstyle_LDADD = $(LIBNBD_LIBS)
458 TESTS += test-eflags.sh
461 TESTS += test-export-name.sh
463 # common disk image shared with several tests
468 rm -rf disk.tmp $@ $@-t
470 echo -n "hello,world" > disk.tmp/hello.txt
471 $(top_builddir)/nbdkit -fv -U - linuxdisk disk.tmp size=100M \
472 --run 'qemu-img convert $$nbd $@-t'
478 LIBGUESTFS_TESTS += test-curl
480 test_curl_SOURCES = \
486 test_curl_CPPFLAGS = \
487 -I$(top_srcdir)/common/utils
490 $(LIBGUESTFS_CFLAGS) \
493 test_curl_LDFLAGS = \
494 $(top_builddir)/common/utils/libutils.la \
504 LIBGUESTFS_TESTS += test-data
507 test-data-base64.sh \
508 test-data-extents.sh \
513 test_data_SOURCES = test-data.c test.h
514 test_data_CPPFLAGS = -I$(top_srcdir)/common/include
515 test_data_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
516 test_data_LDADD = libtest.la $(LIBGUESTFS_LIBS)
519 TESTS += test-eval.sh test-eval-init.sh
525 LIBGUESTFS_TESTS += test-ext2
526 check_DATA += ext2.img
527 CLEANFILES += ext2.img
534 mkfs ext4 /dev/sda : \
537 upload $< /disks/disk.img
540 test_ext2_SOURCES = test-ext2.c test.h
541 test_ext2_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
542 test_ext2_LDADD = libtest.la $(LIBGUESTFS_LIBS)
548 LIBNBD_TESTS += test-file
549 LIBGUESTFS_TESTS += test-file-block
551 test_file_SOURCES = test-file.c
552 test_file_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
553 test_file_LDADD = $(LIBNBD_LIBS)
555 test_file_block_SOURCES = test-file-block.c test.h
556 test_file_block_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
557 test_file_block_LDADD = libtest.la $(LIBGUESTFS_LIBS)
559 TESTS += test-file-extents.sh test-file-init.sh
561 # floppy plugin test.
562 TESTS += test-floppy.sh
565 TESTS += test-full.sh
569 LIBGUESTFS_TESTS += test-gzip
570 check_DATA += disk.gz
571 CLEANFILES += disk.gz
573 test_gzip_SOURCES = test-gzip.c test.h
574 test_gzip_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
575 test_gzip_LDADD = libtest.la $(LIBGUESTFS_LIBS)
584 test-info-address.sh \
585 test-info-base64.sh \
588 test-info-uptime.sh \
589 test-info-conntime.sh \
597 # linuxdisk plugin test.
600 test-linuxdisk-copy-out.sh \
603 # memory plugin test.
604 LIBGUESTFS_TESTS += test-memory
605 TESTS += test-memory-largest.sh test-memory-largest-for-qemu.sh
606 TESTS += test-memory-init.sh
608 test_memory_SOURCES = test-memory.c test.h
609 test_memory_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
610 test_memory_LDADD = libtest.la $(LIBGUESTFS_LIBS)
612 # partitioning plugin test.
614 test-partitioning1.sh \
615 test-partitioning2.sh \
616 test-partitioning3.sh \
617 test-partitioning4.sh \
618 test-partitioning5.sh \
619 test-partitioning6.sh \
622 # pattern plugin test.
625 test-pattern-largest.sh \
626 test-pattern-largest-for-qemu.sh \
631 LIBGUESTFS_TESTS += test-nbd
633 test-nbd-extents.sh \
635 test-nbd-tls-psk.sh \
638 test_nbd_SOURCES = test-nbd.c test.h
639 test_nbd_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
640 test_nbd_LDADD = libtest.la $(LIBGUESTFS_LIBS)
641 endif HAVE_NBD_PLUGIN
644 LIBNBD_TESTS += test-null
645 TESTS += test-null-extents.sh
647 test_null_SOURCES = test-null.c
648 test_null_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
649 test_null_LDADD = $(LIBNBD_LIBS)
651 # random plugin test.
652 LIBNBD_TESTS += test-random
654 test_random_SOURCES = test-random.c
655 test_random_CPPFLAGS = -I $(top_srcdir)/common/include
656 test_random_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
657 test_random_LDADD = $(LIBNBD_LIBS)
659 # split files plugin test.
660 check_DATA += split1 split2 split3
661 CLEANFILES += split1 split2 split3
664 dd if=$< of=$@-t bs=1 count=100
668 dd if=$< of=$@-t bs=1 count=100 skip=100
672 dd if=$< of=$@-t bs=1 skip=200
674 LIBNBD_TESTS += test-split
676 test_split_SOURCES = test-split.c
677 test_split_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
678 test_split_LDADD = $(LIBNBD_LIBS)
680 TESTS += test-split-extents.sh
684 # Uses ‘disk’ so we have to make it conditional on guestfish.
688 ssh/ssh_host_rsa_key ssh/ssh_host_rsa_key.pub \
689 ssh/authorized_keys \
691 SSH_RANDOM_PORT := $(shell bash -c 'echo $$(( 10000 + $$RANDOM ))')
695 ssh/authorized_keys \
698 ssh/ssh_host_rsa_key ssh/ssh_host_rsa_key.pub \
699 ssh/id_rsa ssh/id_rsa.pub \
700 stamp-ssh-host-key stamp-ssh-user-key \
703 ssh/sshd_config: ssh/sshd_config.in Makefile
706 -e 's,__abs_builddir__,$(abs_builddir),g' \
707 -e 's,__RANDOM_PORT__,$(SSH_RANDOM_PORT),g' \
711 ssh/ssh_host_rsa_key ssh/ssh_host_rsa_key.pub: stamp-ssh-host-key
714 rm -f ssh/ssh_host_rsa_key
715 rm -f ssh/ssh_host_rsa_key.pub
716 ssh-keygen -t rsa -f ssh/ssh_host_rsa_key -N ''
719 ssh/authorized_keys: ssh/id_rsa.pub
724 ssh/id_rsa ssh/id_rsa.pub: stamp-ssh-user-key
729 ssh-keygen -t rsa -f ssh/id_rsa -N ''
733 # streaming plugin test.
735 LIBNBD_TESTS += test-streaming
737 test_streaming_SOURCES = test-streaming.c
738 test_streaming_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
739 test_streaming_LDADD = $(LIBNBD_LIBS)
743 # This only tests that the plugin can be loaded against a
744 # dummy VDDK library, it is not a detailed test.
746 # check_LTLIBRARIES won't build a shared library (see automake manual).
747 # So we have to do this and add a dependency.
748 noinst_LTLIBRARIES += libvixDiskLib.la
754 libvixDiskLib_la_SOURCES = \
757 libvixDiskLib_la_CPPFLAGS = \
758 -I$(top_srcdir)/plugins/vddk \
760 libvixDiskLib_la_CXXFLAGS = $(WARNINGS_CFLAGS)
761 # For use of the -rpath option, see:
762 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
763 libvixDiskLib_la_LDFLAGS = \
764 -shared -version-number 6:0:0 -rpath /nowhere \
769 TESTS += test-zero.sh
771 # -D nbdkit.backend.* settings.
772 TESTS += test-nbdkit-backend-debug.sh
774 #----------------------------------------------------------------------
775 # Tests of language plugins.
780 LIBGUESTFS_TESTS += test-ocaml
782 # This is somewhat different from the other tests because we have
783 # to build an actual plugin here.
784 test_ocaml_SOURCES = test-ocaml.c test.h
785 test_ocaml_CFLAGS = \
787 $(LIBGUESTFS_CFLAGS) \
789 test_ocaml_LDADD = libtest.la $(LIBGUESTFS_LIBS)
791 check_SCRIPTS += test-ocaml-plugin.so
792 test-ocaml-plugin.so: test_ocaml_plugin.cmx ../plugins/ocaml/libnbdkitocaml.la ../plugins/ocaml/NBDKit.cmi ../plugins/ocaml/NBDKit.cmx
793 $(OCAMLOPT) $(OCAMLOPTFLAGS) -I ../plugins/ocaml \
794 -output-obj -runtime-variant _pic -o $@ \
796 -cclib -L../plugins/ocaml/.libs -cclib -lnbdkitocaml
797 test_ocaml_plugin.cmx: test_ocaml_plugin.ml ../plugins/ocaml/NBDKit.cmi
798 $(OCAMLOPT) $(OCAMLOPTFLAGS) -I ../plugins/ocaml -c $< -o $@
806 test-dump-plugin-example4.sh \
807 test-shebang-perl.sh \
809 LIBGUESTFS_TESTS += test-perl
811 test_perl_SOURCES = test-lang-plugins.c test.h
813 -DLANG='"perl"' -DSCRIPT='"$(srcdir)/test.pl"' \
815 $(LIBGUESTFS_CFLAGS) \
817 test_perl_LDADD = libtest.la $(LIBGUESTFS_LIBS)
821 # python plugin test.
826 test-python-exception.sh \
827 test-shebang-python.sh \
835 # Ruby tests are disabled. See "WARNING" section in
836 # plugins/ruby/nbdkit-ruby-plugin.pod
838 #LIBGUESTFS_TESTS += \
841 #TESTS += test-shebang-ruby.sh
842 EXTRA_PROGRAMS += test-ruby
844 test_ruby_SOURCES = test-lang-plugins.c test.h
846 -DLANG='"ruby"' -DSCRIPT='"$(srcdir)/test.rb"' \
848 $(LIBGUESTFS_CFLAGS) \
850 test_ruby_LDADD = libtest.la $(LIBGUESTFS_LIBS)
854 # Shell (sh) plugin test.
855 LIBGUESTFS_TESTS += test-shell
856 check_DATA += test-shell.img
857 CLEANFILES += test-shell.img
859 test_shell_SOURCES = test-lang-plugins.c test.h
860 test_shell_CFLAGS = \
861 -DLANG='"sh"' -DSCRIPT='"$(srcdir)/test-shell.sh"' \
863 $(LIBGUESTFS_CFLAGS) \
865 test_shell_LDADD = libtest.la $(LIBGUESTFS_LIBS)
868 truncate -s 1048576 $@
878 LIBGUESTFS_TESTS += test-tcl
880 test_tcl_SOURCES = test-lang-plugins.c test.h
882 -DLANG='"tcl"' -DSCRIPT='"$(srcdir)/test.tcl"' \
884 $(LIBGUESTFS_CFLAGS) \
886 test_tcl_LDADD = libtest.la $(LIBGUESTFS_LIBS)
893 LIBGUESTFS_TESTS += test-lua
895 test_lua_SOURCES = test-lang-plugins.c test.h
897 -DLANG='"lua"' -DSCRIPT='"$(srcdir)/test.lua"' \
899 $(LIBGUESTFS_CFLAGS) \
901 test_lua_LDADD = libtest.la $(LIBGUESTFS_LIBS)
905 #----------------------------------------------------------------------
908 # Generic test of filter layers.
909 check_PROGRAMS += test-layers
910 TESTS += test-layers.sh test-layers
912 test_layers_SOURCES = \
915 test_layers_CPPFLAGS = \
916 -I$(top_srcdir)/common/include \
917 -I$(top_srcdir)/common/protocol \
918 -I$(top_srcdir)/common/utils \
919 -I$(top_srcdir)/server \
921 test_layers_CFLAGS = \
925 test_layers_LDFLAGS = \
928 test_layers_LDADD = \
929 $(top_builddir)/common/utils/libutils.la \
931 test_layers_DEPENDENCIES = \
932 test-layers-plugin.la \
933 test-layers-filter1.la \
934 test-layers-filter2.la \
935 test-layers-filter3.la \
938 # check_LTLIBRARIES won't build a shared library (see automake manual).
939 # So we have to do this and add a dependency.
940 noinst_LTLIBRARIES += \
941 test-layers-plugin.la \
942 test-layers-filter1.la \
943 test-layers-filter2.la \
944 test-layers-filter3.la \
947 test_layers_plugin_la_SOURCES = \
948 test-layers-plugin.c \
949 $(top_srcdir)/include/nbdkit-plugin.h \
951 test_layers_plugin_la_CPPFLAGS = -I$(top_srcdir)/include
952 test_layers_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
953 # For use of the -rpath option, see:
954 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
955 test_layers_plugin_la_LDFLAGS = \
956 -module -avoid-version -shared -rpath /nowhere \
959 test_layers_filter1_la_SOURCES = \
960 test-layers-filter.c \
961 $(top_srcdir)/include/nbdkit-filter.h \
963 test_layers_filter1_la_CPPFLAGS = -I$(top_srcdir)/include
964 test_layers_filter1_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter1"'
965 # For use of the -rpath option, see:
966 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
967 test_layers_filter1_la_LDFLAGS = \
968 -module -avoid-version -shared -rpath /nowhere \
971 test_layers_filter2_la_SOURCES = \
972 test-layers-filter.c \
973 $(top_srcdir)/include/nbdkit-filter.h \
975 test_layers_filter2_la_CPPFLAGS = -I$(top_srcdir)/include
976 test_layers_filter2_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter2"'
977 # For use of the -rpath option, see:
978 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
979 test_layers_filter2_la_LDFLAGS = \
980 -module -avoid-version -shared -rpath /nowhere \
983 test_layers_filter3_la_SOURCES = \
984 test-layers-filter.c \
985 $(top_srcdir)/include/nbdkit-filter.h \
987 test_layers_filter3_la_CPPFLAGS = -I$(top_srcdir)/include
988 test_layers_filter3_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter3"'
989 # For use of the -rpath option, see:
990 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
991 test_layers_filter3_la_LDFLAGS = \
992 -module -avoid-version -shared -rpath /nowhere \
995 # blocksize filter test.
996 TESTS += test-blocksize.sh
1001 test-cache-on-read.sh \
1003 TESTS += test-cache-max-size.sh
1005 # cacheextents filter test.
1006 TESTS += test-cacheextents.sh
1014 # delay filter tests.
1015 TESTS += test-shutdown.sh
1016 LIBNBD_TESTS += test-delay
1018 test_delay_SOURCES = test-delay.c
1019 test_delay_CFLAGS = $(WARNINGS_CFLAGS) $(LIBNBD_CFLAGS)
1020 test_delay_LDADD = $(LIBNBD_LIBS)
1022 # error filter test.
1027 test-error-triggered.sh \
1030 # extentlist filter test.
1031 TESTS += test-extentlist.sh
1034 TESTS += test-fua.sh
1037 TESTS += test-ip-filter.sh
1040 TESTS += test-log.sh
1043 TESTS += test-nofilter.sh
1046 # nozero filter test.
1047 TESTS += test-nozero.sh
1048 endif HAVE_NBD_PLUGIN
1050 # offset filter test.
1051 LIBGUESTFS_TESTS += test-offset
1053 test_offset_SOURCES = test-offset.c test.h
1054 test_offset_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
1055 test_offset_LDADD = libtest.la $(LIBGUESTFS_LIBS)
1059 test-offset-extents.sh \
1062 # partition filter test.
1063 TESTS += test-partition1.sh
1064 TESTS += test-partition2.sh
1069 test-rate-dynamic.sh \
1072 # readahead filter test.
1075 test-readahead-copy.sh \
1078 # retry filter test.
1081 test-retry-readonly.sh \
1082 test-retry-extents.sh \
1083 test-retry-size.sh \
1084 test-retry-reopen-fail.sh \
1085 test-retry-zero-flags.sh \
1088 # truncate filter tests.
1094 test-truncate-extents.sh \
1099 LIBGUESTFS_TESTS += test-xz
1100 check_DATA += disk.xz
1101 CLEANFILES += disk.xz
1103 test_xz_SOURCES = test-xz.c test.h
1104 test_xz_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
1105 test_xz_LDADD = libtest.la $(LIBGUESTFS_LIBS)
1109 # We choose a very small block size here only for testing. Normally
1110 # you should choose a 16M block size.
1111 xz --best --block-size=32768 -c disk > $@
1115 LIBGUESTFS_TESTS += test-xz-curl
1117 test_xz_curl_SOURCES = \
1123 test_xz_curl_CPPFLAGS = \
1124 -I$(top_srcdir)/common/utils
1125 test_xz_curl_CFLAGS = \
1126 $(WARNINGS_CFLAGS) \
1127 $(LIBGUESTFS_CFLAGS) \
1130 test_xz_curl_LDFLAGS = \
1131 $(top_builddir)/common/utils/libutils.la \
1134 test_xz_curl_LDADD = \
1136 $(LIBGUESTFS_LIBS) \
1144 #----------------------------------------------------------------------
1145 # Tests of old plugins.
1148 test-old-plugins-x86_64-Linux-v1.0.0.sh \
1149 test-old-plugins-x86_64-Linux-v1.2.8.sh \
1150 test-old-plugins-x86_64-Linux-v1.8.4.sh \
1151 test-old-plugins-x86_64-Linux-v1.12.8.sh \
1154 test-old-plugins-%.sh:
1156 f=`echo "$@" | $(SED) 's/test-old-plugins-\(.*\).sh/\1/'`; \
1157 echo 'script=$@ exec $$srcdir/test-old-plugins.sh' "$$f" > $@-t
1162 old-plugins/README \
1163 old-plugins/*/*/*/nbdkit-file-plugin.so \
1164 test-old-plugins.sh \
1167 test-old-plugins-*.sh \
1170 #----------------------------------------------------------------------
1173 check_PROGRAMS += $(LIBNBD_TESTS)
1174 TESTS += $(LIBNBD_TESTS)
1178 check_PROGRAMS += $(LIBGUESTFS_TESTS)
1179 TESTS += $(LIBGUESTFS_TESTS)
1180 endif HAVE_LIBGUESTFS