extra tests: Add comments about what is not tested here.
[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 # XXX Not tested:
29 #
30 # ../clone/virt-sysprep
31 #   - hard to test because it's a shell script
32 #
33 # ../edit/virt-edit
34 #
35 # Perl bindings
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
40 #
41 # Python bindings
42 #   - as for Perl
43 #
44 # Ruby bindings
45 #   - these look feasible to test using valgrind
46 #
47 # Java bindings
48 #
49 # ../fuse/guestmount
50 #   - hard to test because guestmount forks into the background, and
51 #     if valgrind reports errors it doesn't stop the test shell script
52
53 EXTRA_DIST = suppressions
54
55 VG = valgrind \
56         --log-file=$(abs_builddir)/valgrind.log \
57         --leak-check=full \
58         --error-exitcode=119 \
59         --suppressions=$(abs_srcdir)/suppressions
60 RUN_VG = $(abs_top_builddir)/run $(VG)
61
62 export LIBVIRT_DEFAULT_URI = \
63         qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock-ro
64
65 GUESTS = $(shell virsh -c $(LIBVIRT_DEFAULT_URI) list --all | \
66                  head -n -1 | \
67                  tail -n +3 | \
68                  awk '{print $$2}')
69
70 extra-tests: \
71         test-capitests \
72         test-tools-null \
73         test-tools-internal \
74         test-df-real \
75         test-filesystems-real \
76         test-inspector-real \
77         test-ocaml \
78         test-resize \
79         test-sparsify
80
81 # Null invocations of the basic tools shouldn't leak memory.
82 test-tools-null:
83         $(RUN_VG) ../fish/guestfish -N part exit
84         $(RUN_VG) ../align/virt-alignment-scan -a test1.img >/dev/null
85         rm test1.img
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
92
93 # Invocations of tools on internal images shouldn't leak memory.
94 test-tools-internal:
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/fedora-md1.img -a ../images/fedora-md2.img >/dev/null
109         $(RUN_VG) ../inspector/virt-inspector -a ../images/ubuntu.img >/dev/null
110         $(RUN_VG) ../inspector/virt-inspector -a ../images/windows.img >/dev/null
111
112 # Invocations of tools on real images shouldn't leak memory.
113 test-df-real:
114         $(RUN_VG) virt-df >/dev/null
115         $(RUN_VG) virt-df -h >/dev/null
116
117 test-filesystems-real:
118         @for g in $(GUESTS); do \
119           echo $(RUN_VG) ../cat/virt-filesystems -d $$g --all --long -h --uuid; \
120           $(RUN_VG) ../cat/virt-filesystems -d $$g --all --long -h --uuid > /dev/null; \
121           r=$$?; \
122           if [ $$r -ne 0 ]; then exit $$r; fi; \
123         done
124
125 test-inspector-real:
126         @for g in $(GUESTS); do \
127           echo $(RUN_VG) ../inspector/virt-inspector -d $$g; \
128           $(RUN_VG) ../inspector/virt-inspector -d $$g > /dev/null; \
129           r=$$?; \
130           if [ $$r -ne 0 ]; then exit $$r; fi; \
131         done
132
133 # Run virt-resize tests under valgrind.
134 test-resize:
135         $(MAKE) -C ../resize VG="$(VG)" check
136
137 # Run virt-sparsify tests under valgrind.
138 test-sparsify:
139         $(MAKE) -C ../sparsify VG="$(VG)" check
140
141 # Run capitests under valgrind.
142 test-capitests:
143         $(MAKE) -C ../capitests VG="$(RUN_VG)" check
144
145 # Test OCaml bindings under valgrind.
146 test-ocaml:
147         $(MAKE) -C ../ocaml VG="$(VG)" check