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)
26 # These tests may fail for reasons which aren't necessarily real problems.
30 # ../clone/virt-sysprep
31 # - hard to test because it's a shell script
36 # ../edit/virt-edit -e
37 # ../tools/virt-win-reg (Perl)
38 # ../tools/virt-make-fs (Perl)
39 # - hard because Perl doesn't cooperate by freeing memory
45 # - these look feasible to test using valgrind
50 # - hard to test because guestmount forks into the background, and
51 # if valgrind reports errors it doesn't stop the test shell script
53 EXTRA_DIST = suppressions
56 --log-file=$(abs_builddir)/valgrind.log \
58 --error-exitcode=119 \
59 --suppressions=$(abs_srcdir)/suppressions
60 RUN_VG = $(abs_top_builddir)/run $(VG)
62 export LIBVIRT_DEFAULT_URI = \
63 qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock-ro
65 GUESTS = $(shell virsh -c $(LIBVIRT_DEFAULT_URI) list --all | \
75 test-filesystems-real \
81 # Null invocations of the basic tools shouldn't leak memory.
83 $(RUN_VG) ../fish/guestfish -N part exit
84 $(RUN_VG) ../align/virt-alignment-scan -a test1.img >/dev/null
86 $(RUN_VG) ../cat/virt-filesystems -a /dev/null >/dev/null
87 $(RUN_VG) ../cat/virt-filesystems -a /dev/null --all --long -h --uuid >/dev/null
88 $(RUN_VG) ../df/virt-df -a /dev/null >/dev/null
89 $(RUN_VG) ../fish/guestfish -a /dev/null run
90 $(RUN_VG) ../inspector/virt-inspector -a /dev/null >/dev/null
91 $(RUN_VG) ../test-tool/libguestfs-test-tool >/dev/null 2>&1
93 # Invocations of tools on internal images shouldn't leak memory.
95 $(RUN_VG) ../cat/virt-cat -a ../images/fedora.img /etc/fstab >/dev/null
96 $(RUN_VG) ../cat/virt-filesystems -a ../images/fedora.img >/dev/null
97 $(RUN_VG) ../cat/virt-filesystems -a ../images/fedora.img --all --long -h --uuid >/dev/null
98 $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img / >/dev/null
99 $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -l / >/dev/null
100 $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -R / >/dev/null
101 $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -lR / >/dev/null
102 $(RUN_VG) ../df/virt-df -a ../images/fedora.img >/dev/null
103 $(RUN_VG) ../df/virt-df -a ../images/fedora.img -h >/dev/null
104 $(RUN_VG) ../fish/guestfish -a ../images/fedora.img run
105 $(RUN_VG) ../fish/guestfish -a ../images/fedora.img -i exit
106 $(RUN_VG) ../inspector/virt-inspector -a ../images/debian.img >/dev/null
107 $(RUN_VG) ../inspector/virt-inspector -a ../images/fedora.img >/dev/null
108 $(RUN_VG) ../inspector/virt-inspector -a ../images/ubuntu.img >/dev/null
109 $(RUN_VG) ../inspector/virt-inspector -a ../images/windows.img >/dev/null
111 # Invocations of tools on real images shouldn't leak memory.
113 $(RUN_VG) virt-df >/dev/null
114 $(RUN_VG) virt-df -h >/dev/null
116 test-filesystems-real:
117 @for g in $(GUESTS); do \
118 echo $(RUN_VG) ../cat/virt-filesystems -d $$g --all --long -h --uuid; \
119 $(RUN_VG) ../cat/virt-filesystems -d $$g --all --long -h --uuid > /dev/null; \
121 if [ $$r -ne 0 ]; then exit $$r; fi; \
125 @for g in $(GUESTS); do \
126 echo $(RUN_VG) ../inspector/virt-inspector -d $$g; \
127 $(RUN_VG) ../inspector/virt-inspector -d $$g > /dev/null; \
129 if [ $$r -ne 0 ]; then exit $$r; fi; \
132 # Run virt-resize tests under valgrind.
134 $(MAKE) -C ../resize VG="$(VG)" check
136 # Run virt-sparsify tests under valgrind.
138 $(MAKE) -C ../sparsify VG="$(VG)" check
140 # Run capitests under valgrind.
142 $(MAKE) -C ../capitests VG="$(RUN_VG)" check
144 # Test OCaml bindings under valgrind.
146 $(MAKE) -C ../ocaml VG="$(VG)" check