mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

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