[Libguestfs] [PATCH 6/6] p2v: tests: use a local blank-part disk image

Pino Toscano ptoscano at redhat.com
Mon Jul 1 16:51:22 UTC 2019


Instead of using the "global" blank-part test image, use a local version
of it created with guestfish.
---
 p2v/.gitignore              | 1 +
 p2v/Makefile.am             | 7 ++++++-
 p2v/test-virt-p2v-nbdkit.sh | 4 ++--
 p2v/test-virt-p2v.sh        | 4 ++--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/p2v/.gitignore b/p2v/.gitignore
index 673e8ad83..8495f6c2f 100644
--- a/p2v/.gitignore
+++ b/p2v/.gitignore
@@ -8,6 +8,7 @@ Makefile
 Makefile.in
 
 /about-authors.c
+/blank-part.img
 /config.c
 /dependencies.archlinux
 /dependencies.debian
diff --git a/p2v/Makefile.am b/p2v/Makefile.am
index b4b57db91..5ee9d97d5 100644
--- a/p2v/Makefile.am
+++ b/p2v/Makefile.am
@@ -221,9 +221,11 @@ stamp-virt-p2v-make-kiwi.pod: virt-p2v-make-kiwi.pod
 # See guestfs-hacking(1) section "Running virt-p2v"
 
 PHYSICAL_MACHINE = $(abs_builddir)/fedora.img
+BLANK_DISK = blank-part.img
 
 check_DATA = \
-	$(PHYSICAL_MACHINE)
+	$(PHYSICAL_MACHINE) \
+	$(BLANK_DISK)
 
 run-virt-p2v-directly: $(PHYSICAL_MACHINE)
 	$(top_builddir)/run virt-p2v --test-disk=$(PHYSICAL_MACHINE)
@@ -253,6 +255,9 @@ run-virt-p2v-non-gui-conversion: stamp-test-virt-p2v-pxe-data-files
 $(PHYSICAL_MACHINE):
 	$(top_builddir)/run virt-builder --format raw -o $@ fedora-30
 
+$(BLANK_DISK):
+	$(top_builddir)/run guestfish -N $@=part exit
+
 virt-p2v.img: \
 	    dependencies.m4 \
 	    issue \
diff --git a/p2v/test-virt-p2v-nbdkit.sh b/p2v/test-virt-p2v-nbdkit.sh
index 6e7ae2129..5c635bb03 100755
--- a/p2v/test-virt-p2v-nbdkit.sh
+++ b/p2v/test-virt-p2v-nbdkit.sh
@@ -25,10 +25,10 @@ skip_if_skipped
 skip_if_backend uml
 skip_unless nbdkit file --version
 skip_unless test -f fedora.img
-skip_unless_phony_guest blank-part.img
+skip_unless test -f blank-part.img
 
 f1="$abs_builddir/fedora.img"
-f2="$abs_top_builddir/test-data/phony-guests/blank-part.img"
+f2="$abs_builddir/blank-part.img"
 
 d=test-virt-p2v-nbdkit.d
 rm -rf $d
diff --git a/p2v/test-virt-p2v.sh b/p2v/test-virt-p2v.sh
index 5d3cda448..121bf12eb 100755
--- a/p2v/test-virt-p2v.sh
+++ b/p2v/test-virt-p2v.sh
@@ -24,10 +24,10 @@ $TEST_FUNCTIONS
 skip_if_skipped
 skip_if_backend uml
 skip_unless test -f fedora.img
-skip_unless_phony_guest blank-part.img
+skip_unless test -f blank-part.img
 
 f1="$abs_builddir/fedora.img"
-f2="$abs_top_builddir/test-data/phony-guests/blank-part.img"
+f2="$abs_builddir/blank-part.img"
 
 d=test-virt-p2v.d
 rm -rf $d
-- 
2.21.0




More information about the Libguestfs mailing list