Instead of using the "global" Windows test image, use a local Fedora image created with virt-builder. --- p2v/.gitignore | 1 + p2v/Makefile.am | 9 ++++++--- p2v/test-virt-p2v-nbdkit.sh | 14 ++++++-------- p2v/test-virt-p2v-pxe.sh | 16 +++++----------- p2v/test-virt-p2v.sh | 14 ++++++-------- 5 files changed, 24 insertions(+), 30 deletions(-) diff --git a/p2v/.gitignore b/p2v/.gitignore index 7ed707cea..673e8ad83 100644 --- a/p2v/.gitignore +++ b/p2v/.gitignore @@ -13,6 +13,7 @@ Makefile.in /dependencies.debian /dependencies.redhat /dependencies.suse +/fedora.img /kernel-config.c /p2v-config.h /stamp-test-virt-p2v-pxe-data-files diff --git a/p2v/Makefile.am b/p2v/Makefile.am index 2cd5235e3..b4b57db91 100644 --- a/p2v/Makefile.am +++ b/p2v/Makefile.am @@ -220,7 +220,10 @@ stamp-virt-p2v-make-kiwi.pod: virt-p2v-make-kiwi.pod # Run virt-p2v locally either directly or in a VM. # See guestfs-hacking(1) section "Running virt-p2v" -PHYSICAL_MACHINE = $(abs_top_builddir)/test-data/phony-guests/windows.img +PHYSICAL_MACHINE = $(abs_builddir)/fedora.img + +check_DATA = \ + $(PHYSICAL_MACHINE) run-virt-p2v-directly: $(PHYSICAL_MACHINE) $(top_builddir)/run virt-p2v --test-disk=$(PHYSICAL_MACHINE) @@ -247,8 +250,8 @@ run-virt-p2v-in-a-vm: virt-p2v.img $(PHYSICAL_MACHINE) run-virt-p2v-non-gui-conversion: stamp-test-virt-p2v-pxe-data-files SLOW=1 $(top_builddir)/run ./test-virt-p2v-pxe.sh -$(abs_top_builddir)/test-data/phony-guests/windows.img: - $(MAKE) -C $(top_builddir)/test-data/phony-guests windows.img +$(PHYSICAL_MACHINE): + $(top_builddir)/run virt-builder --format raw -o $@ fedora-30 virt-p2v.img: \ dependencies.m4 \ diff --git a/p2v/test-virt-p2v-nbdkit.sh b/p2v/test-virt-p2v-nbdkit.sh index 58037d799..6e7ae2129 100755 --- a/p2v/test-virt-p2v-nbdkit.sh +++ b/p2v/test-virt-p2v-nbdkit.sh @@ -24,14 +24,12 @@ $TEST_FUNCTIONS skip_if_skipped skip_if_backend uml skip_unless nbdkit file --version -skip_unless_phony_guest windows.img +skip_unless test -f fedora.img skip_unless_phony_guest blank-part.img -f1="$abs_top_builddir/test-data/phony-guests/windows.img" +f1="$abs_builddir/fedora.img" f2="$abs_top_builddir/test-data/phony-guests/blank-part.img" -export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools" - d=test-virt-p2v-nbdkit.d rm -rf $d mkdir $d @@ -48,14 +46,14 @@ export PATH=$d:$PATH # binaries under test (because of the ./run script). # 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=" +cmdline="p2v.server=localhost p2v.name=fedora p2v.disks=$f1,$f2 p2v.o=local p2v.os=$(pwd)/$d p2v.network=em1:wired,other p2v.post=" # Only use nbdkit, disable qemu-nbd. $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 -test -f $d/windows-sda -test -f $d/windows-sdb +test -f $d/fedora.xml +test -f $d/fedora-sda +test -f $d/fedora-sdb rm -r $d diff --git a/p2v/test-virt-p2v-pxe.sh b/p2v/test-virt-p2v-pxe.sh index 360853f8a..bad41886e 100755 --- a/p2v/test-virt-p2v-pxe.sh +++ b/p2v/test-virt-p2v-pxe.sh @@ -41,14 +41,8 @@ if ! test -f $img; then exit 77 fi -skip_unless_phony_guest windows.img -f="$top_builddir/test-data/phony-guests/windows.img" - -virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools} -if ! test -r $virt_tools_data_dir/rhsrvany.exe; then - echo "$0: test skipped because rhsrvany.exe is not installed" - exit 77 -fi +skip_unless test -f fedora.img +f="$abs_builddir/fedora.img" d=test-virt-p2v-pxe.d rm -rf $d @@ -74,7 +68,7 @@ username="$(id -un)" os="$(cd $d; pwd)" # The Linux kernel command line. -cmdline="root=/dev/sda4 ro console=ttyS0 printk.time=1 p2v.server=10.0.2.2 p2v.port=$port p2v.username=$username p2v.identity=file:///var/tmp/id_rsa p2v.name=windows p2v.o=local p2v.os=$os" +cmdline="root=/dev/sda4 ro console=ttyS0 printk.time=1 p2v.server=10.0.2.2 p2v.port=$port p2v.username=$username p2v.identity=file:///var/tmp/id_rsa p2v.name=fedora p2v.o=local p2v.os=$os" # Run virt-p2v inside qemu. $qemu \ @@ -96,7 +90,7 @@ $qemu \ -serial stdio # Test the libvirt XML metadata and a disk was created. -test -f $d/windows.xml -test -f $d/windows-sda +test -f $d/fedora.xml +test -f $d/fedora-sda rm -r $d diff --git a/p2v/test-virt-p2v.sh b/p2v/test-virt-p2v.sh index b9c53971d..5d3cda448 100755 --- a/p2v/test-virt-p2v.sh +++ b/p2v/test-virt-p2v.sh @@ -23,14 +23,12 @@ set -e $TEST_FUNCTIONS skip_if_skipped skip_if_backend uml -skip_unless_phony_guest windows.img +skip_unless test -f fedora.img skip_unless_phony_guest blank-part.img -f1="$abs_top_builddir/test-data/phony-guests/windows.img" +f1="$abs_builddir/fedora.img" f2="$abs_top_builddir/test-data/phony-guests/blank-part.img" -export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools" - d=test-virt-p2v.d rm -rf $d mkdir $d @@ -47,13 +45,13 @@ export PATH=$d:$PATH # binaries under test (because of the ./run script). # 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=" +cmdline="p2v.server=localhost p2v.name=fedora p2v.disks=$f1,$f2 p2v.o=local p2v.os=$(pwd)/$d p2v.network=em1:wired,other p2v.post=" $VG virt-p2v --cmdline="$cmdline" # Test the libvirt XML metadata and a disk was created. -test -f $d/windows.xml -test -f $d/windows-sda -test -f $d/windows-sdb +test -f $d/fedora.xml +test -f $d/fedora-sda +test -f $d/fedora-sdb rm -r $d -- 2.21.0