From c649817586e5b4df53b251d1290422f5ef046045 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 22 Dec 2011 12:00:44 +0000 Subject: tests: Rename extratests -> tests/extra. --- .gitignore | 2 +- Makefile.am | 6 +- configure.ac | 2 +- extratests/Makefile.am | 159 ----------------------------------------------- extratests/suppressions | 132 --------------------------------------- src/guestfs.pod | 5 -- tests/extra/Makefile.am | 159 +++++++++++++++++++++++++++++++++++++++++++++++ tests/extra/suppressions | 132 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 296 insertions(+), 301 deletions(-) delete mode 100644 extratests/Makefile.am delete mode 100644 extratests/suppressions create mode 100644 tests/extra/Makefile.am create mode 100644 tests/extra/suppressions diff --git a/.gitignore b/.gitignore index 9271d74f..895227ce 100644 --- a/.gitignore +++ b/.gitignore @@ -83,7 +83,6 @@ examples/stamp-guestfs-examples.pod examples/stamp-guestfs-recipes.pod examples/stamp-guestfs-testing.pod examples/virt-dhcp-address -extratests/valgrind.log fish/cmds.c fish/cmds_gperf.c fish/cmds_gperf.gperf @@ -357,6 +356,7 @@ tests/c-api/test*.img tests/c-api/tests tests/c-api/tests.c tests/c-api/test*.tmp +tests/extra/valgrind.log tests/regressions/rhbz501893 tools/test.img tools/virt-*.1 diff --git a/Makefile.am b/Makefile.am index 31da8755..9ae52175 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,7 +33,7 @@ endif SUBDIRS += gnulib/tests tests/c-api tests/qemu SUBDIRS += tests/protocol tests/lvm tests/luks tests/md SUBDIRS += tests/regressions -SUBDIRS += extratests test-tool +SUBDIRS += tests/extra test-tool # Guestfish. SUBDIRS += fish @@ -253,10 +253,10 @@ CLEANFILES = \ quickcheck: ./run test-tool/libguestfs-test-tool $(QUICKCHECK_TEST_TOOL_ARGS) -# Run extra-tests in extratests/ subdirectory. +# Run extra-tests in tests/extra/ subdirectory. extra-tests: - make -C extratests $@ + make -C tests/extra $@ # Make binary distribution. diff --git a/configure.ac b/configure.ac index 33d2aea1..6084a1b4 100644 --- a/configure.ac +++ b/configure.ac @@ -1016,7 +1016,6 @@ AC_CONFIG_FILES([Makefile erlang/Makefile erlang/examples/Makefile examples/Makefile - extratests/Makefile fish/Makefile fuse/Makefile generator/Makefile @@ -1050,6 +1049,7 @@ AC_CONFIG_FILES([Makefile src/Makefile test-tool/Makefile tests/c-api/Makefile + tests/extra/Makefile tests/luks/Makefile tests/lvm/Makefile tests/md/Makefile diff --git a/extratests/Makefile.am b/extratests/Makefile.am deleted file mode 100644 index 0b4e20ea..00000000 --- a/extratests/Makefile.am +++ /dev/null @@ -1,159 +0,0 @@ -# libguestfs -# Copyright (C) 2009-2011 Red Hat Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# Extra tests. -# -# Requires: -# - some local libvirt guests are available -# - the disks of these guests are accessible by the current user -# (tip: add yourself to the 'disk' group) -# - valgrind -# - libtool -# -# These tests may fail for reasons which aren't necessarily real problems. -# -# XXX Not tested: -# -# ../clone/virt-sysprep -# - hard to test because it's a shell script -# -# ../edit/virt-edit -# -# Perl bindings -# ../edit/virt-edit -e -# ../tools/virt-win-reg (Perl) -# ../tools/virt-make-fs (Perl) -# - hard because Perl doesn't cooperate by freeing memory -# -# Python bindings -# - as for Perl -# -# Ruby bindings -# - these look feasible to test using valgrind -# -# Java bindings -# -# ../fuse/guestmount -# - hard to test because guestmount forks into the background, and -# if valgrind reports errors it doesn't stop the test shell script - -EXTRA_DIST = suppressions - -VG = valgrind \ - --log-file=$(abs_builddir)/valgrind.log \ - --leak-check=full \ - --error-exitcode=119 \ - --suppressions=$(abs_srcdir)/suppressions -RUN_VG = $(abs_top_builddir)/run $(VG) - -export LIBVIRT_DEFAULT_URI = \ - qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock-ro - -GUESTS = $(shell virsh -c $(LIBVIRT_DEFAULT_URI) list --all | \ - head -n -1 | \ - tail -n +3 | \ - awk '{print $$2}') - -extra-tests: \ - test-prerequisites \ - test-c-api \ - test-tools-null \ - test-tools-internal \ - test-df-real \ - test-filesystems-real \ - test-inspector-real \ - test-ocaml \ - test-resize \ - test-sparsify - -test-prerequisites: - @libtool --help >/dev/null 2>&1 || { \ - echo "extra-tests: libtool is not installed"; \ - exit 1; \ - } - @valgrind --help >/dev/null 2>&1 || { \ - echo "extra-tests: valgrind is not installed"; \ - exit 1; \ - } - -# Null invocations of the basic tools shouldn't leak memory. -test-tools-null: - $(RUN_VG) ../fish/guestfish -N part exit - $(RUN_VG) ../align/virt-alignment-scan -a test1.img >/dev/null - rm test1.img - $(RUN_VG) ../cat/virt-filesystems -a /dev/null >/dev/null - $(RUN_VG) ../cat/virt-filesystems -a /dev/null --all --long -h --uuid >/dev/null - $(RUN_VG) ../df/virt-df -a /dev/null >/dev/null - $(RUN_VG) ../fish/guestfish -a /dev/null run - $(RUN_VG) ../inspector/virt-inspector -a /dev/null >/dev/null - $(RUN_VG) ../test-tool/libguestfs-test-tool >/dev/null 2>&1 - -# Invocations of tools on internal images shouldn't leak memory. -test-tools-internal: - $(RUN_VG) ../cat/virt-cat -a ../images/fedora.img /etc/fstab >/dev/null - $(RUN_VG) ../cat/virt-filesystems -a ../images/fedora.img >/dev/null - $(RUN_VG) ../cat/virt-filesystems -a ../images/fedora.img --all --long -h --uuid >/dev/null - $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img / >/dev/null - $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -l / >/dev/null - $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -R / >/dev/null - $(RUN_VG) ../cat/virt-ls -a ../images/fedora.img -lR / >/dev/null - $(RUN_VG) ../df/virt-df -a ../images/fedora.img >/dev/null - $(RUN_VG) ../df/virt-df -a ../images/fedora.img -h >/dev/null - $(RUN_VG) ../fish/guestfish -a ../images/fedora.img run - $(RUN_VG) ../fish/guestfish -a ../images/fedora.img -i exit - $(RUN_VG) ../inspector/virt-inspector -a ../images/debian.img >/dev/null - $(RUN_VG) ../inspector/virt-inspector -a ../images/fedora.img >/dev/null - $(RUN_VG) ../inspector/virt-inspector -a ../images/fedora-md1.img -a ../images/fedora-md2.img >/dev/null - $(RUN_VG) ../inspector/virt-inspector -a ../images/ubuntu.img >/dev/null - $(RUN_VG) ../inspector/virt-inspector -a ../images/windows.img >/dev/null - -# Invocations of tools on real images shouldn't leak memory. -test-df-real: - $(RUN_VG) virt-df >/dev/null - $(RUN_VG) virt-df -h >/dev/null - -test-filesystems-real: - @for g in $(GUESTS); do \ - echo $(RUN_VG) ../cat/virt-filesystems -d $$g --all --long -h --uuid; \ - $(RUN_VG) ../cat/virt-filesystems -d $$g --all --long -h --uuid > /dev/null; \ - r=$$?; \ - if [ $$r -ne 0 ]; then exit $$r; fi; \ - done - -test-inspector-real: - @for g in $(GUESTS); do \ - echo $(RUN_VG) ../inspector/virt-inspector -d $$g; \ - $(RUN_VG) ../inspector/virt-inspector -d $$g > /dev/null; \ - r=$$?; \ - if [ $$r -ne 0 ]; then exit $$r; fi; \ - done - -# Run virt-resize tests under valgrind. -test-resize: - $(MAKE) -C ../resize VG="$(VG)" check - -# Run virt-sparsify tests under valgrind. -test-sparsify: - $(MAKE) -C ../sparsify VG="$(VG)" check - -# Run c-api tests under valgrind. -test-c-api: - $(MAKE) -C ../tests/c-api VG="$(RUN_VG)" check - -# Test OCaml bindings under valgrind. -test-ocaml: - $(MAKE) -C ../ocaml VG="$(VG)" check diff --git a/extratests/suppressions b/extratests/suppressions deleted file mode 100644 index 4dc02d2f..00000000 --- a/extratests/suppressions +++ /dev/null @@ -1,132 +0,0 @@ -# libnuma -{ - libnuma_numa_node_size64_cond - Memcheck:Cond - fun:* - fun:numa_node_size64 - fun:numa_init -} -{ - libnuma_numa_node_size64_cond_2 - Memcheck:Cond - fun:numa_node_size64 - fun:numa_init -} -{ - libnuma_numa_node_size64_cond_3 - Memcheck:Cond - fun:* - fun:numa_node_size64 - obj:/usr/lib64/libnuma.so.1 -} -{ - libnuma_numa_node_size64_cond_4 - Memcheck:Cond - fun:numa_node_size64 - obj:/usr/lib64/libnuma.so.1 -} -{ - libnuma_numa_node_size64_value8 - Memcheck:Value8 - fun:numa_node_size64 - fun:numa_init -} -{ - libnuma_numa_node_size64_value8_2 - Memcheck:Value8 - fun:numa_node_size64 - obj:/usr/lib64/libnuma.so.1 -} - -# libnl -{ - libnl_add_routing_table_name_leak - Memcheck:Leak - fun:malloc - fun:strdup - fun:add_routing_table_name -} -{ - libnl_add_routing_table_name_leak_2 - Memcheck:Leak - fun:calloc - fun:add_routing_table_name -} -{ - libnl_add_proto_name_leak - Memcheck:Leak - fun:malloc - fun:strdup - fun:add_proto_name -} -{ - libnl_add_proto_name_leak_2 - Memcheck:Leak - fun:calloc - fun:add_proto_name -} -{ - libnl1_malloc_leak - Memcheck:Leak - fun:malloc - fun:strdup - obj:/usr/lib/libnl.so.1.1 -} -{ - libnl1_malloc_leak_2 - Memcheck:Leak - fun:malloc - fun:strdup - obj:/lib64/libnl.so.1.1 -} -{ - libnl1_calloc_leak - Memcheck:Leak - fun:calloc - obj:/usr/lib/libnl.so.1.1 -} -{ - libnl1_calloc_leak_2 - Memcheck:Leak - fun:calloc - obj:/lib64/libnl.so.1.1 -} - -# OCaml, by design, doesn't bother to free the major heap before -# calling exit. Ignore that leak. -{ - ocaml_heap_leak - Memcheck:Leak - ... - fun:caml_alloc_for_heap -} -# On the other hand, these seem to be a real bugs in OCaml: -{ - ocaml_heap_leak_2 - Memcheck:Leak - fun:malloc - fun:caml_thread_new_descriptor - fun:caml_thread_new -} -{ - ocaml_heap_leak_3 - Memcheck:Leak - fun:malloc - fun:caml_thread_new_descriptor - fun:caml_thread_initialize -} -{ - ocaml_heap_leak_4 - Memcheck:Leak - ... - fun:pthread_create* - ... - fun:caml_thread_new -} -{ - ocaml_heap_leak_5 - Memcheck:Leak - fun:malloc - fun:caml_stat_alloc - fun:caml_threadstatus_new -} diff --git a/src/guestfs.pod b/src/guestfs.pod index 85760659..3bad6e63 100644 --- a/src/guestfs.pod +++ b/src/guestfs.pod @@ -2949,11 +2949,6 @@ L command and documentation. C API example code. -=item C - -Extra tests. These are not run by default because they require -special tools or configuration. - =item C L, the command-line shell, and various shell scripts diff --git a/tests/extra/Makefile.am b/tests/extra/Makefile.am new file mode 100644 index 00000000..7d1cc22e --- /dev/null +++ b/tests/extra/Makefile.am @@ -0,0 +1,159 @@ +# libguestfs +# Copyright (C) 2009-2011 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# Extra tests. +# +# Requires: +# - some local libvirt guests are available +# - the disks of these guests are accessible by the current user +# (tip: add yourself to the 'disk' group) +# - valgrind +# - libtool +# +# These tests may fail for reasons which aren't necessarily real problems. +# +# XXX Not tested: +# +# ../clone/virt-sysprep +# - hard to test because it's a shell script +# +# ../edit/virt-edit +# +# Perl bindings +# ../edit/virt-edit -e +# ../tools/virt-win-reg (Perl) +# ../tools/virt-make-fs (Perl) +# - hard because Perl doesn't cooperate by freeing memory +# +# Python bindings +# - as for Perl +# +# Ruby bindings +# - these look feasible to test using valgrind +# +# Java bindings +# +# ../fuse/guestmount +# - hard to test because guestmount forks into the background, and +# if valgrind reports errors it doesn't stop the test shell script + +EXTRA_DIST = suppressions + +VG = valgrind \ + --log-file=$(abs_builddir)/valgrind.log \ + --leak-check=full \ + --error-exitcode=119 \ + --suppressions=$(abs_srcdir)/suppressions +RUN_VG = $(abs_top_builddir)/run $(VG) + +export LIBVIRT_DEFAULT_URI = \ + qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock-ro + +GUESTS = $(shell virsh -c $(LIBVIRT_DEFAULT_URI) list --all | \ + head -n -1 | \ + tail -n +3 | \ + awk '{print $$2}') + +extra-tests: \ + test-prerequisites \ + test-c-api \ + test-tools-null \ + test-tools-internal \ + test-df-real \ + test-filesystems-real \ + test-inspector-real \ + test-ocaml \ + test-resize \ + test-sparsify + +test-prerequisites: + @libtool --help >/dev/null 2>&1 || { \ + echo "extra-tests: libtool is not installed"; \ + exit 1; \ + } + @valgrind --help >/dev/null 2>&1 || { \ + echo "extra-tests: valgrind is not installed"; \ + exit 1; \ + } + +# Null invocations of the basic tools shouldn't leak memory. +test-tools-null: + $(RUN_VG) ../../fish/guestfish -N part exit + $(RUN_VG) ../../align/virt-alignment-scan -a test1.img >/dev/null + rm test1.img + $(RUN_VG) ../../cat/virt-filesystems -a /dev/null >/dev/null + $(RUN_VG) ../../cat/virt-filesystems -a /dev/null --all --long -h --uuid >/dev/null + $(RUN_VG) ../../df/virt-df -a /dev/null >/dev/null + $(RUN_VG) ../../fish/guestfish -a /dev/null run + $(RUN_VG) ../../inspector/virt-inspector -a /dev/null >/dev/null + $(RUN_VG) ../../test-tool/libguestfs-test-tool >/dev/null 2>&1 + +# Invocations of tools on internal images shouldn't leak memory. +test-tools-internal: + $(RUN_VG) ../../cat/virt-cat -a ../images/fedora.img /etc/fstab >/dev/null + $(RUN_VG) ../../cat/virt-filesystems -a ../images/fedora.img >/dev/null + $(RUN_VG) ../../cat/virt-filesystems -a ../images/fedora.img --all --long -h --uuid >/dev/null + $(RUN_VG) ../../cat/virt-ls -a ../images/fedora.img / >/dev/null + $(RUN_VG) ../../cat/virt-ls -a ../images/fedora.img -l / >/dev/null + $(RUN_VG) ../../cat/virt-ls -a ../images/fedora.img -R / >/dev/null + $(RUN_VG) ../../cat/virt-ls -a ../images/fedora.img -lR / >/dev/null + $(RUN_VG) ../../df/virt-df -a ../images/fedora.img >/dev/null + $(RUN_VG) ../../df/virt-df -a ../images/fedora.img -h >/dev/null + $(RUN_VG) ../../fish/guestfish -a ../images/fedora.img run + $(RUN_VG) ../../fish/guestfish -a ../images/fedora.img -i exit + $(RUN_VG) ../../inspector/virt-inspector -a ../images/debian.img >/dev/null + $(RUN_VG) ../../inspector/virt-inspector -a ../images/fedora.img >/dev/null + $(RUN_VG) ../../inspector/virt-inspector -a ../images/fedora-md1.img -a ../images/fedora-md2.img >/dev/null + $(RUN_VG) ../../inspector/virt-inspector -a ../images/ubuntu.img >/dev/null + $(RUN_VG) ../../inspector/virt-inspector -a ../images/windows.img >/dev/null + +# Invocations of tools on real images shouldn't leak memory. +test-df-real: + $(RUN_VG) ../../df/virt-df >/dev/null + $(RUN_VG) ../../df/virt-df -h >/dev/null + +test-filesystems-real: + @for g in $(GUESTS); do \ + echo $(RUN_VG) ../../cat/virt-filesystems -d $$g --all --long -h --uuid; \ + $(RUN_VG) ../../cat/virt-filesystems -d $$g --all --long -h --uuid > /dev/null; \ + r=$$?; \ + if [ $$r -ne 0 ]; then exit $$r; fi; \ + done + +test-inspector-real: + @for g in $(GUESTS); do \ + echo $(RUN_VG) ../../inspector/virt-inspector -d $$g; \ + $(RUN_VG) ../../inspector/virt-inspector -d $$g > /dev/null; \ + r=$$?; \ + if [ $$r -ne 0 ]; then exit $$r; fi; \ + done + +# Run virt-resize tests under valgrind. +test-resize: + $(MAKE) -C ../../resize VG="$(VG)" check + +# Run virt-sparsify tests under valgrind. +test-sparsify: + $(MAKE) -C ../../sparsify VG="$(VG)" check + +# Run c-api tests under valgrind. +test-c-api: + $(MAKE) -C ../c-api VG="$(RUN_VG)" check + +# Test OCaml bindings under valgrind. +test-ocaml: + $(MAKE) -C ../../ocaml VG="$(VG)" check diff --git a/tests/extra/suppressions b/tests/extra/suppressions new file mode 100644 index 00000000..4dc02d2f --- /dev/null +++ b/tests/extra/suppressions @@ -0,0 +1,132 @@ +# libnuma +{ + libnuma_numa_node_size64_cond + Memcheck:Cond + fun:* + fun:numa_node_size64 + fun:numa_init +} +{ + libnuma_numa_node_size64_cond_2 + Memcheck:Cond + fun:numa_node_size64 + fun:numa_init +} +{ + libnuma_numa_node_size64_cond_3 + Memcheck:Cond + fun:* + fun:numa_node_size64 + obj:/usr/lib64/libnuma.so.1 +} +{ + libnuma_numa_node_size64_cond_4 + Memcheck:Cond + fun:numa_node_size64 + obj:/usr/lib64/libnuma.so.1 +} +{ + libnuma_numa_node_size64_value8 + Memcheck:Value8 + fun:numa_node_size64 + fun:numa_init +} +{ + libnuma_numa_node_size64_value8_2 + Memcheck:Value8 + fun:numa_node_size64 + obj:/usr/lib64/libnuma.so.1 +} + +# libnl +{ + libnl_add_routing_table_name_leak + Memcheck:Leak + fun:malloc + fun:strdup + fun:add_routing_table_name +} +{ + libnl_add_routing_table_name_leak_2 + Memcheck:Leak + fun:calloc + fun:add_routing_table_name +} +{ + libnl_add_proto_name_leak + Memcheck:Leak + fun:malloc + fun:strdup + fun:add_proto_name +} +{ + libnl_add_proto_name_leak_2 + Memcheck:Leak + fun:calloc + fun:add_proto_name +} +{ + libnl1_malloc_leak + Memcheck:Leak + fun:malloc + fun:strdup + obj:/usr/lib/libnl.so.1.1 +} +{ + libnl1_malloc_leak_2 + Memcheck:Leak + fun:malloc + fun:strdup + obj:/lib64/libnl.so.1.1 +} +{ + libnl1_calloc_leak + Memcheck:Leak + fun:calloc + obj:/usr/lib/libnl.so.1.1 +} +{ + libnl1_calloc_leak_2 + Memcheck:Leak + fun:calloc + obj:/lib64/libnl.so.1.1 +} + +# OCaml, by design, doesn't bother to free the major heap before +# calling exit. Ignore that leak. +{ + ocaml_heap_leak + Memcheck:Leak + ... + fun:caml_alloc_for_heap +} +# On the other hand, these seem to be a real bugs in OCaml: +{ + ocaml_heap_leak_2 + Memcheck:Leak + fun:malloc + fun:caml_thread_new_descriptor + fun:caml_thread_new +} +{ + ocaml_heap_leak_3 + Memcheck:Leak + fun:malloc + fun:caml_thread_new_descriptor + fun:caml_thread_initialize +} +{ + ocaml_heap_leak_4 + Memcheck:Leak + ... + fun:pthread_create* + ... + fun:caml_thread_new +} +{ + ocaml_heap_leak_5 + Memcheck:Leak + fun:malloc + fun:caml_stat_alloc + fun:caml_threadstatus_new +} -- cgit