mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0075-RHEL-8-Fix-tests-for-libguestfs-winsupport.patch

b155d0
From 1e02333d395f695e05c9ac884bf4984448269ce2 Mon Sep 17 00:00:00 2001
46b2f6
From: "Richard W.M. Jones" <rjones@redhat.com>
46b2f6
Date: Sun, 30 Aug 2015 03:21:57 -0400
46b2f6
Subject: [PATCH] RHEL 8: Fix tests for libguestfs-winsupport.
46b2f6
46b2f6
It doesn't let us use guestfish for arbitrary Windows edits.
46b2f6
---
46b2f6
 test-data/phony-guests/make-windows-img.sh | 1 +
46b2f6
 tests/charsets/test-charset-fidelity.c     | 2 ++
46b2f6
 v2v/test-v2v-virtio-win-iso.sh             | 8 +++++++-
46b2f6
 v2v/test-v2v-windows-conversion.sh         | 8 +++++++-
46b2f6
 4 files changed, 17 insertions(+), 2 deletions(-)
46b2f6
46b2f6
diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh
46b2f6
index 8676b5ac0..1a88d9fc9 100755
46b2f6
--- a/test-data/phony-guests/make-windows-img.sh
46b2f6
+++ b/test-data/phony-guests/make-windows-img.sh
46b2f6
@@ -37,6 +37,7 @@ fi
46b2f6
 
46b2f6
 # Create a disk image.
46b2f6
 guestfish <
46b2f6
+set-program virt-testing
46b2f6
 sparse windows.img-t 512M
46b2f6
 run
46b2f6
 
46b2f6
diff --git a/tests/charsets/test-charset-fidelity.c b/tests/charsets/test-charset-fidelity.c
46b2f6
index 967afbc88..eb0491b13 100644
46b2f6
--- a/tests/charsets/test-charset-fidelity.c
46b2f6
+++ b/tests/charsets/test-charset-fidelity.c
46b2f6
@@ -93,6 +93,8 @@ main (int argc, char *argv[])
46b2f6
   if (g == NULL)
46b2f6
     error (EXIT_FAILURE, 0, "failed to create handle");
46b2f6
 
46b2f6
+  guestfs_set_program (g, "virt-testing");
46b2f6
+
46b2f6
   if (guestfs_add_drive_scratch (g, 1024*1024*1024, -1) == -1)
46b2f6
     exit (EXIT_FAILURE);
46b2f6
 
46b2f6
diff --git a/v2v/test-v2v-virtio-win-iso.sh b/v2v/test-v2v-virtio-win-iso.sh
46b2f6
index 6e99f0f1d..a8e572c5f 100755
46b2f6
--- a/v2v/test-v2v-virtio-win-iso.sh
46b2f6
+++ b/v2v/test-v2v-virtio-win-iso.sh
46b2f6
@@ -79,6 +79,12 @@ mktest ()
46b2f6
 :> "$script"
46b2f6
 :> "$expected"
46b2f6
 
46b2f6
+cat >> "$script" <
46b2f6
+  set-program virt-testing
46b2f6
+  run
46b2f6
+  mount /dev/sda2 /
46b2f6
+EOF
46b2f6
+
46b2f6
 firstboot_dir="/Program Files/Guestfs/Firstboot"
46b2f6
 mktest "is-dir \"$firstboot_dir\"" true
46b2f6
 mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
46b2f6
@@ -91,7 +97,7 @@ for drv in netkvm vioscsi viostor; do
46b2f6
     done
46b2f6
 done
46b2f6
 
46b2f6
-guestfish --ro -a "$d/windows-sda" -i < "$script" > "$response"
46b2f6
+guestfish --ro -a "$d/windows-sda" < "$script" > "$response"
46b2f6
 diff -u "$expected" "$response"
46b2f6
 
46b2f6
 rm -r $d
46b2f6
diff --git a/v2v/test-v2v-windows-conversion.sh b/v2v/test-v2v-windows-conversion.sh
46b2f6
index f1da222a9..ff94fe39b 100755
46b2f6
--- a/v2v/test-v2v-windows-conversion.sh
46b2f6
+++ b/v2v/test-v2v-windows-conversion.sh
46b2f6
@@ -73,6 +73,12 @@ mktest ()
46b2f6
 :> "$script"
46b2f6
 :> "$expected"
46b2f6
 
46b2f6
+cat >> "$script" <
46b2f6
+  set-program virt-testing
46b2f6
+  run
46b2f6
+  mount /dev/sda2 /
46b2f6
+EOF
46b2f6
+
46b2f6
 firstboot_dir="/Program Files/Guestfs/Firstboot"
46b2f6
 mktest "is-dir \"$firstboot_dir\"" true
46b2f6
 mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
46b2f6
@@ -85,7 +91,7 @@ for drv in netkvm qxl vioscsi viostor; do
46b2f6
     done
46b2f6
 done
46b2f6
 
46b2f6
-guestfish --ro -a "$d/windows-sda" -i < "$script" > "$response"
46b2f6
+guestfish --ro -a "$d/windows-sda" < "$script" > "$response"
46b2f6
 diff -u "$expected" "$response"
46b2f6
 
46b2f6
 # We also update the Registry several times, for firstboot, and (ONLY
46b2f6
-- 
b155d0
2.26.2
46b2f6