2 # Copyright (C) 2009-2011 Red Hat Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program 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
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 # - some local libvirt guests are available
22 # - the disks of these guests are accessible by the current user
23 # (tip: add yourself to the 'disk' group)
27 # These tests may fail for reasons which aren't necessarily real problems.
31 # ../clone/virt-sysprep
32 # - hard to test because it's a shell script
37 # ../edit/virt-edit -e
38 # ../tools/virt-win-reg (Perl)
39 # ../tools/virt-make-fs (Perl)
40 # - hard because Perl doesn't cooperate by freeing memory
46 # - these look feasible to test using valgrind
51 # - hard to test because guestmount forks into the background, and
52 # if valgrind reports errors it doesn't stop the test shell script
54 EXTRA_DIST = suppressions
57 --log-file=$(abs_builddir)/valgrind.log \
59 --error-exitcode=119 \
60 --suppressions=$(abs_srcdir)/suppressions
61 RUN_VG = $(abs_top_builddir)/run $(VG)
63 export LIBVIRT_DEFAULT_URI = \
64 qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock-ro
66 GUESTS = $(shell virsh -c $(LIBVIRT_DEFAULT_URI) list --all | \
78 test-filesystems-real \
85 $(MAKE) -C ../guests check
88 @libtool --help >/dev/null 2>&1 || { \
89 echo "extra-tests: libtool is not installed"; \
92 @valgrind --help >/dev/null 2>&1 || { \
93 echo "extra-tests: valgrind is not installed"; \
97 # Null invocations of the basic tools shouldn't leak memory.
99 $(RUN_VG) ../../fish/guestfish -N part exit
100 $(RUN_VG) ../../align/virt-alignment-scan -a test1.img >/dev/null
102 $(RUN_VG) ../../cat/virt-filesystems -a /dev/null >/dev/null
103 $(RUN_VG) ../../cat/virt-filesystems -a /dev/null --all --long -h --uuid >/dev/null
104 $(RUN_VG) ../../df/virt-df -a /dev/null >/dev/null
105 $(RUN_VG) ../../fish/guestfish -a /dev/null run
106 $(RUN_VG) ../../inspector/virt-inspector -a /dev/null >/dev/null
107 $(RUN_VG) ../../test-tool/libguestfs-test-tool >/dev/null 2>&1
109 # Invocations of tools on internal images shouldn't leak memory.
111 $(RUN_VG) ../../cat/virt-cat -a ../guests/fedora.img /etc/fstab >/dev/null
112 $(RUN_VG) ../../cat/virt-filesystems -a ../guests/fedora.img >/dev/null
113 $(RUN_VG) ../../cat/virt-filesystems -a ../guests/fedora.img --all --long -h --uuid >/dev/null
114 $(RUN_VG) ../../cat/virt-ls -a ../guests/fedora.img / >/dev/null
115 $(RUN_VG) ../../cat/virt-ls -a ../guests/fedora.img -l / >/dev/null
116 $(RUN_VG) ../../cat/virt-ls -a ../guests/fedora.img -R / >/dev/null
117 $(RUN_VG) ../../cat/virt-ls -a ../guests/fedora.img -lR / >/dev/null
118 $(RUN_VG) ../../df/virt-df -a ../guests/fedora.img >/dev/null
119 $(RUN_VG) ../../df/virt-df -a ../guests/fedora.img -h >/dev/null
120 $(RUN_VG) ../../fish/guestfish -a ../guests/fedora.img run
121 $(RUN_VG) ../../fish/guestfish -a ../guests/fedora.img -i exit
122 $(RUN_VG) ../../inspector/virt-inspector -a ../guests/debian.img >/dev/null
123 $(RUN_VG) ../../inspector/virt-inspector -a ../guests/fedora.img >/dev/null
124 $(RUN_VG) ../../inspector/virt-inspector -a ../guests/fedora-md1.img -a ../guests/fedora-md2.img >/dev/null
125 $(RUN_VG) ../../inspector/virt-inspector -a ../guests/ubuntu.img >/dev/null
126 $(RUN_VG) ../../inspector/virt-inspector -a ../guests/windows.img >/dev/null
128 # Invocations of tools on real images shouldn't leak memory.
130 $(RUN_VG) ../../df/virt-df >/dev/null
131 $(RUN_VG) ../../df/virt-df -h >/dev/null
133 test-filesystems-real:
134 @for g in $(GUESTS); do \
135 echo $(RUN_VG) ../../cat/virt-filesystems -d $$g --all --long -h --uuid; \
136 $(RUN_VG) ../../cat/virt-filesystems -d $$g --all --long -h --uuid > /dev/null; \
138 if [ $$r -ne 0 ]; then exit $$r; fi; \
142 @for g in $(GUESTS); do \
143 echo $(RUN_VG) ../../inspector/virt-inspector -d $$g; \
144 $(RUN_VG) ../../inspector/virt-inspector -d $$g > /dev/null; \
146 if [ $$r -ne 0 ]; then exit $$r; fi; \
149 # Run virt-resize tests under valgrind.
151 $(MAKE) -C ../../resize VG="$(VG)" check
153 # Run virt-sparsify tests under valgrind.
155 $(MAKE) -C ../../sparsify VG="$(VG)" check
157 # Run c-api tests under valgrind.
159 $(MAKE) -C ../c-api VG="$(RUN_VG)" check
161 # Test OCaml bindings under valgrind.
163 $(MAKE) -C ../../ocaml VG="$(VG)" check