mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0024-RHEL-7-Fix-tests-for-libguestfs-winsupport-7.2.patch

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