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 | \
77 test-filesystems-real \
84 @libtool --help >/dev/null 2>&1 || { \
85 echo "extra-tests: libtool is not installed"; \
88 @valgrind --help >/dev/null 2>&1 || { \
89 echo "extra-tests: valgrind is not installed"; \
93 # Null invocations of the basic tools shouldn't leak memory.
95 $(RUN_VG) ../fish/guestfish -N part exit
96 $(RUN_VG) ../align/virt-alignment-scan -a test1.img >/dev/null
98 $(RUN_VG) ../cat/virt-filesystems -a /dev/null >/dev/null
99 $(RUN_VG) ../cat/virt-filesystems -a /dev/null --all --long -h --uuid >/dev/null
100 $(RUN_VG) ../df/virt-df -a /dev/null >/dev/null
101 $(RUN_VG) ../fish/guestfish -a /dev/null run
102 $(RUN_VG) ../inspector/virt-inspector -a /dev/null >/dev/null
103 $(RUN_VG) ../test-tool/libguestfs-test-tool >/dev/null 2>&1
105 # Invocations of tools on internal images shouldn't leak memory.
107 $(RUN_VG) ../cat/virt-cat -a ../images/fedora.img /etc/fstab >/dev/null
108 $(RUN_VG) ../cat/virt-filesystems -a ../images/fedora.img >/dev/null
109 $(RUN_VG) ../cat/virt-filesystems -a ../images/fedora.img --all --long -h --uuid >/dev/null
110 $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img / >/dev/null
111 $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -l / >/dev/null
112 $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -R / >/dev/null
113 $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -lR / >/dev/null
114 $(RUN_VG) ../df/virt-df -a ../images/fedora.img >/dev/null
115 $(RUN_VG) ../df/virt-df -a ../images/fedora.img -h >/dev/null
116 $(RUN_VG) ../fish/guestfish -a ../images/fedora.img run
117 $(RUN_VG) ../fish/guestfish -a ../images/fedora.img -i exit
118 $(RUN_VG) ../inspector/virt-inspector -a ../images/debian.img >/dev/null
119 $(RUN_VG) ../inspector/virt-inspector -a ../images/fedora.img >/dev/null
120 $(RUN_VG) ../inspector/virt-inspector -a ../images/ubuntu.img >/dev/null
121 $(RUN_VG) ../inspector/virt-inspector -a ../images/windows.img >/dev/null
123 # Invocations of tools on real images shouldn't leak memory.
125 $(RUN_VG) virt-df >/dev/null
126 $(RUN_VG) virt-df -h >/dev/null
128 test-filesystems-real:
129 @for g in $(GUESTS); do \
130 echo $(RUN_VG) ../cat/virt-filesystems -d $$g --all --long -h --uuid; \
131 $(RUN_VG) ../cat/virt-filesystems -d $$g --all --long -h --uuid > /dev/null; \
133 if [ $$r -ne 0 ]; then exit $$r; fi; \
137 @for g in $(GUESTS); do \
138 echo $(RUN_VG) ../inspector/virt-inspector -d $$g; \
139 $(RUN_VG) ../inspector/virt-inspector -d $$g > /dev/null; \
141 if [ $$r -ne 0 ]; then exit $$r; fi; \
144 # Run virt-resize tests under valgrind.
146 $(MAKE) -C ../resize VG="$(VG)" check
148 # Run virt-sparsify tests under valgrind.
150 $(MAKE) -C ../sparsify VG="$(VG)" check
152 # Run capitests under valgrind.
154 $(MAKE) -C ../capitests VG="$(RUN_VG)" check
156 # Test OCaml bindings under valgrind.
158 $(MAKE) -C ../ocaml VG="$(VG)" check