extra tests: Test virt-sparsify.
[libguestfs.git] / extratests / Makefile.am
1 # libguestfs
2 # Copyright (C) 2009-2011 Red Hat Inc.
3 #
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.
8 #
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.
13 #
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.
17
18 # Extra tests.
19 #
20 # Requires:
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)
24 #   - valgrind
25 #
26 # These tests may fail for reasons which aren't necessarily real problems.
27
28 EXTRA_DIST = suppressions
29
30 VG = valgrind \
31         --log-file=$(abs_builddir)/valgrind.log \
32         --leak-check=full \
33         --error-exitcode=119 \
34         --suppressions=$(abs_srcdir)/suppressions
35 RUN_VG = ../run $(VG)
36
37 export LIBVIRT_DEFAULT_URI = \
38         qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock-ro
39
40 GUESTS = $(shell virsh -c $(LIBVIRT_DEFAULT_URI) list --all | \
41                  head -n -1 | \
42                  tail -n +3 | \
43                  awk '{print $$2}')
44
45 extra-tests: \
46         test-tools-null \
47         test-tools-internal \
48         test-tools-real \
49         test-resize \
50         test-sparsify \
51         test-capitests \
52         test-ocaml
53
54 # Null invocations of the basic tools shouldn't leak memory.
55 test-tools-null:
56         $(RUN_VG) ../fish/guestfish -N part exit
57         $(RUN_VG) ../align/virt-alignment-scan -a test1.img >/dev/null
58         rm test1.img
59         $(RUN_VG) ../cat/virt-filesystems -a /dev/null >/dev/null
60         $(RUN_VG) ../cat/virt-filesystems -a /dev/null --all --long -h --uuid >/dev/null
61         $(RUN_VG) ../df/virt-df -a /dev/null >/dev/null
62         $(RUN_VG) ../fish/guestfish -a /dev/null run
63         $(RUN_VG) ../inspector/virt-inspector -a /dev/null >/dev/null
64         $(RUN_VG) ../test-tool/libguestfs-test-tool >/dev/null 2>&1
65
66 # Invocations of tools on internal images shouldn't leak memory.
67 test-tools-internal:
68         $(RUN_VG) ../cat/virt-cat -a ../images/fedora.img /etc/fstab >/dev/null
69         $(RUN_VG) ../cat/virt-filesystems -a ../images/fedora.img >/dev/null
70         $(RUN_VG) ../cat/virt-filesystems -a ../images/fedora.img --all --long -h --uuid >/dev/null
71         $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img / >/dev/null
72         $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -l / >/dev/null
73         $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -R / >/dev/null
74         $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -lR / >/dev/null
75         $(RUN_VG) ../df/virt-df -a ../images/fedora.img >/dev/null
76         $(RUN_VG) ../df/virt-df -a ../images/fedora.img -h >/dev/null
77         $(RUN_VG) ../fish/guestfish -a ../images/fedora.img run
78         $(RUN_VG) ../fish/guestfish -a ../images/fedora.img -i exit
79         $(RUN_VG) ../inspector/virt-inspector -a ../images/debian.img >/dev/null
80         $(RUN_VG) ../inspector/virt-inspector -a ../images/fedora.img >/dev/null
81         $(RUN_VG) ../inspector/virt-inspector -a ../images/fedora-md1.img -a ../images/fedora-md2.img >/dev/null
82         $(RUN_VG) ../inspector/virt-inspector -a ../images/ubuntu.img >/dev/null
83         $(RUN_VG) ../inspector/virt-inspector -a ../images/windows.img >/dev/null
84
85 # Invocations of tools on real images shouldn't leak memory.
86 test-tools-real:
87         $(RUN_VG) virt-df >/dev/null
88         $(RUN_VG) virt-df -h >/dev/null
89         @for g in $(GUESTS); do \
90           echo $(RUN_VG) ../inspector/virt-inspector -d $$g; \
91           $(RUN_VG) ../inspector/virt-inspector -d $$g > /dev/null; \
92           r=$$?; \
93           if [ $$r -ne 0 ]; then exit $$r; fi; \
94         done
95         @for g in $(GUESTS); do \
96           echo $(RUN_VG) ../cat/virt-filesystems -d $$g --all --long -h --uuid; \
97           $(RUN_VG) ../cat/virt-filesystems -d $$g --all --long -h --uuid > /dev/null; \
98           r=$$?; \
99           if [ $$r -ne 0 ]; then exit $$r; fi; \
100         done
101
102 # Run virt-resize tests under valgrind.
103 test-resize:
104         $(MAKE) -C ../resize VG="$(VG)" check
105
106 # Run virt-sparsify tests under valgrind.
107 test-sparsify:
108         $(MAKE) -C ../sparsify VG="$(VG)" check
109
110 # XXX Not tested:
111 # ../clone/virt-sysprep
112 # ../edit/virt-edit
113 # ../edit/virt-edit -e
114 # ../fuse/guestmount
115 # ../tools/virt-win-reg (Perl)
116 # ../tools/virt-make-fs (Perl)
117
118 # Run capitests under valgrind.
119 test-capitests:
120         $(MAKE) -C ../capitests VG="$(RUN_VG)" check
121
122 # Test OCaml bindings under valgrind.
123 test-ocaml:
124         $(MAKE) -C ../ocaml VG="$(VG)" check