[Libguestfs] [PATCH 2/2] p2v: Enable check-valgrind in this directory.

Richard W.M. Jones rjones at redhat.com
Thu Mar 16 21:57:49 UTC 2017


A couple of valgrind suppressions are required to work around memory
leaks in Gtk.
---
 p2v/Makefile.am              |  3 +++
 p2v/test-virt-p2v-cmdline.sh |  2 +-
 p2v/test-virt-p2v-nbdkit.sh  |  2 +-
 p2v/test-virt-p2v.sh         |  2 +-
 valgrind-suppressions        | 15 +++++++++++++++
 5 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/p2v/Makefile.am b/p2v/Makefile.am
index 9751a07..0b8c1c6 100644
--- a/p2v/Makefile.am
+++ b/p2v/Makefile.am
@@ -260,6 +260,9 @@ TESTS += \
 	$(SLOW_TESTS)
 endif ENABLE_APPLIANCE
 
+check-valgrind:
+	make VG="@VG@" check
+
 SLOW_TESTS = \
 	test-virt-p2v-pxe.sh
 
diff --git a/p2v/test-virt-p2v-cmdline.sh b/p2v/test-virt-p2v-cmdline.sh
index 1584381..770b7a8 100755
--- a/p2v/test-virt-p2v-cmdline.sh
+++ b/p2v/test-virt-p2v-cmdline.sh
@@ -27,7 +27,7 @@ out=test-virt-p2v-cmdline.out
 rm -f $out
 
 # The Linux kernel command line.
-virt-p2v --cmdline='p2v.server=localhost p2v.port=123 p2v.username=user p2v.password=secret p2v.skip_test_connection p2v.name=test p2v.vcpus=4 p2v.memory=1G p2v.disks=sda,sdb,sdc p2v.removable=sdd p2v.interfaces=eth0,eth1 p2v.o=local p2v.oa=sparse p2v.oc=qemu:///session p2v.of=raw p2v.os=/var/tmp p2v.network=em1:wired,other p2v.dump_config_and_exit' > $out
+$VG virt-p2v --cmdline='p2v.server=localhost p2v.port=123 p2v.username=user p2v.password=secret p2v.skip_test_connection p2v.name=test p2v.vcpus=4 p2v.memory=1G p2v.disks=sda,sdb,sdc p2v.removable=sdd p2v.interfaces=eth0,eth1 p2v.o=local p2v.oa=sparse p2v.oc=qemu:///session p2v.of=raw p2v.os=/var/tmp p2v.network=em1:wired,other p2v.dump_config_and_exit' > $out
 
 # For debugging purposes.
 cat $out
diff --git a/p2v/test-virt-p2v-nbdkit.sh b/p2v/test-virt-p2v-nbdkit.sh
index 08e223b..2f5ee62 100755
--- a/p2v/test-virt-p2v-nbdkit.sh
+++ b/p2v/test-virt-p2v-nbdkit.sh
@@ -51,7 +51,7 @@ export PATH=$d:$PATH
 cmdline="p2v.server=localhost p2v.name=windows p2v.disks=$f1,$f2 p2v.o=local p2v.os=$(pwd)/$d p2v.network=em1:wired,other p2v.post="
 
 # Only use nbdkit, disable qemu-nbd.
-virt-p2v --cmdline="$cmdline" --nbd=nbdkit,nbdkit-no-sa
+$VG virt-p2v --cmdline="$cmdline" --nbd=nbdkit,nbdkit-no-sa
 
 # Test the libvirt XML metadata and a disk was created.
 test -f $d/windows.xml
diff --git a/p2v/test-virt-p2v.sh b/p2v/test-virt-p2v.sh
index 3642dc0..b9c5397 100755
--- a/p2v/test-virt-p2v.sh
+++ b/p2v/test-virt-p2v.sh
@@ -49,7 +49,7 @@ export PATH=$d:$PATH
 # The Linux kernel command line.
 cmdline="p2v.server=localhost p2v.name=windows p2v.disks=$f1,$f2 p2v.o=local p2v.os=$(pwd)/$d p2v.network=em1:wired,other p2v.post="
 
-virt-p2v --cmdline="$cmdline"
+$VG virt-p2v --cmdline="$cmdline"
 
 # Test the libvirt XML metadata and a disk was created.
 test -f $d/windows.xml
diff --git a/valgrind-suppressions b/valgrind-suppressions
index c2fa979..0448b9c 100644
--- a/valgrind-suppressions
+++ b/valgrind-suppressions
@@ -327,6 +327,21 @@
    fun:file_apprentice
 }
 
+# Gtk
+{
+   gtk_leak
+   Memcheck:Leak
+   ...
+   fun:gtk_init_check
+}
+
+{
+   gtk_leak_2
+   Memcheck:Leak
+   ...
+   fun:gdk_display_manager_get
+}
+
 # Perl
 # note: Perl leaks memory by design, this just suppresses them.
 {
-- 
2.10.2




More information about the Libguestfs mailing list