[Libguestfs] [PATCH 1/3] tests: specify the image format when possible

Pino Toscano ptoscano at redhat.com
Thu May 19 16:57:18 UTC 2016


When possible, make the disk image format explicit when invoking tools
or using add-drive. This avoids warnings from qemu about the unspecified
format for the image, and also makes qemu slightly faster (skipping the
disk image probing).
Tests checking the image probing are not touched.

This changes also:
- old-style invocations of tools (`$tool $filename`) into new style
  (`$tool -a $filename`)
- add-drive-ro/add-drive-with-if guestfish commands into add/add-drive
  with explicit readonly/iface arguments

There should be no change in the tests results.
---
 align/test-virt-alignment-scan.sh         | 2 +-
 cat/test-virt-cat.sh                      | 4 ++--
 cat/test-virt-filesystems.sh              | 4 ++--
 cat/test-virt-log.sh                      | 2 +-
 cat/test-virt-ls.sh                       | 4 ++--
 customize/test-virt-customize.sh          | 2 +-
 df/test-virt-df.sh                        | 2 +-
 diff/test-virt-diff.sh                    | 4 ++--
 edit/test-virt-edit.sh                    | 6 +++---
 fish/test-copy.sh                         | 2 +-
 fish/test-inspect.sh                      | 2 +-
 fish/test-run.sh                          | 2 +-
 format/test-virt-format.sh                | 4 ++--
 fuse/test-fuse-umount-race.sh             | 4 ++--
 inspector/test-virt-inspector.sh          | 2 +-
 rescue/test-virt-rescue-suggest.sh        | 2 +-
 sparsify/test-virt-sparsify-in-place.sh   | 2 +-
 sparsify/test-virt-sparsify.sh            | 2 +-
 sysprep/test-virt-sysprep-passwords.sh    | 1 +
 sysprep/test-virt-sysprep-script.sh       | 8 ++++----
 sysprep/test-virt-sysprep.sh              | 2 +-
 test-data/phony-guests/make-fedora-img.pl | 6 +++---
 tests/gdisk/test-expand-gpt.pl            | 4 ++--
 tests/md/test-inspect-fstab-md.sh         | 6 +++---
 tests/md/test-inspect-fstab.sh            | 8 ++++----
 tests/md/test-list-md-devices.sh          | 2 +-
 tests/mountable/test-mountable-inspect.sh | 4 ++--
 tests/ntfs/test-ntfscat.sh                | 2 +-
 tests/ntfs/test-ntfsclone.sh              | 2 +-
 tests/regressions/rhbz1011907-1165785.sh  | 4 ++--
 tests/regressions/rhbz1054761.sh          | 2 +-
 tests/regressions/rhbz1174551.sh          | 2 +-
 tests/regressions/rhbz1285847.sh          | 2 +-
 tests/regressions/rhbz563450.sh           | 4 ++--
 tests/regressions/rhbz580246.sh           | 2 +-
 tests/regressions/rhbz690819.sh           | 2 +-
 tests/regressions/rhbz789960.sh           | 2 +-
 tests/regressions/rhbz811649.sh           | 2 +-
 tests/regressions/rhbz975797.sh           | 6 +++---
 tests/tsk/test-download-inode.sh          | 2 +-
 tools/test-virt-list-filesystems.sh       | 2 +-
 41 files changed, 65 insertions(+), 64 deletions(-)

diff --git a/align/test-virt-alignment-scan.sh b/align/test-virt-alignment-scan.sh
index 7568f23..ab44c26 100755
--- a/align/test-virt-alignment-scan.sh
+++ b/align/test-virt-alignment-scan.sh
@@ -18,7 +18,7 @@
 
 export LANG=C
 
-$VG virt-alignment-scan -a ../test-data/phony-guests/fedora.img
+$VG virt-alignment-scan --format=raw -a ../test-data/phony-guests/fedora.img
 r=$?
 
 # 0, 2 and 3 are reasonable non-error exit codes.  Others are errors.
diff --git a/cat/test-virt-cat.sh b/cat/test-virt-cat.sh
index fc055d5..14b4a65 100755
--- a/cat/test-virt-cat.sh
+++ b/cat/test-virt-cat.sh
@@ -20,11 +20,11 @@ export LANG=C
 set -e
 
 # Read out the test files from the image using virt-cat.
-if [ "$($VG virt-cat ../test-data/phony-guests/fedora.img /etc/test1)" != "abcdefg" ]; then
+if [ "$($VG virt-cat --format=raw -a ../test-data/phony-guests/fedora.img /etc/test1)" != "abcdefg" ]; then
     echo "$0: error: mismatch in file test1"
     exit 1
 fi
-if [ "$($VG virt-cat ../test-data/phony-guests/fedora.img /etc/test2)" != "" ]; then
+if [ "$($VG virt-cat --format=raw -a ../test-data/phony-guests/fedora.img /etc/test2)" != "" ]; then
     echo "$0: error: mismatch in file test2"
     exit 1
 fi
diff --git a/cat/test-virt-filesystems.sh b/cat/test-virt-filesystems.sh
index 6f13bd7..6c300df 100755
--- a/cat/test-virt-filesystems.sh
+++ b/cat/test-virt-filesystems.sh
@@ -19,7 +19,7 @@
 export LANG=C
 set -e
 
-output="$($VG virt-filesystems -a ../test-data/phony-guests/fedora.img | sort)"
+output="$($VG virt-filesystems --format=raw -a ../test-data/phony-guests/fedora.img | sort)"
 expected="/dev/VG/LV1
 /dev/VG/LV2
 /dev/VG/LV3
@@ -32,7 +32,7 @@ if [ "$output" != "$expected" ]; then
     exit 1
 fi
 
-output="$($VG virt-filesystems -a ../test-data/phony-guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)"
+output="$($VG virt-filesystems --format=raw -a ../test-data/phony-guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)"
 expected="/dev/VG
 /dev/VG/LV1
 /dev/VG/LV2
diff --git a/cat/test-virt-log.sh b/cat/test-virt-log.sh
index c1bf3e7..4e08115 100755
--- a/cat/test-virt-log.sh
+++ b/cat/test-virt-log.sh
@@ -47,7 +47,7 @@ for f in ../test-data/phony-guests/{fedora,debian,ubuntu}.img; do
         echo
         continue
     fi
-    $VG virt-log -a "$f" &> $tmpfile
+    $VG virt-log --format=raw -a "$f" &> $tmpfile
     cat $tmpfile
     echo
 done
diff --git a/cat/test-virt-ls.sh b/cat/test-virt-ls.sh
index 4ea8008..4b7d927 100755
--- a/cat/test-virt-ls.sh
+++ b/cat/test-virt-ls.sh
@@ -20,7 +20,7 @@ export LANG=C
 set -e
 
 # Read out the test directory using virt-ls.
-if [ "$($VG virt-ls ../test-data/phony-guests/fedora.img /bin)" != "ls
+if [ "$($VG virt-ls --format=raw -a ../test-data/phony-guests/fedora.img /bin)" != "ls
 test1
 test2
 test3
@@ -33,7 +33,7 @@ test7" ]; then
 fi
 
 # Try the -lR option.
-output="$($VG virt-ls -lR ../test-data/phony-guests/fedora.img /boot | awk '{print $1 $2 $4}')"
+output="$($VG virt-ls -lR --format=raw -a ../test-data/phony-guests/fedora.img /boot | awk '{print $1 $2 $4}')"
 expected="d0755/boot
 d0755/boot/grub
 -0644/boot/grub/grub.conf
diff --git a/customize/test-virt-customize.sh b/customize/test-virt-customize.sh
index 00d1978..f98eccd 100755
--- a/customize/test-virt-customize.sh
+++ b/customize/test-virt-customize.sh
@@ -26,7 +26,7 @@ for f in ../test-data/phony-guests/{debian,fedora,ubuntu}.img; do
     # Ignore zero-sized windows.img if ntfs-3g is not installed.
     if [ -s "$f" ]; then
         # Add --no-network so UML works.
-	$VG virt-customize -n -a $f \
+	$VG virt-customize -n --format=raw -a $f \
             --no-network \
             --write /etc/motd:HELLO \
             --chmod 0600:/etc/motd \
diff --git a/df/test-virt-df.sh b/df/test-virt-df.sh
index 0c2fa6b..cd068e9 100755
--- a/df/test-virt-df.sh
+++ b/df/test-virt-df.sh
@@ -20,7 +20,7 @@ export LANG=C
 set -e
 
 # Run virt-df.
-output=$($VG virt-df ../test-data/phony-guests/fedora.img)
+output=$($VG virt-df --format=raw -a ../test-data/phony-guests/fedora.img)
 
 # Check title is the first line.
 if [[ ! $output =~ ^Filesystem.* ]]; then
diff --git a/diff/test-virt-diff.sh b/diff/test-virt-diff.sh
index d158043..5a63515 100755
--- a/diff/test-virt-diff.sh
+++ b/diff/test-virt-diff.sh
@@ -36,12 +36,12 @@ guestfish -- \
   disk-create fedora.qcow2 qcow2 -1 \
     backingfile:../test-data/phony-guests/fedora.img backingformat:raw
 
-guestfish -a fedora.qcow2 -i <<EOF
+guestfish --format=qcow2 -a fedora.qcow2 -i <<EOF
 touch /diff
 write-append /etc/motd "Testing virt-diff\n"
 EOF
 
-output="$($VG virt-diff -a ../test-data/phony-guests/fedora.img -A fedora.qcow2)"
+output="$($VG virt-diff --format=raw -a ../test-data/phony-guests/fedora.img --format=qcow2 -A fedora.qcow2)"
 
 expected="\
 + - 0644          0 /diff
diff --git a/edit/test-virt-edit.sh b/edit/test-virt-edit.sh
index bac2754..e848381 100755
--- a/edit/test-virt-edit.sh
+++ b/edit/test-virt-edit.sh
@@ -35,7 +35,7 @@ guestfish -- \
 # Edit interactively.  We have to simulate this by setting $EDITOR.
 # The command will be: echo newline >> /tmp/file
 export EDITOR='echo newline >>'
-virt-edit -a test.qcow2 /etc/test3
+virt-edit --format=qcow2 -a test.qcow2 /etc/test3
 if [ "$(virt-cat -a test.qcow2 /etc/test3)" != "a
 b
 c
@@ -50,7 +50,7 @@ unset EDITOR
 
 # Edit non-interactively, only if we have 'perl' binary.
 if perl --version >/dev/null 2>&1; then
-    virt-edit -a test.qcow2 /etc/test3 -e 's/^[a-f]/$lineno/'
+    virt-edit --format=qcow2 -a test.qcow2 /etc/test3 -e 's/^[a-f]/$lineno/'
     if [ "$(virt-cat -a test.qcow2 /etc/test3)" != "1
 2
 3
@@ -65,7 +65,7 @@ fi
 
 # Verify the mode of /etc/test3 is still 0600 and the UID:GID is 10:11.
 # See test-data/phony-guests/make-fedora-img.pl and RHBZ#788641.
-if [ "$(guestfish -i -a test.qcow2 --ro lstat /etc/test3 | grep -E '^(mode|uid|gid):' | sort)" != "gid: 11
+if [ "$(guestfish -i --format=qcow2 -a test.qcow2 --ro lstat /etc/test3 | grep -E '^(mode|uid|gid):' | sort)" != "gid: 11
 mode: 33152
 uid: 10" ]; then
     echo "$0: error: editing /etc/test3 did not preserve permissions or ownership"
diff --git a/fish/test-copy.sh b/fish/test-copy.sh
index d144291..f375beb 100755
--- a/fish/test-copy.sh
+++ b/fish/test-copy.sh
@@ -63,7 +63,7 @@ fi
 
 mkdir test-copy-copy
 
-$VG guestfish --ro -a test-copy.img -m /dev/sda1 <<EOF
+$VG guestfish --ro --format=raw -a test-copy.img -m /dev/sda1 <<EOF
 copy-out /data/test-copy-original test-copy-copy
 EOF
 
diff --git a/fish/test-inspect.sh b/fish/test-inspect.sh
index 342504c..1a47dd2 100755
--- a/fish/test-inspect.sh
+++ b/fish/test-inspect.sh
@@ -18,4 +18,4 @@
 
 set -e
 
-$VG guestfish --ro -a ../test-data/phony-guests/fedora.img -i exit
+$VG guestfish --ro --format=raw -a ../test-data/phony-guests/fedora.img -i exit
diff --git a/fish/test-run.sh b/fish/test-run.sh
index 9b5f13f..237ecf7 100755
--- a/fish/test-run.sh
+++ b/fish/test-run.sh
@@ -18,4 +18,4 @@
 
 set -e
 
-$VG guestfish --ro -a ../test-data/phony-guests/fedora.img run
+$VG guestfish --ro --format=raw -a ../test-data/phony-guests/fedora.img run
diff --git a/format/test-virt-format.sh b/format/test-virt-format.sh
index 2383c71..bca0c05 100755
--- a/format/test-virt-format.sh
+++ b/format/test-virt-format.sh
@@ -29,9 +29,9 @@ rm -f test-virt-format.img
 
 $VG guestfish -N test-virt-format.img=bootrootlv exit
 
-$VG virt-format --filesystem=ext3 -a test-virt-format.img
+$VG virt-format --filesystem=ext3 --format=raw -a test-virt-format.img
 
-if [ "$($VG virt-filesystems -a test-virt-format.img)" != "/dev/sda1" ]; then
+if [ "$($VG virt-filesystems --format=raw -a test-virt-format.img)" != "/dev/sda1" ]; then
     echo "$0: unexpected output after using virt-format"
     exit 1
 fi
diff --git a/fuse/test-fuse-umount-race.sh b/fuse/test-fuse-umount-race.sh
index e10a244..3c85f17 100755
--- a/fuse/test-fuse-umount-race.sh
+++ b/fuse/test-fuse-umount-race.sh
@@ -57,7 +57,7 @@ guestfish -- \
       backingfile:../test-data/phony-guests/fedora.img backingformat:raw
 
 mkdir mp
-./guestmount -a test.qcow2 -m /dev/VG/Root --pid-file test.pid mp
+./guestmount --format=qcow2 -a test.qcow2 -m /dev/VG/Root --pid-file test.pid mp
 cp $0 mp/test-umount
 
 # Save the PID of guestmount.
@@ -82,7 +82,7 @@ fi
 # It should now be safe to copy and read the disk image.
 cp test.qcow2 test-copy.qcow2
 
-if [ "$(guestfish -a test-copy.qcow2 --ro -i is-file /test-umount)" != "true" ]; then
+if [ "$(guestfish --format=qcow2 -a test-copy.qcow2 --ro -i is-file /test-umount)" != "true" ]; then
     echo "$0: test failed"
     exit 1
 fi
diff --git a/inspector/test-virt-inspector.sh b/inspector/test-virt-inspector.sh
index 0dc209d..13794c8 100755
--- a/inspector/test-virt-inspector.sh
+++ b/inspector/test-virt-inspector.sh
@@ -33,7 +33,7 @@ for f in ../test-data/phony-guests/{debian,fedora,ubuntu,archlinux,coreos,window
     # Ignore zero-sized windows.img if ntfs-3g is not installed.
     if [ -s "$f" ]; then
         b=$(basename "$f" .xml)
-	$VG virt-inspector -a "$f" > "actual-$b.xml"
+	$VG virt-inspector --format=raw -a "$f" > "actual-$b.xml"
         # This 'diff' command will fail (because of -e option) if there
         # are any differences.
         diff -ur $diff_ignore "expected-$b.xml" "actual-$b.xml"
diff --git a/rescue/test-virt-rescue-suggest.sh b/rescue/test-virt-rescue-suggest.sh
index e49b38f..a8b41e2 100755
--- a/rescue/test-virt-rescue-suggest.sh
+++ b/rescue/test-virt-rescue-suggest.sh
@@ -28,7 +28,7 @@ fi
 
 rm -f virt-rescue-suggest.out
 
-$VG virt-rescue --suggest "$guest" |
+$VG virt-rescue --suggest --format=raw -a "$guest" |
   grep '^mount ' |
   sed -r 's,/dev/[abce-ln-z]+d,/dev/sd,' > virt-rescue-suggest.out
 
diff --git a/sparsify/test-virt-sparsify-in-place.sh b/sparsify/test-virt-sparsify-in-place.sh
index 456ae3a..8797c27 100755
--- a/sparsify/test-virt-sparsify-in-place.sh
+++ b/sparsify/test-virt-sparsify-in-place.sh
@@ -49,7 +49,7 @@ EOF
 
 size_before=$(du -s test-virt-sparsify-in-place.img | awk '{print $1}')
 
-$VG virt-sparsify --debug-gc --in-place test-virt-sparsify-in-place.img || {
+$VG virt-sparsify --debug-gc --in-place --format raw test-virt-sparsify-in-place.img || {
     if [ "$?" -eq 3 ]; then
         rm test-virt-sparsify-in-place.img
         echo "$0: discard not supported in virt-sparsify"
diff --git a/sparsify/test-virt-sparsify.sh b/sparsify/test-virt-sparsify.sh
index 0404424..7d18bf6 100755
--- a/sparsify/test-virt-sparsify.sh
+++ b/sparsify/test-virt-sparsify.sh
@@ -42,7 +42,7 @@ rm /boot/big
 umount-all
 EOF
 
-$VG virt-sparsify --debug-gc test-virt-sparsify-1.img --convert qcow2 test-virt-sparsify-2.img
+$VG virt-sparsify --debug-gc --format raw test-virt-sparsify-1.img --convert qcow2 test-virt-sparsify-2.img
 
 size_before=$(du -s test-virt-sparsify-1.img | awk '{print $1}')
 size_after=$(du -s test-virt-sparsify-2.img | awk '{print $1}')
diff --git a/sysprep/test-virt-sysprep-passwords.sh b/sysprep/test-virt-sysprep-passwords.sh
index ba34b0c..5e185e3 100755
--- a/sysprep/test-virt-sysprep-passwords.sh
+++ b/sysprep/test-virt-sysprep-passwords.sh
@@ -58,6 +58,7 @@ echo 123456 > password
 # Run virt-sysprep password operation.
 
 virt-sysprep \
+    --format qcow2 \
     -a passwords.qcow2 \
     --enable customize \
     --password test01:password:123456 \
diff --git a/sysprep/test-virt-sysprep-script.sh b/sysprep/test-virt-sysprep-script.sh
index 409a9b7..49d0756 100755
--- a/sysprep/test-virt-sysprep-script.sh
+++ b/sysprep/test-virt-sysprep-script.sh
@@ -32,7 +32,7 @@ fi
 
 # Check that multiple scripts can run.
 rm -f stamp-script1.sh stamp-script2.sh stamp-script4.sh
-if ! virt-sysprep -q -n -a ../test-data/phony-guests/fedora.img --enable script \
+if ! virt-sysprep -q -n --format raw -a ../test-data/phony-guests/fedora.img --enable script \
         --script $abs_srcdir/script1.sh --script $abs_srcdir/script2.sh; then
     echo "$0: virt-sysprep wasn't expected to exit with error."
     exit 1
@@ -43,19 +43,19 @@ if [ ! -f stamp-script1.sh -o ! -f stamp-script2.sh ]; then
 fi
 
 # Check that if a script fails, virt-sysprep exits with an error.
-if virt-sysprep -q -n -a ../test-data/phony-guests/fedora.img --enable script \
+if virt-sysprep -q -n --format raw -a ../test-data/phony-guests/fedora.img --enable script \
         --script $abs_srcdir/script3.sh; then
     echo "$0: virt-sysprep didn't exit with an error."
     exit 1
 fi
 
 # Check that virt-sysprep uses a new temporary directory every time.
-if ! virt-sysprep -q -n -a ../test-data/phony-guests/fedora.img --enable script \
+if ! virt-sysprep -q -n --format raw -a ../test-data/phony-guests/fedora.img --enable script \
         --script $abs_srcdir/script4.sh; then
     echo "$0: virt-sysprep (script4.sh, try #1) wasn't expected to exit with error."
     exit 1
 fi
-if ! virt-sysprep -q -n -a ../test-data/phony-guests/fedora.img --enable script \
+if ! virt-sysprep -q -n --format raw -a ../test-data/phony-guests/fedora.img --enable script \
         --script $abs_srcdir/script4.sh; then
     echo "$0: virt-sysprep (script4.sh, try #2) wasn't expected to exit with error."
     exit 1
diff --git a/sysprep/test-virt-sysprep.sh b/sysprep/test-virt-sysprep.sh
index e9dd9a9..802f9b6 100755
--- a/sysprep/test-virt-sysprep.sh
+++ b/sysprep/test-virt-sysprep.sh
@@ -41,7 +41,7 @@ for f in ../test-data/phony-guests/{debian,fedora,ubuntu,windows}.img; do
     # Ignore zero-sized windows.img if ntfs-3g is not installed.
     if [ -s "$f" ]; then
 	echo "Running virt-sysprep on $f ..."
-	$VG virt-sysprep -q -n --enable "$operations" -a $f
+	$VG virt-sysprep -q -n --enable "$operations" --format raw -a $f
 	echo
     fi
 done
diff --git a/test-data/phony-guests/make-fedora-img.pl b/test-data/phony-guests/make-fedora-img.pl
index 192f48f..5a6adab 100755
--- a/test-data/phony-guests/make-fedora-img.pl
+++ b/test-data/phony-guests/make-fedora-img.pl
@@ -62,7 +62,7 @@ EOF
 
   $g->disk_create ("fedora.img-t", "raw", $IMAGE_SIZE);
 
-  $g->add_drive ("fedora.img-t");
+  $g->add_drive ("fedora.img-t", format => "raw");
   $g->launch ();
 
   $g->part_init ('/dev/sda', 'mbr');
@@ -87,7 +87,7 @@ EOF
 
   foreach my $img (@images) {
       $g->disk_create ($img, "raw", $IMAGE_SIZE);
-      $g->add_drive ($img);
+      $g->add_drive ($img, format => "raw");
   }
 
   $g->launch ();
@@ -137,7 +137,7 @@ EOF
 
   $g->disk_create ("fedora-btrfs.img-t", "raw", $IMAGE_SIZE);
 
-  $g->add_drive ("fedora-btrfs.img-t");
+  $g->add_drive ("fedora-btrfs.img-t", format => "raw");
   $g->launch ();
 
   $g->part_init ('/dev/sda', 'mbr');
diff --git a/tests/gdisk/test-expand-gpt.pl b/tests/gdisk/test-expand-gpt.pl
index 637b90e..4d647f1 100755
--- a/tests/gdisk/test-expand-gpt.pl
+++ b/tests/gdisk/test-expand-gpt.pl
@@ -25,7 +25,7 @@ sub tests {
 
 	foreach ("gpt", "mbr") {
 		$g->disk_create ("disk_$_.img", "qcow2", 50 * 1024 * 1024);
-		$g->add_drive ("disk_$_.img");
+		$g->add_drive ("disk_$_.img", format => "qcow2");
 	}
 
 	$g->launch ();
@@ -40,7 +40,7 @@ sub tests {
 	$g = Sys::Guestfs->new ();
 
 	foreach ("gpt", "mbr") {
-		$g->add_drive ("disk_$_.img");
+		$g->add_drive ("disk_$_.img", format => "qcow2");
 	}
 
 	$g->launch ();
diff --git a/tests/md/test-inspect-fstab-md.sh b/tests/md/test-inspect-fstab-md.sh
index 6c1842f..3c25dac 100755
--- a/tests/md/test-inspect-fstab-md.sh
+++ b/tests/md/test-inspect-fstab-md.sh
@@ -32,7 +32,7 @@ rm -f inspect-fstab-md-{1,2}.img inspect-fstab-md.fstab inspect-fstab-md.output
 cp ../../test-data/phony-guests/fedora-md1.img inspect-fstab-md-1.img
 cp ../../test-data/phony-guests/fedora-md2.img inspect-fstab-md-2.img
 
-guestfish -i inspect-fstab-md-[12].img <<'EOF' | sort > inspect-fstab-md.output
+guestfish -i --format=raw -a inspect-fstab-md-1.img --format=raw -a inspect-fstab-md-2.img <<'EOF' | sort > inspect-fstab-md.output
   exists /boot/grub/grub.conf
 EOF
 
@@ -47,13 +47,13 @@ cat <<'EOF' > inspect-fstab-md.fstab
 /dev/md/boot /boot ext2 default 0 0
 EOF
 
-guestfish -a inspect-fstab-md-1.img -a inspect-fstab-md-2.img <<'EOF'
+guestfish --format=raw -a inspect-fstab-md-1.img --format=raw -a inspect-fstab-md-2.img <<'EOF'
   run
   mount /dev/VG/Root /
   upload inspect-fstab-md.fstab /etc/fstab
 EOF
 
-guestfish -i inspect-fstab-md-[12].img <<'EOF' | sort > inspect-fstab-md.output
+guestfish -i --format=raw -a inspect-fstab-md-1.img --format=raw -a inspect-fstab-md-2.img <<'EOF' | sort > inspect-fstab-md.output
   exists /boot/grub/grub.conf
 EOF
 
diff --git a/tests/md/test-inspect-fstab.sh b/tests/md/test-inspect-fstab.sh
index 007ea08..0739193 100755
--- a/tests/md/test-inspect-fstab.sh
+++ b/tests/md/test-inspect-fstab.sh
@@ -55,14 +55,14 @@ cat <<'EOF' > inspect-fstab.fstab
 /dev/disk/by-id/ata-QEMU_HARDDISK_QM00001-part3 /id3 ext2 default 0 0
 EOF
 
-guestfish -a inspect-fstab-1.qcow2 <<'EOF'
+guestfish --format=qcow2 -a inspect-fstab-1.qcow2 <<'EOF'
   run
   mount /dev/VG/Root /
   upload inspect-fstab.fstab /etc/fstab
 EOF
 
 # This will give a warning, but should not fail.
-guestfish -a inspect-fstab-1.qcow2 -i <<'EOF' | sort | $canonical > inspect-fstab.output
+guestfish --format=qcow2 -a inspect-fstab-1.qcow2 -i <<'EOF' | sort | $canonical > inspect-fstab.output
   inspect-get-mountpoints /dev/VG/Root
 EOF
 
@@ -87,7 +87,7 @@ cat <<'EOF' > inspect-fstab.fstab
 /dev/xvdg1 /boot ext2 default 0 0
 EOF
 
-guestfish -a inspect-fstab-1.qcow2 <<'EOF'
+guestfish --format=qcow2 -a inspect-fstab-1.qcow2 <<'EOF'
   run
   mount /dev/VG/Root /
   upload inspect-fstab.fstab /etc/fstab
@@ -118,7 +118,7 @@ cat <<'EOF' > inspect-fstab.fstab
 /dev/cciss/c1d3 /var ext2 default 0 0
 EOF
 
-guestfish -a inspect-fstab-1.qcow2 <<'EOF'
+guestfish --format=qcow2 -a inspect-fstab-1.qcow2 <<'EOF'
   run
   mount /dev/VG/Root /
   upload inspect-fstab.fstab /etc/fstab
diff --git a/tests/md/test-list-md-devices.sh b/tests/md/test-list-md-devices.sh
index 5a9cbe8..3019f33 100755
--- a/tests/md/test-list-md-devices.sh
+++ b/tests/md/test-list-md-devices.sh
@@ -49,7 +49,7 @@ fi
 
 # Ensure list-md-devices now returns the newly created md device
 output=$(
-guestfish -a list-md-devices-1.img -a list-md-devices-2.img <<EOF
+guestfish --format=raw -a list-md-devices-1.img --format=raw -a list-md-devices-2.img <<EOF
 run
 list-md-devices
 EOF
diff --git a/tests/mountable/test-mountable-inspect.sh b/tests/mountable/test-mountable-inspect.sh
index ebef0c6..fcc184d 100755
--- a/tests/mountable/test-mountable-inspect.sh
+++ b/tests/mountable/test-mountable-inspect.sh
@@ -48,7 +48,7 @@ guestfish -- \
 
 # Test that basic inspection works and the expected filesystems are
 # found
-guestfish -a test.qcow2 -i <<'EOF' | sort | $canonical > test.output
+guestfish --format=qcow2 -a test.qcow2 -i <<'EOF' | sort | $canonical > test.output
   inspect-get-roots | head -1 > root.tmp
   <! echo inspect-get-mountpoints "`cat root.tmp`"
 EOF
@@ -62,7 +62,7 @@ if [ "$(cat test.output)" != "/: btrfsvol:/dev/sda2/root
 fi
 
 # Additional sanity check: did we get the release name right?
-guestfish -a test.qcow2 -i <<'EOF' > test.output
+guestfish --format=qcow2 -a test.qcow2 -i <<'EOF' > test.output
   inspect-get-roots | head -1 > root.tmp
   <! echo inspect-get-product-name "`cat root.tmp`"
 EOF
diff --git a/tests/ntfs/test-ntfscat.sh b/tests/ntfs/test-ntfscat.sh
index 5cfdd95..50f4dca 100755
--- a/tests/ntfs/test-ntfscat.sh
+++ b/tests/ntfs/test-ntfscat.sh
@@ -39,7 +39,7 @@ if [ ! -s ../../test-data/phony-guests/windows.img ]; then
 fi
 
 # download Master File Table ($MFT).
-guestfish --ro -a ../../test-data/phony-guests/windows.img <<EOF
+guestfish --ro --format=raw -a ../../test-data/phony-guests/windows.img <<EOF
 run
 ntfscat-i /dev/sda2 0 test-mft.bin
 EOF
diff --git a/tests/ntfs/test-ntfsclone.sh b/tests/ntfs/test-ntfsclone.sh
index 668ed8a..b403670 100755
--- a/tests/ntfs/test-ntfsclone.sh
+++ b/tests/ntfs/test-ntfsclone.sh
@@ -39,7 +39,7 @@ if [ ! -s ../../test-data/phony-guests/windows.img ]; then
 fi
 
 # Export the filesystems to the backup file.
-guestfish --ro -a ../../test-data/phony-guests/windows.img <<EOF
+guestfish --ro --format=raw -a ../../test-data/phony-guests/windows.img <<EOF
 run
 ntfsclone-out /dev/sda1 ntfsclone-backup1 preservetimestamps:true force:true
 ntfsclone-out /dev/sda2 ntfsclone-backup2 metadataonly:true ignorefscheck:true
diff --git a/tests/regressions/rhbz1011907-1165785.sh b/tests/regressions/rhbz1011907-1165785.sh
index f45ae3c..ac3b49d 100755
--- a/tests/regressions/rhbz1011907-1165785.sh
+++ b/tests/regressions/rhbz1011907-1165785.sh
@@ -35,7 +35,7 @@ rm -f rhbz1011907-1165785-loop.img rhbz1011907-1165785.img
 qemu-img create rhbz1011907-1165785-loop.img 100M
 qemu-img create rhbz1011907-1165785.img 300M
 
-guestfish -a rhbz1011907-1165785-loop.img <<EOF
+guestfish --format=raw -a rhbz1011907-1165785-loop.img <<EOF
 run
 part-disk /dev/sda mbr
 mkfs ext3 /dev/sda
@@ -44,7 +44,7 @@ touch /in-loop
 EOF
 
 output=$(
-guestfish -a rhbz1011907-1165785.img <<EOF
+guestfish --format=raw -a rhbz1011907-1165785.img <<EOF
 run
 part-disk /dev/sda mbr
 mkfs ext3 /dev/sda1
diff --git a/tests/regressions/rhbz1054761.sh b/tests/regressions/rhbz1054761.sh
index 344479d..1b414f2 100755
--- a/tests/regressions/rhbz1054761.sh
+++ b/tests/regressions/rhbz1054761.sh
@@ -37,7 +37,7 @@ vgcreate VG "/dev/sda /dev/sdb"
 EOF
 
 output="$(
-    guestfish -a rhbz1054761-a.img run : pvs |
+    guestfish --format=raw -a rhbz1054761-a.img run : pvs |
         sed -r 's,^/dev/[abce-ln-z]+d,/dev/sd,'
 )"
 if [ "$output" != "/dev/sda" ]; then
diff --git a/tests/regressions/rhbz1174551.sh b/tests/regressions/rhbz1174551.sh
index a0bbb5e..4594657 100755
--- a/tests/regressions/rhbz1174551.sh
+++ b/tests/regressions/rhbz1174551.sh
@@ -36,7 +36,7 @@ fi
 
 rm -f test.error
 
-$VG guestfish --ro -a ../../test-data/phony-guests/fedora.img -i <<EOF 2>test.error
+$VG guestfish --ro --format=raw -a ../../test-data/phony-guests/fedora.img -i <<EOF 2>test.error
 # valid invocations
 lstatlist /etc "fedora-release sysconfig"
 lstatnslist /etc "fedora-release sysconfig"
diff --git a/tests/regressions/rhbz1285847.sh b/tests/regressions/rhbz1285847.sh
index f34fe54..0aa0611 100755
--- a/tests/regressions/rhbz1285847.sh
+++ b/tests/regressions/rhbz1285847.sh
@@ -59,7 +59,7 @@ truncate -s 10G rhbz1285847-2.img
 virt-resize rhbz1285847.img rhbz1285847-2.img --expand /dev/sda2
 
 # Check that the filesystems made it across.
-guestfish -a rhbz1285847-2.img run : list-filesystems > rhbz1285847.out
+guestfish --format=raw -a rhbz1285847-2.img run : list-filesystems > rhbz1285847.out
 
 if [ "$(cat rhbz1285847.out)" != "/dev/sda1: ext4
 /dev/sda2: unknown
diff --git a/tests/regressions/rhbz563450.sh b/tests/regressions/rhbz563450.sh
index 5215676..3c53da6 100755
--- a/tests/regressions/rhbz563450.sh
+++ b/tests/regressions/rhbz563450.sh
@@ -30,9 +30,9 @@ fi
 rm -f rhbz563450.out
 
 guestfish --ro > rhbz563450.out <<EOF
-add-drive-ro ../../test-data/phony-guests/fedora.img
+add ../../test-data/phony-guests/fedora.img readonly:true format:raw
 add-cdrom ../../test-data/test.iso
-add-drive-ro ../../test-data/phony-guests/debian.img
+add ../../test-data/phony-guests/debian.img readonly:true format:raw
 
 run
 
diff --git a/tests/regressions/rhbz580246.sh b/tests/regressions/rhbz580246.sh
index 218dd96..8b842e5 100755
--- a/tests/regressions/rhbz580246.sh
+++ b/tests/regressions/rhbz580246.sh
@@ -30,7 +30,7 @@ tar cf rhbz580246.tar rhbz580246.img
 
 output=$(
 guestfish 2>&1 <<'EOF'
-add rhbz580246.img
+add rhbz580246.img format:raw
 run
 mkfs ext2 /dev/sda
 mount /dev/sda /
diff --git a/tests/regressions/rhbz690819.sh b/tests/regressions/rhbz690819.sh
index 0af0b64..9c8d39e 100755
--- a/tests/regressions/rhbz690819.sh
+++ b/tests/regressions/rhbz690819.sh
@@ -54,7 +54,7 @@ rm -f rhbz690819.img
 guestfish sparse rhbz690819.img 100M
 
 guestfish <<EOF
-add-drive-with-if rhbz690819.img ide
+add rhbz690819.img iface:ide format:raw
 run
 mkfs ext3 /dev/sda
 mount /dev/sda /
diff --git a/tests/regressions/rhbz789960.sh b/tests/regressions/rhbz789960.sh
index 57c04c3..0f9e4eb 100755
--- a/tests/regressions/rhbz789960.sh
+++ b/tests/regressions/rhbz789960.sh
@@ -24,7 +24,7 @@ export LANG=C
 
 rm -f rhbz789960.out
 
-guestfish -a ../../test-data/phony-guests/fedora.img --ro > rhbz789960.out <<EOF
+guestfish --format=raw -a ../../test-data/phony-guests/fedora.img --ro > rhbz789960.out <<EOF
 run
 
 # Not a device at all, should fail.
diff --git a/tests/regressions/rhbz811649.sh b/tests/regressions/rhbz811649.sh
index d48d2bf..53064c0 100755
--- a/tests/regressions/rhbz811649.sh
+++ b/tests/regressions/rhbz811649.sh
@@ -41,7 +41,7 @@ guestfish sparse rhbz811649.img 10M
 for f in "${filenames[@]}"; do
     ln -- rhbz811649.img "$f"
     guestfish <<EOF
-add "$f"
+add "$f" format:raw
 run
 EOF
 done
diff --git a/tests/regressions/rhbz975797.sh b/tests/regressions/rhbz975797.sh
index 3c536a9..c067a12 100755
--- a/tests/regressions/rhbz975797.sh
+++ b/tests/regressions/rhbz975797.sh
@@ -60,9 +60,9 @@ guestfish sparse rhbz975797-2.img 1G
 guestfish sparse rhbz975797-3.img 1G
 
 $timeout guestfish <<EOF
-add-drive rhbz975797-1.img iface:virtio
-add-drive rhbz975797-2.img iface:ide
-add-drive rhbz975797-3.img
+add-drive rhbz975797-1.img iface:virtio format:raw
+add-drive rhbz975797-2.img iface:ide format:raw
+add-drive rhbz975797-3.img format:raw
 run
 EOF
 
diff --git a/tests/tsk/test-download-inode.sh b/tests/tsk/test-download-inode.sh
index 9c65aa9..f57e424 100755
--- a/tests/tsk/test-download-inode.sh
+++ b/tests/tsk/test-download-inode.sh
@@ -39,7 +39,7 @@ if [ ! -s ../../test-data/phony-guests/windows.img ]; then
 fi
 
 # download Master File Table ($MFT).
-guestfish --ro -a ../../test-data/phony-guests/windows.img <<EOF
+guestfish --ro --format=raw -a ../../test-data/phony-guests/windows.img <<EOF
 run
 download-inode /dev/sda2 0 test-mft.bin
 EOF
diff --git a/tools/test-virt-list-filesystems.sh b/tools/test-virt-list-filesystems.sh
index 9ed5dd2..80085b3 100755
--- a/tools/test-virt-list-filesystems.sh
+++ b/tools/test-virt-list-filesystems.sh
@@ -21,7 +21,7 @@ set -e
 
 # Run virt-list-filesystems.
 # Only columns 1 & 2 are guaranteed, we may add more in future.
-if [ "$($srcdir/virt-list-filesystems -l ../test-data/phony-guests/fedora.img |
+if [ "$($srcdir/virt-list-filesystems --format=raw -l ../test-data/phony-guests/fedora.img |
         sort | awk '{print $1 $2}')" \
     != \
 "/dev/VG/LV1ext2
-- 
2.5.5




More information about the Libguestfs mailing list