2 # Copyright (C) 2013-2019 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
35 generate-file-data.sh \
36 generate-offset-data.sh \
48 test-cache-max-size.sh \
49 test-cache-on-read.sh \
50 test-cacheextents.sh \
56 test-data-extents.sh \
62 test-dump-plugin-example4.sh \
67 test-file-extents.sh \
78 test-linuxdisk-copy-out.sh \
81 test-memory-largest.sh \
82 test-memory-largest-for-qemu.sh \
87 test-null-extents.sh \
88 test_ocaml_plugin.ml \
91 test-offset-extents.sh \
92 test-parallel-file.sh \
93 test-parallel-nbd.sh \
96 test-partitioning1.sh \
97 test-partitioning2.sh \
98 test-partitioning3.sh \
99 test-partitioning4.sh \
100 test-partitioning5.sh \
101 test-partitioning6.sh \
103 test-pattern-largest.sh \
104 test-pattern-largest-for-qemu.sh \
105 test-python-exception.sh \
109 test-rate-dynamic.sh \
111 test-readahead-copy.sh \
114 test-shebang-perl.sh \
115 test-shebang-python.sh \
116 test-shebang-ruby.sh \
120 test-single-from-file.sh \
122 test-random-sock.sh \
129 test-truncate-extents.sh \
133 test-version-filter.sh \
134 test-version-plugin.sh \
137 # Use 'make check' to run the ordinary tests. To run all the tests
138 # under valgrind, use the following rule:
140 NBDKIT_VALGRIND=1 $(MAKE) check
142 # To run only tests which require root, use:
144 $(MAKE) check TESTS="test-file-block"
146 # Run a basic check against a real copy of VDDK. You must set
147 # vddkdir to point to the library location, eg:
149 # make check-vddk vddkdir=vmware-vix-disklib-distrib
151 $(MAKE) check TESTS=test-vddk-real.sh
153 #----------------------------------------------------------------------
154 # Basic server command line and start-up tests.
162 # Ensure we're testing the local copy by running everything through
163 # the nbdkit helper script in the top build directory.
164 TESTS_ENVIRONMENT = PATH=$(abs_top_builddir):$(PATH) SRCDIR=$(srcdir)
174 test-help-plugin.sh \
175 test-version-plugin.sh \
176 test-version-filter.sh \
177 test-dump-plugin.sh \
180 test-single-from-file.sh \
182 test-random-sock.sh \
186 test-socket-activation \
191 test-socket-activation
193 test_socket_activation_SOURCES = test-socket-activation.c
194 test_socket_activation_CFLAGS = $(WARNINGS_CFLAGS)
198 # Test the header files can be included on their own.
200 test-just-plugin-header \
201 test-just-filter-header
203 test-just-plugin-header \
204 test-just-filter-header
206 test_just_plugin_header_SOURCES = \
207 test-just-plugin-header.c
208 test_just_plugin_header_CPPFLAGS = \
209 -I$(top_srcdir)/include
210 test_just_plugin_header_CFLAGS = \
213 test_just_filter_header_SOURCES = \
214 test-just-filter-header.c
215 test_just_filter_header_CPPFLAGS = \
216 -I$(top_srcdir)/include
217 test_just_filter_header_CFLAGS = \
221 # This builds a plugin using an ANSI (ISO C90) compiler to ensure that
222 # the header file is compatible. The plugin does nothing very
223 # interesting, it's mainly a compile test.
226 # check_LTLIBRARIES won't build a shared library (see automake manual).
227 # So we have to do this and add a dependency.
228 noinst_LTLIBRARIES += test-ansi-c-plugin.la
229 test-ansi-c.sh: test-ansi-c-plugin.la
231 test_ansi_c_plugin_la_SOURCES = \
232 test-ansi-c-plugin.c \
233 $(top_srcdir)/include/nbdkit-plugin.h
234 test_ansi_c_plugin_la_CPPFLAGS = \
236 -I$(top_srcdir)/include
237 test_ansi_c_plugin_la_CFLAGS = \
239 # For use of the -rpath option, see:
240 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
241 test_ansi_c_plugin_la_LDFLAGS = \
242 -module -avoid-version -shared -rpath /nowhere
243 endif CAN_TEST_ANSI_C
246 # This builds a plugin and a filter using the C++ compiler. They
247 # don't do anything interesting when run.
250 # check_LTLIBRARIES won't build a shared library (see automake manual).
251 # So we have to do this and add a dependency.
252 noinst_LTLIBRARIES += test-cxx-plugin.la test-cxx-filter.la
253 test-cxx.sh: test-cxx-plugin.la test-cxx-filter.la
255 test_cxx_plugin_la_SOURCES = \
256 test-cxx-plugin.cpp \
257 $(top_srcdir)/include/nbdkit-plugin.h
258 test_cxx_plugin_la_CPPFLAGS = \
259 -I$(top_srcdir)/include
260 test_cxx_plugin_la_CXXFLAGS = \
262 # For use of the -rpath option, see:
263 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
264 test_cxx_plugin_la_LDFLAGS = \
265 -module -avoid-version -shared -rpath /nowhere
267 test_cxx_filter_la_SOURCES = \
268 test-cxx-filter.cpp \
269 $(top_srcdir)/include/nbdkit-filter.h
270 test_cxx_filter_la_CPPFLAGS = \
271 -I$(top_srcdir)/include
272 test_cxx_filter_la_CXXFLAGS = \
274 # For use of the -rpath option, see:
275 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
276 test_cxx_filter_la_LDFLAGS = \
277 -module -avoid-version -shared -rpath /nowhere
280 # Exit with parent test.
281 check_PROGRAMS += test-exit-with-parent
282 TESTS += test-exit-with-parent
284 test_exit_with_parent_SOURCES = \
285 test-exit-with-parent.c test.h
286 test_exit_with_parent_CPPFLAGS = \
287 -I$(top_srcdir)/common/include
288 test_exit_with_parent_CFLAGS = \
289 $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
291 # PKI files for the TLS tests.
292 check_DATA += pki/.stamp
293 pki/.stamp: $(srcdir)/make-pki.sh
294 SRCDIR=$(srcdir) $(srcdir)/make-pki.sh
296 # PSK keys for the TLS-PSK tests.
297 check_DATA += keys.psk
298 keys.psk: $(srcdir)/make-psk.sh
299 SRCDIR=$(srcdir) $(srcdir)/make-psk.sh
301 # Keys are expensive to recreate so only delete them when we do
302 # ‘make distclean’.
303 DISTCLEANFILES = keys.psk
304 distclean-local: distclean-local-tls
308 #----------------------------------------------------------------------
309 # Tests of C plugins or tests which require plugins.
313 # Common data shared by multiple tests
314 check_DATA += file-data
315 CLEANFILES += file-data
316 file-data: generate-file-data.sh
317 $(srcdir)/generate-file-data.sh $@
319 # While most tests need libguestfs, testing parallel I/O is easier when
320 # using qemu-io to kick off asynchronous requests.
322 test-parallel-file.sh \
325 # Most in-depth tests need libguestfs, since that is a convenient way to
330 check_PROGRAMS += $(LIBGUESTFS_TESTS)
331 TESTS += $(LIBGUESTFS_TESTS)
333 # Use the 'direct' backend, and ensure maximum libguestfs debugging is
334 # written to the *.log files in case there is a problem.
335 TESTS_ENVIRONMENT += \
336 LIBGUESTFS_ATTACH_METHOD=appliance \
339 LD_LIBRARY_PATH=../plugins/ocaml/.libs:$(LD_LIBRARY_PATH) \
340 LIBRARY_PATH=../plugins/ocaml/.libs:$(LIBRARY_PATH)
342 # Common test library.
343 check_LTLIBRARIES += libtest.la
344 libtest_la_SOURCES = test.c test.h
345 libtest_la_CFLAGS = $(WARNINGS_CFLAGS)
347 # Basic connection test.
348 LIBGUESTFS_TESTS += test-connect
350 test_connect_SOURCES = test-connect.c test.h
351 test_connect_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
352 test_connect_LDADD = libtest.la $(LIBGUESTFS_LIBS)
354 # newstyle protocol test.
355 LIBGUESTFS_TESTS += test-newstyle
357 test_newstyle_SOURCES = test-newstyle.c test.h
358 test_newstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
359 test_newstyle_LDADD = libtest.la $(LIBGUESTFS_LIBS)
361 # oldstyle protocol test.
362 LIBGUESTFS_TESTS += test-oldstyle
364 test_oldstyle_SOURCES = test-oldstyle.c test.h
365 test_oldstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
366 test_oldstyle_LDADD = libtest.la $(LIBGUESTFS_LIBS)
368 endif HAVE_LIBGUESTFS
371 TESTS += test-eflags.sh
373 # common disk image shared with several tests
380 guestfish -N $@-t=fs:ext4:100M -m /dev/sda1 \
381 write /hello.txt "hello,world"
392 LIBGUESTFS_TESTS += test-curl
394 test_curl_SOURCES = \
401 $(LIBGUESTFS_CFLAGS) \
403 test_curl_LDFLAGS = \
413 LIBGUESTFS_TESTS += test-data
416 test-data-base64.sh \
417 test-data-extents.sh \
421 test_data_SOURCES = test-data.c test.h
422 test_data_CPPFLAGS = -I$(top_srcdir)/common/include
423 test_data_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
424 test_data_LDADD = libtest.la $(LIBGUESTFS_LIBS)
430 LIBGUESTFS_TESTS += test-ext2
431 check_DATA += ext2.img
432 CLEANFILES += ext2.img
439 mkfs ext4 /dev/sda : \
442 upload $< /disks/disk.img
445 test_ext2_SOURCES = test-ext2.c test.h
446 test_ext2_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
447 test_ext2_LDADD = libtest.la $(LIBGUESTFS_LIBS)
453 LIBGUESTFS_TESTS += test-file test-file-block
455 test_file_SOURCES = test-file.c test.h
456 test_file_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
457 test_file_LDADD = libtest.la $(LIBGUESTFS_LIBS)
459 test_file_block_SOURCES = test-file-block.c test.h
460 test_file_block_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
461 test_file_block_LDADD = libtest.la $(LIBGUESTFS_LIBS)
464 TESTS += test-file-extents.sh
467 # floppy plugin test.
469 TESTS += test-floppy.sh
473 TESTS += test-full.sh
479 LIBGUESTFS_TESTS += test-gzip
480 check_DATA += disk.gz
481 CLEANFILES += disk.gz
483 test_gzip_SOURCES = test-gzip.c test.h
484 test_gzip_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
485 test_gzip_LDADD = libtest.la $(LIBGUESTFS_LIBS)
503 # linuxdisk plugin test.
507 test-linuxdisk-copy-out.sh
510 # memory plugin test.
511 LIBGUESTFS_TESTS += test-memory
512 TESTS += test-memory-largest.sh test-memory-largest-for-qemu.sh
514 test_memory_SOURCES = test-memory.c test.h
515 test_memory_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
516 test_memory_LDADD = libtest.la $(LIBGUESTFS_LIBS)
518 # partitioning plugin test.
520 test-partitioning1.sh \
521 test-partitioning4.sh \
522 test-partitioning6.sh
525 test-partitioning2.sh \
526 test-partitioning3.sh \
527 test-partitioning5.sh
530 # pattern plugin test.
533 test-pattern-largest.sh \
534 test-pattern-largest-for-qemu.sh
537 LIBGUESTFS_TESTS += test-nbd
539 test-nbd-extents.sh \
543 test_nbd_SOURCES = test-nbd.c test.h
544 test_nbd_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
545 test_nbd_LDADD = libtest.la $(LIBGUESTFS_LIBS)
548 LIBGUESTFS_TESTS += test-null
549 TESTS += test-null-extents.sh
551 test_null_SOURCES = test-null.c test.h
552 test_null_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
553 test_null_LDADD = libtest.la $(LIBGUESTFS_LIBS)
555 # random plugin test.
556 LIBGUESTFS_TESTS += test-random
558 test_random_SOURCES = test-random.c test.h
559 test_random_CPPFLAGS = -I $(top_srcdir)/common/include
560 test_random_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
561 test_random_LDADD = libtest.la $(LIBGUESTFS_LIBS)
563 # split files plugin test.
564 check_DATA += split1 split2 split3
565 CLEANFILES += split1 split2 split3
568 dd if=$< of=$@-t bs=1 count=100
572 dd if=$< of=$@-t bs=1 count=100 skip=100
576 dd if=$< of=$@-t bs=1 skip=200
578 LIBGUESTFS_TESTS += test-split
580 test_split_SOURCES = test-split.c test.h
581 test_split_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
582 test_split_LDADD = libtest.la $(LIBGUESTFS_LIBS)
586 # Uses ‘disk’ so we have to make it conditional on guestfish.
592 ssh/ssh_host_rsa_key ssh/ssh_host_rsa_key.pub \
594 SSH_RANDOM_PORT := $(shell bash -c 'echo $$(( 10000 + $$RANDOM ))')
600 ssh/ssh_host_rsa_key ssh/ssh_host_rsa_key.pub \
601 ssh/id_rsa ssh/id_rsa.pub \
602 stamp-ssh-host-key stamp-ssh-user-key
604 ssh/sshd_config: ssh/sshd_config.in Makefile
607 -e 's,__abs_builddir__,$(abs_builddir),g' \
608 -e 's,__RANDOM_PORT__,$(SSH_RANDOM_PORT),g' \
612 ssh/ssh_host_rsa_key ssh/ssh_host_rsa_key.pub: stamp-ssh-host-key
615 rm -f ssh/ssh_host_rsa_key
616 rm -f ssh/ssh_host_rsa_key.pub
617 ssh-keygen -t rsa -f ssh/ssh_host_rsa_key -N ''
620 ssh/authorized_keys: ssh/id_rsa.pub
625 ssh/id_rsa ssh/id_rsa.pub: stamp-ssh-user-key
630 ssh-keygen -t rsa -f ssh/id_rsa -N ''
634 # streaming plugin test.
636 #LIBGUESTFS_TESTS += test-streaming
637 EXTRA_PROGRAMS += test-streaming
639 test_streaming_SOURCES = test-streaming.c test.h
640 test_streaming_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
641 test_streaming_LDADD = libtest.la $(LIBGUESTFS_LIBS)
644 # This only tests that the plugin can be loaded against a
645 # dummy VDDK library, it is not a detailed test.
647 # check_LTLIBRARIES won't build a shared library (see automake manual).
648 # So we have to do this and add a dependency.
649 noinst_LTLIBRARIES += libvixDiskLib.la
654 libvixDiskLib_la_SOURCES = \
656 libvixDiskLib_la_CPPFLAGS = \
657 -I$(top_srcdir)/plugins/vddk
658 libvixDiskLib_la_CXXFLAGS = \
660 # For use of the -rpath option, see:
661 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
662 libvixDiskLib_la_LDFLAGS = \
663 -shared -version-number 6:0:0 -rpath /nowhere
666 TESTS += test-zero.sh
668 #----------------------------------------------------------------------
669 # Tests of language plugins.
674 LIBGUESTFS_TESTS += test-ocaml
676 # This is somewhat different from the other tests because we have
677 # to build an actual plugin here.
678 test_ocaml_SOURCES = test-ocaml.c test.h
679 test_ocaml_CFLAGS = \
680 $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
681 test_ocaml_LDADD = libtest.la $(LIBGUESTFS_LIBS)
683 check_SCRIPTS += test-ocaml-plugin.so
684 test-ocaml-plugin.so: test_ocaml_plugin.cmx ../plugins/ocaml/libnbdkitocaml.la ../plugins/ocaml/NBDKit.cmi ../plugins/ocaml/NBDKit.cmx
685 $(OCAMLOPT) $(OCAMLOPTFLAGS) -I ../plugins/ocaml \
686 -output-obj -runtime-variant _pic -o $@ \
688 -cclib -L../plugins/ocaml/.libs -cclib -lnbdkitocaml
689 test_ocaml_plugin.cmx: test_ocaml_plugin.ml ../plugins/ocaml/NBDKit.cmi
690 $(OCAMLOPT) $(OCAMLOPTFLAGS) -I ../plugins/ocaml -c $< -o $@
698 test-dump-plugin-example4.sh \
700 LIBGUESTFS_TESTS += test-perl
702 test_perl_SOURCES = test-lang-plugins.c test.h
704 -DLANG='"perl"' -DSCRIPT='"$(srcdir)/test.pl"' \
705 $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
706 test_perl_LDADD = libtest.la $(LIBGUESTFS_LIBS)
710 # python plugin test.
714 test-python-exception.sh \
715 test-shebang-python.sh
716 LIBGUESTFS_TESTS += test-python
718 test_python_SOURCES = test-lang-plugins.c test.h
719 test_python_CFLAGS = \
720 -DLANG='"python"' -DSCRIPT='"$(srcdir)/test.py"' \
721 $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
722 test_python_LDADD = libtest.la $(LIBGUESTFS_LIBS)
729 # Ruby tests are disabled. See "WARNING" section in
730 # plugins/ruby/nbdkit-ruby-plugin.pod
732 #LIBGUESTFS_TESTS += \
734 #TESTS += test-shebang-ruby.sh
735 EXTRA_PROGRAMS += test-ruby
737 test_ruby_SOURCES = test-lang-plugins.c test.h
739 -DLANG='"ruby"' -DSCRIPT='"$(srcdir)/test.rb"' \
740 $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
741 test_ruby_LDADD = libtest.la $(LIBGUESTFS_LIBS)
745 # Shell (sh) plugin test.
746 LIBGUESTFS_TESTS += test-shell
747 check_DATA += test-shell.img
748 CLEANFILES += test-shell.img
750 test_shell_SOURCES = test-lang-plugins.c test.h
751 test_shell_CFLAGS = \
752 -DLANG='"sh"' -DSCRIPT='"$(srcdir)/test-shell.sh"' \
753 $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
754 test_shell_LDADD = libtest.la $(LIBGUESTFS_LIBS)
757 truncate -s 1048576 $@
759 TESTS += test-sh-extents.sh
764 LIBGUESTFS_TESTS += test-tcl
766 test_tcl_SOURCES = test-lang-plugins.c test.h
768 -DLANG='"tcl"' -DSCRIPT='"$(srcdir)/test.tcl"' \
769 $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
770 test_tcl_LDADD = libtest.la $(LIBGUESTFS_LIBS)
777 LIBGUESTFS_TESTS += test-lua
779 test_lua_SOURCES = test-lang-plugins.c test.h
781 -DLANG='"lua"' -DSCRIPT='"$(srcdir)/test.lua"' \
782 $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
783 test_lua_LDADD = libtest.la $(LIBGUESTFS_LIBS)
787 #----------------------------------------------------------------------
790 # Generic test of filter layers.
791 check_PROGRAMS += test-layers
792 TESTS += test-layers.sh test-layers
794 test_layers_SOURCES = \
796 test_layers_CPPFLAGS = \
797 -I$(top_srcdir)/common/include \
798 -I$(top_srcdir)/common/protocol \
799 -I$(top_srcdir)/common/utils \
800 -I$(top_srcdir)/server
801 test_layers_CFLAGS = \
804 test_layers_LDFLAGS = \
806 test_layers_LDADD = \
807 $(top_builddir)/common/utils/libutils.la
808 test_layers_DEPENDENCIES = \
809 test-layers-plugin.la \
810 test-layers-filter1.la \
811 test-layers-filter2.la \
812 test-layers-filter3.la
814 # check_LTLIBRARIES won't build a shared library (see automake manual).
815 # So we have to do this and add a dependency.
816 noinst_LTLIBRARIES += \
817 test-layers-plugin.la \
818 test-layers-filter1.la \
819 test-layers-filter2.la \
820 test-layers-filter3.la
822 test_layers_plugin_la_SOURCES = \
823 test-layers-plugin.c \
824 $(top_srcdir)/include/nbdkit-plugin.h
825 test_layers_plugin_la_CPPFLAGS = -I$(top_srcdir)/include
826 test_layers_plugin_la_CFLAGS = $(WARNINGS_CFLAGS)
827 # For use of the -rpath option, see:
828 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
829 test_layers_plugin_la_LDFLAGS = \
830 -module -avoid-version -shared -rpath /nowhere
832 test_layers_filter1_la_SOURCES = \
833 test-layers-filter.c \
834 $(top_srcdir)/include/nbdkit-filter.h
835 test_layers_filter1_la_CPPFLAGS = -I$(top_srcdir)/include
836 test_layers_filter1_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter1"'
837 # For use of the -rpath option, see:
838 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
839 test_layers_filter1_la_LDFLAGS = \
840 -module -avoid-version -shared -rpath /nowhere
842 test_layers_filter2_la_SOURCES = \
843 test-layers-filter.c \
844 $(top_srcdir)/include/nbdkit-filter.h
845 test_layers_filter2_la_CPPFLAGS = -I$(top_srcdir)/include
846 test_layers_filter2_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter2"'
847 # For use of the -rpath option, see:
848 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
849 test_layers_filter2_la_LDFLAGS = \
850 -module -avoid-version -shared -rpath /nowhere
852 test_layers_filter3_la_SOURCES = \
853 test-layers-filter.c \
854 $(top_srcdir)/include/nbdkit-filter.h
855 test_layers_filter3_la_CPPFLAGS = -I$(top_srcdir)/include
856 test_layers_filter3_la_CFLAGS = $(WARNINGS_CFLAGS) -Dlayer='"filter3"'
857 # For use of the -rpath option, see:
858 # https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html
859 test_layers_filter3_la_LDFLAGS = \
860 -module -avoid-version -shared -rpath /nowhere
862 # blocksize filter test.
863 TESTS += test-blocksize.sh
869 test-cache-on-read.sh
871 TESTS += test-cache-max-size.sh
873 # cacheextents filter test.
874 TESTS += test-cacheextents.sh
882 LIBGUESTFS_TESTS += test-delay
884 test_delay_SOURCES = test-delay.c test.h
885 test_delay_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
886 test_delay_LDADD = libtest.la $(LIBGUESTFS_LIBS)
889 LIBGUESTFS_TESTS += test-error
891 test_error_SOURCES = test-error.c test.h
892 test_error_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
893 test_error_LDADD = libtest.la $(LIBGUESTFS_LIBS)
906 # nozero filter test.
907 TESTS += test-nozero.sh
909 # offset filter test.
910 check_DATA += offset-data
911 CLEANFILES += offset-data
912 LIBGUESTFS_TESTS += test-offset
914 offset-data: generate-offset-data.sh
915 $(srcdir)/generate-offset-data.sh $@
917 test_offset_SOURCES = test-offset.c test.h
918 test_offset_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
919 test_offset_LDADD = libtest.la $(LIBGUESTFS_LIBS)
923 test-offset-extents.sh
925 # partition filter test.
926 TESTS += test-partition1.sh
928 TESTS += test-partition2.sh
936 # readahead filter test.
937 LIBGUESTFS_TESTS += test-readahead
938 TESTS += test-readahead-copy.sh
940 test_readahead_SOURCES = test-readahead.c test.h
941 test_readahead_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
942 test_readahead_LDADD = libtest.la $(LIBGUESTFS_LIBS)
944 # truncate filter tests.
950 test-truncate-extents.sh
956 LIBGUESTFS_TESTS += test-xz
957 check_DATA += disk.xz
958 CLEANFILES += disk.xz
960 test_xz_SOURCES = test-xz.c test.h
961 test_xz_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
962 test_xz_LDADD = libtest.la $(LIBGUESTFS_LIBS)
966 # We choose a very small block size here only for testing. Normally
967 # you should choose a 16M block size.
968 xz --best --block-size=32768 -c disk > $@
973 LIBGUESTFS_TESTS += test-xz-curl
975 test_xz_curl_SOURCES = \
980 test_xz_curl_CFLAGS = \
982 $(LIBGUESTFS_CFLAGS) \
984 test_xz_curl_LDFLAGS = \
986 test_xz_curl_LDADD = \