mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
tests: specify the image format when possible
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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}')
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 /
|
||||
|
||||
@@ -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 /
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user