tests: Don't use relative paths to binaries in tests.

All tests run under the ./run binary.  For a long time the ./run
binary has set the $PATH environment variable to contain all of the
directories with binaries in them.

Therefore there is no reason to use ../fish/guestfish instead of just
plain guestfish (and the same applies to other built binaries).
This commit is contained in:
Richard W.M. Jones
2014-09-15 15:17:47 +01:00
parent bced8f5289
commit e85a976c5a
119 changed files with 323 additions and 346 deletions

View File

@@ -26,7 +26,7 @@ fi
guestsdir="$(cd ../tests/guests && pwd)"
libvirt_uri="test://$guestsdir/guests-all-good.xml"
$VG ./virt-alignment-scan -c "$libvirt_uri"
$VG virt-alignment-scan -c "$libvirt_uri"
r=$?
# 0, 2 and 3 are reasonable non-error exit codes. Others are errors.

View File

@@ -18,7 +18,7 @@
export LANG=C
$VG ./virt-alignment-scan -a ../tests/guests/fedora.img
$VG virt-alignment-scan -a ../tests/guests/fedora.img
r=$?
# 0, 2 and 3 are reasonable non-error exit codes. Others are errors.

View File

@@ -26,7 +26,7 @@ abs_builddir=$(pwd)
export XDG_CONFIG_HOME=
export XDG_CONFIG_DIRS="$abs_builddir/test-config"
short_list=$($VG ./virt-builder --no-check-signature --no-cache --list)
short_list=$($VG virt-builder --no-check-signature --no-cache --list)
if [ "$short_list" != "phony-debian x86_64 Phony Debian
phony-fedora x86_64 Phony Fedora
@@ -40,7 +40,7 @@ phony-windows x86_64 Phony Windows" ]; then
exit 1
fi
long_list=$(./virt-builder --no-check-signature --no-cache --list --long)
long_list=$(virt-builder --no-check-signature --no-cache --list --long)
if [ "$long_list" != "Source URI: file://$abs_builddir/test-index
@@ -111,7 +111,7 @@ Phony Windows look-alike used for testing." ]; then
exit 1
fi
json_list=$(./virt-builder --no-check-signature --no-cache --list --list-format json)
json_list=$(virt-builder --no-check-signature --no-cache --list --list-format json)
if [ "$json_list" != "{
\"version\": 1,

View File

@@ -29,7 +29,7 @@ if [ ! -f fedora.xz -o ! -f fedora.qcow2 -o ! -f fedora.qcow2.xz ]; then
exit 77
fi
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because backend is UML"
exit 77
fi
@@ -43,8 +43,8 @@ for input in phony-fedora phony-fedora-qcow2 phony-fedora-qcow2-uncompressed pho
if [ "$size" != "none" ]; then args="$args --size $size"; fi
if [ "$format" != "none" ]; then args="$args --format $format"; fi
echo $VG ./virt-builder $input $args
$VG ./virt-builder $input $args
echo $VG virt-builder $input $args
$VG virt-builder $input $args
done
done
done

View File

@@ -37,7 +37,7 @@ fi
output=phony-fedora.img
format=qcow2
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
format=raw
# XXX We specifically want virt-builder to work with the UML
@@ -55,7 +55,7 @@ rm -f $output
# Note we cannot test --install, --run since the phony Fedora doesn't
# have a real OS inside just some configuration files. Just about
# every other option is fair game.
$VG ./virt-builder phony-fedora \
$VG virt-builder phony-fedora \
-v --no-cache --no-check-signature $no_network \
-o $output --size 2G --format $format \
--arch x86_64 \
@@ -74,7 +74,7 @@ $VG ./virt-builder phony-fedora \
--firstboot-install "minicom,inkscape"
# Check that some modifications were made.
$VG ../fish/guestfish --ro -i -a $output > test.out <<EOF
$VG guestfish --ro -i -a $output > test.out <<EOF
# Uploaded files
is-file /etc/foo/bar/baz/Makefile
cat /etc/foo/bar/baz/foo

View File

@@ -19,6 +19,6 @@
export LANG=C
set -e
! $VG ./virt-index-validate test-virt-index-validate-bad-1
$VG ./virt-index-validate test-virt-index-validate-good-1
$VG ./virt-index-validate test-virt-index-validate-good-2
! $VG virt-index-validate test-virt-index-validate-bad-1
$VG virt-index-validate test-virt-index-validate-good-1
$VG virt-index-validate test-virt-index-validate-good-2

View File

@@ -27,14 +27,14 @@
export LANG=C
set -e
if [ ! -x builder/virt-builder ]; then
if ! virt-builder --help >/dev/null 2>&1 || [ ! -f builder/virt-builder.pod ]; then
echo "$0: running the test from the wrong directory, or libguestfs has not been built"
exit 1
fi
if [ $# -lt 1 ]; then
echo "$0: missing os-version"
echo "try: ./run builder/virt-builder -l"
echo "try: ./run virt-builder -l"
exit 1
fi
@@ -42,7 +42,7 @@ osversion="$1"
shift
output="$osversion.img"
builder/virt-builder "$osversion" \
virt-builder "$osversion" \
--no-cache -v \
--size 10G \
--root-password password:123456 \

View File

@@ -24,8 +24,8 @@ fn=test-filename-for-index-validate
rm -f $fn
touch $fn
$VG ../virt-index-validate $srcdir/index
$VG ../virt-index-validate $srcdir/index.asc
$VG ../virt-index-validate $fn
$VG virt-index-validate $srcdir/index
$VG virt-index-validate $srcdir/index.asc
$VG virt-index-validate $fn
rm $fn

View File

@@ -20,11 +20,11 @@ export LANG=C
set -e
# Read out the test files from the image using virt-cat.
if [ "$($VG ./virt-cat ../tests/guests/fedora.img /etc/test1)" != "abcdefg" ]; then
if [ "$($VG virt-cat ../tests/guests/fedora.img /etc/test1)" != "abcdefg" ]; then
echo "$0: error: mismatch in file test1"
exit 1
fi
if [ "$($VG ./virt-cat ../tests/guests/fedora.img /etc/test2)" != "" ]; then
if [ "$($VG virt-cat ../tests/guests/fedora.img /etc/test2)" != "" ]; then
echo "$0: error: mismatch in file test2"
exit 1
fi

View File

@@ -19,7 +19,7 @@
export LANG=C
set -e
output="$($VG ./virt-filesystems -a ../tests/guests/fedora.img | sort)"
output="$($VG virt-filesystems -a ../tests/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 ../tests/guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)"
output="$($VG virt-filesystems -a ../tests/guests/fedora.img --all --long --uuid -h --no-title | awk '{print $1}' | sort -u)"
expected="/dev/VG
/dev/VG/LV1
/dev/VG/LV2

View File

@@ -21,5 +21,5 @@ set -e
# Read out the log files from the image using virt-log.
for f in ../tests/guests/{fedora,debian,ubuntu}.img; do
if [ -s "$f" ]; then $VG ./virt-log -a "$f"; fi
if [ -s "$f" ]; then $VG virt-log -a "$f"; fi
done

View File

@@ -20,7 +20,7 @@ export LANG=C
set -e
# Read out the test directory using virt-ls.
if [ "$($VG ./virt-ls ../tests/guests/fedora.img /bin)" != "ls
if [ "$($VG virt-ls ../tests/guests/fedora.img /bin)" != "ls
test1
test2
test3
@@ -33,7 +33,7 @@ test7" ]; then
fi
# Try the -lR option.
output="$($VG ./virt-ls -lR ../tests/guests/fedora.img /boot | awk '{print $1 $2 $4}')"
output="$($VG virt-ls -lR ../tests/guests/fedora.img /boot | awk '{print $1 $2 $4}')"
expected="d0755/boot
d0755/boot/grub
-0644/boot/grub/grub.conf
@@ -49,5 +49,5 @@ if [ "$output" != "$expected" ]; then
fi
# Try the -l and -R options. XXX Should check the output.
$VG ./virt-ls -l ../tests/guests/fedora.img /
$VG ./virt-ls -R ../tests/guests/fedora.img /
$VG virt-ls -l ../tests/guests/fedora.img /
$VG virt-ls -R ../tests/guests/fedora.img /

View File

@@ -26,7 +26,7 @@ for f in ../tests/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 -a $f \
--no-network \
--write /etc/motd:HELLO \
--chmod 0600:/etc/motd \

View File

@@ -29,4 +29,4 @@ fi
guestsdir="$(cd ../tests/guests && pwd)"
libvirt_uri="test://$guestsdir/guests.xml"
$VG ./virt-df -c "$libvirt_uri"
$VG virt-df -c "$libvirt_uri"

View File

@@ -20,7 +20,7 @@ export LANG=C
set -e
# Run virt-df.
output=$($VG ./virt-df ../tests/guests/fedora.img)
output=$($VG virt-df ../tests/guests/fedora.img)
# Check title is the first line.
if [[ ! $output =~ ^Filesystem.* ]]; then

View File

@@ -24,7 +24,7 @@ if [ ! -f ../tests/guests/fedora.img ]; then
exit 77
fi
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because backend is UML"
exit 77
fi
@@ -32,16 +32,16 @@ fi
rm -f fedora.qcow2
# Modify a copy of the image.
../fish/guestfish -- \
guestfish -- \
disk-create fedora.qcow2 qcow2 -1 \
backingfile:../tests/guests/fedora.img backingformat:raw
../fish/guestfish -a fedora.qcow2 -i <<EOF
guestfish -a fedora.qcow2 -i <<EOF
touch /diff
write-append /etc/motd "Testing virt-diff\n"
EOF
output="$($VG ./virt-diff -a ../tests/guests/fedora.img -A fedora.qcow2)"
output="$($VG virt-diff -a ../tests/guests/fedora.img -A fedora.qcow2)"
expected="\
+ - 0644 0 /diff

View File

@@ -19,7 +19,7 @@
export LANG=C
set -e
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: skipping test because uml backend does not support qcow2"
exit 77
fi
@@ -28,15 +28,15 @@ rm -f test.qcow2
# Make a copy of the Fedora image so we can write to it then
# discard it.
../fish/guestfish -- \
guestfish -- \
disk-create test.qcow2 qcow2 -1 \
backingfile:../tests/guests/fedora.img backingformat:raw
# 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
if [ "$(../cat/virt-cat -a test.qcow2 /etc/test3)" != "a
virt-edit -a test.qcow2 /etc/test3
if [ "$(virt-cat -a test.qcow2 /etc/test3)" != "a
b
c
d
@@ -50,8 +50,8 @@ 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/'
if [ "$(../cat/virt-cat -a test.qcow2 /etc/test3)" != "1
virt-edit -a test.qcow2 /etc/test3 -e 's/^[a-f]/$lineno/'
if [ "$(virt-cat -a test.qcow2 /etc/test3)" != "1
2
3
4
@@ -65,7 +65,7 @@ fi
# Verify the mode of /etc/test3 is still 0600 and the UID:GID is 10:11.
# See tests/guests/guest-aux/make-fedora-img.pl and RHBZ#788641.
if [ "$(../fish/guestfish -i -a test.qcow2 --ro lstat /etc/test3 | grep -E '^(mode|uid|gid):' | sort)" != "gid: 11
if [ "$(guestfish -i -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"

View File

@@ -23,28 +23,28 @@ set -e
rm -f test-a.out
rm -f test-a.img
$VG ./guestfish sparse test-a.img 100M
$VG guestfish sparse test-a.img 100M
$VG ./guestfish -x -a test-a.img </dev/null >test-a.out 2>&1
$VG guestfish -x -a test-a.img </dev/null >test-a.out 2>&1
! grep -sq 'add_drive.*format' test-a.out
rm test-a.img
$VG ./guestfish disk-create test-a.img qcow2 100M
$VG guestfish disk-create test-a.img qcow2 100M
$VG ./guestfish -x --format=qcow2 -a test-a.img </dev/null >test-a.out 2>&1
$VG guestfish -x --format=qcow2 -a test-a.img </dev/null >test-a.out 2>&1
grep -sq 'add_drive.*format:qcow2' test-a.out
$VG ./guestfish -x --ro --format=qcow2 -a test-a.img </dev/null >test-a.out 2>&1
$VG guestfish -x --ro --format=qcow2 -a test-a.img </dev/null >test-a.out 2>&1
grep -sq 'add_drive.*readonly:true.*format:qcow2' test-a.out
$VG ./guestfish -x --format -a test-a.img </dev/null >test-a.out 2>&1
$VG guestfish -x --format -a test-a.img </dev/null >test-a.out 2>&1
! grep -sq 'add_drive.*format' test-a.out
$VG ./guestfish -x -a test-a.img --format=raw -a /dev/null </dev/null >test-a.out 2>&1
$VG guestfish -x -a test-a.img --format=raw -a /dev/null </dev/null >test-a.out 2>&1
! grep -sq 'add_drive.*test-a.img.*format' test-a.out

View File

@@ -25,10 +25,10 @@ rm -f test-add-domain.xml test-add-domain.out
cwd="$(pwd)"
$VG ./guestfish sparse test-add-domain-1.img 1M
$VG ./guestfish sparse test-add-domain-2.img 1M
$VG ./guestfish disk-create test-add-domain-3.img qcow2 1M
$VG ./guestfish sparse test-add-domain-4.img 1M
$VG guestfish sparse test-add-domain-1.img 1M
$VG guestfish sparse test-add-domain-2.img 1M
$VG guestfish disk-create test-add-domain-3.img qcow2 1M
$VG guestfish sparse test-add-domain-4.img 1M
# Libvirt test XML, see libvirt.git/examples/xml/test/testnode.xml
cat > test-add-domain.xml <<EOF
@@ -66,7 +66,7 @@ cat > test-add-domain.xml <<EOF
</node>
EOF
$VG ./guestfish >test-add-domain.out <<EOF
$VG guestfish >test-add-domain.out <<EOF
domain guest libvirturi:test://$cwd/test-add-domain.xml readonly:true
debug-drives
EOF
@@ -76,7 +76,7 @@ grep -sq "test-add-domain-2.img readonly format=raw" test-add-domain.out
grep -sq "test-add-domain-3.img readonly format=qcow2" test-add-domain.out
# Test readonlydisk = "ignore".
$VG ./guestfish >test-add-domain.out <<EOF
$VG guestfish >test-add-domain.out <<EOF
-domain guest libvirturi:test://$cwd/test-add-domain.xml readonly:true readonlydisk:ignore
debug-drives
EOF
@@ -88,7 +88,7 @@ grep -sq "test-add-domain-3.img" test-add-domain.out
# Test atomicity.
rm test-add-domain-3.img
$VG ./guestfish >test-add-domain.out <<EOF
$VG guestfish >test-add-domain.out <<EOF
-domain guest libvirturi:test://$cwd/test-add-domain.xml readonly:true
debug-drives
EOF

View File

@@ -24,7 +24,7 @@ set -x
rm -f test-add-uri.out
rm -f test-add-uri.img
$VG ./guestfish sparse test-add-uri.img 10M
$VG guestfish sparse test-add-uri.img 10M
function fail ()
{
@@ -34,51 +34,51 @@ function fail ()
}
# file:// URI should be handled exactly like a regular file.
$VG ./guestfish -x -a file://$(pwd)/test-add-uri.img </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a file://$(pwd)/test-add-uri.img </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive ".*/test-add-uri.img"' test-add-uri.out || fail
# curl
$VG ./guestfish -x -a ftp://user@example.com/disk.img </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a ftp://user@example.com/disk.img </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "/disk.img" "protocol:ftp" "server:tcp:example.com" "username:user"' test-add-uri.out || fail
# gluster
$VG ./guestfish -x -a gluster://example.com/disk </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a gluster://example.com/disk </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "disk" "protocol:gluster" "server:tcp:example.com"' test-add-uri.out || fail
# NBD
$VG ./guestfish -x -a nbd://example.com </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a nbd://example.com </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "" "protocol:nbd" "server:tcp:example.com"' test-add-uri.out || fail
$VG ./guestfish -x -a nbd://example.com:3000 </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a nbd://example.com:3000 </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "" "protocol:nbd" "server:tcp:example.com:3000"' test-add-uri.out || fail
$VG ./guestfish -x -a 'nbd://?socket=/sk' </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a 'nbd://?socket=/sk' </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "" "protocol:nbd" "server:unix:/sk"' test-add-uri.out || fail
$VG ./guestfish -x -a 'nbd:///export?socket=/sk' </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a 'nbd:///export?socket=/sk' </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "/export" "protocol:nbd" "server:unix:/sk"' test-add-uri.out || fail
# rbd
$VG ./guestfish -x -a rbd://example.com:6789/pool/disk </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a rbd://example.com:6789/pool/disk </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "pool/disk" "protocol:rbd" "server:tcp:example.com:6789"' test-add-uri.out || fail
$VG ./guestfish -x -a rbd:///pool/disk </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a rbd:///pool/disk </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "pool/disk" "protocol:rbd"' test-add-uri.out || fail
# sheepdog
$VG ./guestfish -x -a sheepdog:///volume/image </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a sheepdog:///volume/image </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "volume/image" "protocol:sheepdog"' test-add-uri.out || fail
$VG ./guestfish -x -a sheepdog://example.com:3000/volume/image </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a sheepdog://example.com:3000/volume/image </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "volume/image" "protocol:sheepdog" "server:tcp:example.com:3000"' test-add-uri.out || fail
# ssh
$VG ./guestfish -x -a ssh://example.com/disk.img </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a ssh://example.com/disk.img </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "/disk.img" "protocol:ssh" "server:tcp:example.com"' test-add-uri.out || fail
$VG ./guestfish -x -a ssh://user@example.com/disk.img </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a ssh://user@example.com/disk.img </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "/disk.img" "protocol:ssh" "server:tcp:example.com" "username:user"' test-add-uri.out || fail
$VG ./guestfish -x -a ssh://user@example.com:2000/disk.img </dev/null >test-add-uri.out 2>&1
$VG guestfish -x -a ssh://user@example.com:2000/disk.img </dev/null >test-add-uri.out 2>&1
grep -sq 'add_drive "/disk.img" "protocol:ssh" "server:tcp:example.com:2000" "username:user"' test-add-uri.out || fail
rm test-add-uri.out

View File

@@ -22,7 +22,7 @@ set -e
rm -f test-alloc.img
$VG ./guestfish alloc test-alloc.img 200000
$VG guestfish alloc test-alloc.img 200000
if [ "$(stat -c '%s' test-alloc.img)" -ne 200000 ]; then
echo "$0: alloc command failed to create file of the correct size"
exit 1
@@ -33,7 +33,7 @@ if [ "$(stat -c '%b' test-alloc.img)" -eq 0 ]; then
exit 1
fi
$VG ./guestfish sparse test-alloc.img 100000
$VG guestfish sparse test-alloc.img 100000
if [ "$(stat -c '%s' test-alloc.img)" -ne 100000 ]; then
echo "$0: sparse command failed to create file of the correct size"
exit 1

View File

@@ -36,7 +36,7 @@ cp $srcdir/../tests/data/known* test-copy-original
cp -P ../tests/data/abssymlink* test-copy-original
output=$(
$VG ./guestfish -N test-copy.img=fs -m /dev/sda1 <<EOF
$VG guestfish -N test-copy.img=fs -m /dev/sda1 <<EOF
mkdir /data
# This creates a directory /data/data/
copy-in test-copy-original /data
@@ -63,7 +63,7 @@ fi
mkdir test-copy-copy
$VG ./guestfish --ro -a test-copy.img -m /dev/sda1 <<EOF
$VG guestfish --ro -a test-copy.img -m /dev/sda1 <<EOF
copy-out /data/test-copy-original test-copy-copy
EOF

View File

@@ -25,10 +25,10 @@ rm -f test-d.xml test-d.out
cwd="$(pwd)"
$VG ./guestfish sparse test-d-1.img 1M
$VG ./guestfish sparse test-d-2.img 1M
$VG ./guestfish disk-create test-d-3.img qcow2 1M
$VG ./guestfish sparse test-d-4.img 1M
$VG guestfish sparse test-d-1.img 1M
$VG guestfish sparse test-d-2.img 1M
$VG guestfish disk-create test-d-3.img qcow2 1M
$VG guestfish sparse test-d-4.img 1M
# Libvirt test XML, see libvirt.git/examples/xml/test/testnode.xml
cat > test-d.xml <<EOF
@@ -66,7 +66,7 @@ cat > test-d.xml <<EOF
</node>
EOF
$VG ./guestfish -c "test://$cwd/test-d.xml" --ro -d guest \
$VG guestfish -c "test://$cwd/test-d.xml" --ro -d guest \
debug-drives </dev/null >test-d.out
grep -sq "test-d-1.img readonly" test-d.out
! grep -sq "test-d-1.img.*format" test-d.out

View File

@@ -34,7 +34,7 @@ rm -f test-edit.img
export EDITOR="echo second line of text >>"
output=$(
$VG ./guestfish -N test-edit.img=fs -m /dev/sda1 <<EOF
$VG guestfish -N test-edit.img=fs -m /dev/sda1 <<EOF
write /file.txt "this is a test\n"
chmod 0600 /file.txt
chown 10 11 /file.txt

View File

@@ -22,7 +22,7 @@ set -e
rm -f test.output test.error test.error.old
$VG ./guestfish <<'EOF' 2>test.error | od -b > test.output
$VG guestfish <<'EOF' 2>test.error | od -b > test.output
echo ""
echo " "
echo " "

View File

@@ -22,7 +22,7 @@ set -e
rm -f test.out
$VG ./guestfish -a /dev/null <<'EOF' | grep -v get_verbose | grep -v get_trace | grep -v 'library .*0x' | grep -v 'library command' | grep -v 'get_path' > test.out
$VG guestfish -a /dev/null <<'EOF' | grep -v get_verbose | grep -v get_trace | grep -v 'library .*0x' | grep -v 'library command' | grep -v 'get_path' > test.out
trace true
event ev1 * "echo $EVENT $@"

View File

@@ -23,7 +23,7 @@ export LANG=C
rm -f test.out
$VG ./guestfish > test.out <<EOF
$VG guestfish > test.out <<EOF
scratch 50MB
run
part-disk /dev/sda mbr

View File

@@ -22,7 +22,7 @@ set -e
rm -f test.out
$VG ./guestfish <<'EOF'
$VG guestfish <<'EOF'
add-ro ../tests/data/test.iso
run
mount-ro /dev/sda /

View File

@@ -22,7 +22,7 @@ set -e
rm -f test-glob.img test-glob.out
$VG ./guestfish -N test-glob.img=disk:1G > test-glob.out <<EOF
$VG guestfish -N test-glob.img=disk:1G > test-glob.out <<EOF
pvcreate /dev/sda
# Because glob doesn't do device name translation, we cannot test

View File

@@ -18,4 +18,4 @@
set -e
$VG ./guestfish -a ../tests/guests/fedora.img -i exit
$VG guestfish -a ../tests/guests/fedora.img -i exit

View File

@@ -23,7 +23,7 @@ set -e
# Memory size
output=$(
$VG ./guestfish <<EOF
$VG guestfish <<EOF
set-memsize 400
-set-memsize 0
-set-memsize 100
@@ -42,7 +42,7 @@ fi
# smp
output=$(
$VG ./guestfish <<EOF
$VG guestfish <<EOF
set-smp 2
-set-smp 0
-set-smp 300
@@ -58,7 +58,7 @@ fi
# Backend
output=$(
$VG ./guestfish <<EOF
$VG guestfish <<EOF
set-backend direct
-set-backend backend-which-does-not-exist
get-backend

View File

@@ -61,7 +61,7 @@ rm -rf test-mount-local-mp
mkdir test-mount-local-mp
if ! ./guestfish -N test-mount-local.img=fs -m /dev/sda1 2>test-mount-local.errors <<EOF; then
if ! guestfish -N test-mount-local.img=fs -m /dev/sda1 2>test-mount-local.errors <<EOF; then
mount-local test-mount-local-mp
! $0 --run-test &
mount-local-run

View File

@@ -22,7 +22,7 @@ rm -f prep*.img
# It would be nice if we could keep this automatically in sync
# with the prepared disk types. XXX
$VG ./guestfish \
$VG guestfish \
-N prep1.img=disk \
-N prep2.img=part \
-N prep3.img=fs \

View File

@@ -22,7 +22,7 @@ set -e
rm -f test.out
$VG ./guestfish <<'EOF' > test.out
$VG guestfish <<'EOF' > test.out
add-ro ../tests/data/test.iso
run
mount-ro /dev/sda /

View File

@@ -20,20 +20,20 @@
set -e
eval "$(./guestfish --listen)"
eval "$(guestfish --listen)"
$VG ./guestfish --remote event close_event close "echo closed"
$VG guestfish --remote event close_event close "echo closed"
output="$($VG ./guestfish --remote list-events)"
output="$($VG guestfish --remote list-events)"
if [ "$output" != '"close_event" (0): close: echo closed' ]; then
echo "$0: list-events failed:"
echo "$output"
./guestfish --remote exit
guestfish --remote exit
exit 1
fi
# Test close event (RHBZ#802389).
output="$($VG ./guestfish --remote quit)"
output="$($VG guestfish --remote quit)"
if [ "$output" != "closed" ]; then
echo "$0: close event failed:"

View File

@@ -22,24 +22,24 @@ set -e
rm -f test-remote.img
eval `./guestfish --listen`
eval `guestfish --listen`
$VG ./guestfish --remote alloc test-remote.img 10M
$VG ./guestfish --remote run
$VG ./guestfish --remote part-disk /dev/sda mbr
$VG ./guestfish --remote mkfs ext2 /dev/sda1
$VG ./guestfish --remote mount /dev/sda1 /
$VG guestfish --remote alloc test-remote.img 10M
$VG guestfish --remote run
$VG guestfish --remote part-disk /dev/sda mbr
$VG guestfish --remote mkfs ext2 /dev/sda1
$VG guestfish --remote mount /dev/sda1 /
# Failure of the above commands will cause the guestfish listener to exit.
# Incorrect return from echo_daemon will not, so need to ensure the listener
# exits in any case, while still reporting an error.
error=0
echo=$($VG ./guestfish --remote echo_daemon "This is a test")
echo=$($VG guestfish --remote echo_daemon "This is a test")
if [ "$echo" != "This is a test" ]; then
error=1;
fi
$VG ./guestfish --remote exit
$VG guestfish --remote exit
rm test-remote.img

View File

@@ -23,7 +23,7 @@ set -e
rm -f test-reopen.img
$VG ./guestfish <<'EOF'
$VG guestfish <<'EOF'
reopen
reopen
reopen

View File

@@ -18,4 +18,4 @@
set -e
$VG ./guestfish -a ../tests/guests/fedora.img run
$VG guestfish -a ../tests/guests/fedora.img run

View File

@@ -22,7 +22,7 @@ set -e
rm -f test-stringlist.img
eval `./guestfish --listen`
eval `guestfish --listen`
error=0
@@ -32,15 +32,15 @@ function check_echo {
local echo
echo=$($VG ./guestfish --remote echo_daemon "$test")
echo=$($VG guestfish --remote echo_daemon "$test")
if [ "$echo" != "$expected" ]; then
echo "Expected \"$expected\", got \"$echo\""
error=1
fi
}
$VG ./guestfish --remote alloc test-stringlist.img 10M
$VG ./guestfish --remote run
$VG guestfish --remote alloc test-stringlist.img 10M
$VG guestfish --remote run
check_echo "' '" " "
check_echo "\'" "'"
@@ -53,7 +53,7 @@ check_echo "'foo' 'bar'" "foo bar"
check_echo "'foo' " "foo"
check_echo " 'foo'" "foo"
$VG ./guestfish --remote exit
$VG guestfish --remote exit
rm test-stringlist.img

View File

@@ -27,12 +27,12 @@ set -e
HOME=$(pwd)
export HOME
if [ `echo 'echo ~' | $VG ./guestfish` != "$HOME" ]; then
if [ `echo 'echo ~' | $VG guestfish` != "$HOME" ]; then
echo "$0: failed: did not expand ~ correctly"
exit 1
fi
if [ `echo 'echo ~/foo' | $VG ./guestfish` != "$HOME/foo" ]; then
if [ `echo 'echo ~/foo' | $VG guestfish` != "$HOME/foo" ]; then
echo "$0: failed: did not expand ~/foo correctly"
exit 1
fi
@@ -41,12 +41,12 @@ fi
# should have a home directory.
root="$(echo ~root)"
if [ `echo 'echo ~root' | $VG ./guestfish` != "$root" ]; then
if [ `echo 'echo ~root' | $VG guestfish` != "$root" ]; then
echo "$0: failed: did not expand ~root correctly"
exit 1
fi
if [ `echo 'echo ~root/foo' | $VG ./guestfish` != "$root/foo" ]; then
if [ `echo 'echo ~root/foo' | $VG guestfish` != "$root/foo" ]; then
echo "$0: failed: did not expand ~root/foo correctly"
exit 1
fi
@@ -55,12 +55,12 @@ fi
unset HOME
home="$(echo ~)"
if [ `echo 'echo ~' | $VG ./guestfish` != "$home" ]; then
if [ `echo 'echo ~' | $VG guestfish` != "$home" ]; then
echo "$0: failed: did not expand ~ correctly when \$HOME unset"
exit 1
fi
if [ `echo 'echo ~/foo' | $VG ./guestfish` != "$home/foo" ]; then
if [ `echo 'echo ~/foo' | $VG guestfish` != "$home/foo" ]; then
echo "$0: failed: did not expand ~/foo correctly when \$HOME unset"
exit 1
fi

View File

@@ -24,7 +24,7 @@ set -e
rm -f test-upload-to-dir.img test-upload-to-dir.out
if $VG ./guestfish -N test-upload-to-dir.img=fs -m /dev/sda1 upload ../tests/data/test.iso / 2>test-upload-to-dir.out
if $VG guestfish -N test-upload-to-dir.img=fs -m /dev/sda1 upload ../tests/data/test.iso / 2>test-upload-to-dir.out
then
echo "$0: expecting guestfish to return an error"
exit 1

View File

@@ -27,11 +27,11 @@ fi
rm -f test-virt-format.img
$VG ../fish/guestfish -N test-virt-format.img=bootrootlv exit
$VG guestfish -N test-virt-format.img=bootrootlv exit
$VG ./virt-format --filesystem=ext3 -a test-virt-format.img
$VG virt-format --filesystem=ext3 -a test-virt-format.img
if [ "$($VG ../cat/virt-filesystems -a test-virt-format.img)" != "/dev/sda1" ]; then
if [ "$($VG virt-filesystems -a test-virt-format.img)" != "/dev/sda1" ]; then
echo "$0: unexpected output after using virt-format"
exit 1
fi

View File

@@ -38,7 +38,7 @@ if [ ! -f ../tests/guests/fedora.img ]; then
exit 77
fi
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because uml backend does not support qcow2"
exit 77
fi
@@ -47,7 +47,7 @@ rm -f test.qcow2 test-copy.qcow2 test.pid
rm -rf mp
# Make a copy of the Fedora image so we can write to it then discard it.
../fish/guestfish -- \
guestfish -- \
disk-create test.qcow2 qcow2 -1 \
backingfile:../tests/guests/fedora.img backingformat:raw
@@ -77,7 +77,7 @@ fi
# It should now be safe to copy and read the disk image.
cp test.qcow2 test-copy.qcow2
if [ "$(../fish/guestfish -a test-copy.qcow2 --ro -i is-file /test-umount)" != "true" ]; then
if [ "$(guestfish -a test-copy.qcow2 --ro -i is-file /test-umount)" != "true" ]; then
echo "$0: test failed"
exit 1
fi

View File

@@ -46,14 +46,11 @@ nr_stages=$(grep "^stage " $0 | wc -l)
# and move to that directory for the initial phase of the script.
top_builddir=$(cd "$top_builddir" > /dev/null; pwd)
# Paths to the other programs and files. NB: Must be absolute paths.
guestfish="$top_builddir/fish/guestfish"
guestmount="$top_builddir/fuse/guestmount"
guestunmount="$top_builddir/fuse/guestunmount"
# Paths to the other files. NB: Must be absolute paths.
image="$top_builddir/fuse/test-fuse.img"
mp="$top_builddir/fuse/test-fuse-mp"
if [ ! -x "$guestfish" -o ! -x "$guestmount" -o ! -x "$guestunmount" ]
if ! guestfish --help >/dev/null 2>&1 || ! guestmount --help >/dev/null 2>&1 || ! guestunmount --help >/dev/null 2>&1
then
echo "$0: error: guestfish, guestmount or guestunmount are not available"
exit 1
@@ -82,7 +79,7 @@ function cleanup ()
if [ -x /sbin/fuser ]; then /sbin/fuser "$mp"; fi
if [ -n "$mounted" ]; then
$guestunmount "$mp"
guestunmount "$mp"
fi
rm -f "$image"
@@ -99,7 +96,7 @@ function stage ()
}
stage Create filesystem with some initial content
$guestfish <<EOF
guestfish <<EOF
sparse "$image" 10M
run
part-disk /dev/sda mbr
@@ -116,7 +113,7 @@ $guestfish <<EOF
EOF
stage Mounting the filesystem
$guestmount \
guestmount \
-a "$image" -m /dev/sda1:/:acl,user_xattr \
-o uid="$(id -u)" -o gid="$(id -g)" "$mp"
# To debug guestmount, add this to the end of the preceding command:

View File

@@ -33,7 +33,7 @@ for f in ../tests/guests/{debian,fedora,ubuntu,windows}.img; do
# 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 -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"
@@ -42,6 +42,6 @@ done
# We could also test this image, but mdadm is problematic for
# many users.
# $VG ./virt-inspector \
# $VG virt-inspector \
# -a ../tests/guests/fedora-md1.img \
# -a ../tests/guests/fedora-md2.img

View File

@@ -40,7 +40,7 @@ if [ -n "$SKIP_TEST_VIRT_MAKE_FS_BTRFS" ]; then
fi
# UML backend doesn't support qcow2.
if [ "$(../fish/guestfish get-backend)" != "uml" ]; then
if [ "$(guestfish get-backend)" != "uml" ]; then
qcow2_supported=yes
fi
@@ -94,6 +94,6 @@ dd if=/dev/zero of=test.file bs=1024 count=$tarsize
tar -c -f test.tar test.file
rm test.file
$VG ./virt-make-fs $params -- test.tar output.img
$VG virt-make-fs $params -- test.tar output.img
rm test.tar output.img

View File

@@ -27,7 +27,7 @@ if [ -n "$SKIP_TEST_VIRT_P2V_SH" ]; then
exit 77
fi
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: test skipped because UML backend does not support network"
exit 77
fi
@@ -61,7 +61,7 @@ export PATH=$d:$PATH
# The Linux kernel command line.
cmdline="p2v.server=localhost p2v.name=windows p2v.debug p2v.disks=$f p2v.o=local p2v.os=$d p2v.network=em1:wired,other"
./virt-p2v --cmdline="$cmdline"
virt-p2v --cmdline="$cmdline"
# Test the libvirt XML metadata and a disk was created.
test -f $d/windows.xml

View File

@@ -28,7 +28,7 @@ fi
rm -f virt-rescue-suggest.out
$VG ./virt-rescue --suggest "$guest" |
$VG virt-rescue --suggest "$guest" |
grep '^mount ' |
sed -r 's,/dev/[abce-ln-z]+d,/dev/sd,' > virt-rescue-suggest.out

View File

@@ -19,7 +19,7 @@
export LANG=C
set -e
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: skipping test because uml backend does not support qcow2"
exit 77
fi
@@ -29,13 +29,13 @@ fi
# This exercises a number of interesting codepaths including resizing
# LV content, handling GPT, and using qcow2 as a target.
$VG ../fish/guestfish \
$VG guestfish \
-N test-virt-resize-1.img=bootrootlv:/dev/VG/LV:ext2:ext4:400M:32M:gpt </dev/null
$VG ../fish/guestfish \
$VG guestfish \
disk-create test-virt-resize-2.img qcow2 500M preallocation:metadata
$VG ./virt-resize -d --debug-gc \
$VG virt-resize -d --debug-gc \
--expand /dev/sda2 \
--lv-expand /dev/VG/LV \
--format raw --output-format qcow2 \
@@ -45,7 +45,7 @@ $VG ./virt-resize -d --debug-gc \
# image created above contains no data, we will nevertheless use
# similar operations to ones that might be used by a real admin.
../fish/guestfish -a test-virt-resize-1.img <<EOF
guestfish -a test-virt-resize-1.img <<EOF
run
resize2fs-size /dev/VG/LV 190M
lvresize /dev/VG/LV 190
@@ -53,8 +53,8 @@ pvresize-size /dev/sda2 200M
fsck ext4 /dev/VG/LV
EOF
rm -f test-virt-resize-2.img; ../fish/guestfish sparse test-virt-resize-2.img 300M
$VG ./virt-resize -d --debug-gc \
rm -f test-virt-resize-2.img; guestfish sparse test-virt-resize-2.img 300M
$VG virt-resize -d --debug-gc \
--shrink /dev/sda2 \
--format raw --output-format raw \
test-virt-resize-1.img test-virt-resize-2.img

View File

@@ -24,7 +24,7 @@ if [ -n "$SKIP_TEST_VIRT_SPARSIFY_IN_PLACE_SH" ]; then
exit 77
fi
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: skipping test because uml backend does not support discard"
exit 77
fi
@@ -34,7 +34,7 @@ rm -f test-virt-sparsify-in-place.img
# Create a filesystem, fill it with data, then delete the data. Then
# prove that sparsifying it reduces the size of the final filesystem.
$VG ../fish/guestfish \
$VG guestfish \
-N test-virt-sparsify-in-place.img=bootrootlv:/dev/VG/LV:ext4:ext4:400M:32M:gpt <<EOF
mount /dev/VG/LV /
mkdir /boot
@@ -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 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"

View File

@@ -19,7 +19,7 @@
export LANG=C
set -e
if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: skipping test because uml backend does not support qcow2"
exit 77
fi
@@ -29,7 +29,7 @@ rm -f test-virt-sparsify-1.img test-virt-sparsify-2.img
# Create a filesystem, fill it with data, then delete the data. Then
# prove that sparsifying it reduces the size of the final filesystem.
$VG ../fish/guestfish \
$VG guestfish \
-N test-virt-sparsify-1.img=bootrootlv:/dev/VG/LV:ext2:ext4:400M:32M:gpt <<EOF
mount /dev/VG/LV /
mkdir /boot
@@ -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 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}')

View File

@@ -35,11 +35,11 @@ fi
# so we fake that now.
rm -f passwords.qcow2 password
../fish/guestfish -- \
guestfish -- \
disk-create passwords.qcow2 qcow2 -1 \
backingfile:../tests/guests/fedora.img backingformat:raw
../fish/guestfish -a passwords.qcow2 -i <<'EOF'
guestfish -a passwords.qcow2 -i <<'EOF'
write-append /etc/shadow "test01::15677:0:99999:7:::\n"
write-append /etc/shadow "test02::15677:0:99999:7:::\n"
write-append /etc/shadow "test03::15677:0:99999:7:::\n"
@@ -57,7 +57,7 @@ echo 123456 > password
# Run virt-sysprep password operation.
./virt-sysprep \
virt-sysprep \
-a passwords.qcow2 \
--enable customize \
--password test01:password:123456 \

View File

@@ -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 ../tests/guests/fedora.img --enable script \
if ! virt-sysprep -q -n -a ../tests/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 ../tests/guests/fedora.img --enable script \
if virt-sysprep -q -n -a ../tests/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 ../tests/guests/fedora.img --enable script \
if ! virt-sysprep -q -n -a ../tests/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 ../tests/guests/fedora.img --enable script \
if ! virt-sysprep -q -n -a ../tests/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

View File

@@ -21,7 +21,7 @@ set -e
# Get a comma-separated list of the enabled-by-default operations.
operations=$(
./virt-sysprep --list-operations |
virt-sysprep --list-operations |
fgrep '*' |
awk '{printf ("%s,",$1)}' |
sed 's/,$//'
@@ -36,13 +36,13 @@ for f in ../tests/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" -a $f
echo
fi
done
# We could also test this image, but mdadm is problematic for
# many users.
# $VG ./virt-sysprep -q -n \
# $VG virt-sysprep -q -n \
# -a ../tests/guests/fedora-md1.img \
# -a ../tests/guests/fedora-md2.img

View File

@@ -26,7 +26,7 @@ if [ -n "$SKIP_TEST_9P_SH" ]; then
exit 77
fi
backend="$(../../fish/guestfish get-backend)"
backend="$(guestfish get-backend)"
if [[ "$backend" != "direct" ]]; then
echo "$0: test skipped because backend ($backend) is not 'direct'."
exit 77
@@ -45,7 +45,7 @@ fi
rm -f test-9p.img test-9p.out
../../fish/guestfish <<EOF
guestfish <<EOF
# This dummy disk is not actually used, but libguestfs requires one.
sparse test-9p.img 1M

View File

@@ -24,8 +24,6 @@
set -e
guestfish=../../fish/guestfish
# Allow the test to be skipped since btrfs is often broken.
if [ -n "$SKIP_TEST_BTRFS_DEVICES_SH" ]; then
echo "$0: skipping test because environment variable is set."
@@ -33,14 +31,14 @@ if [ -n "$SKIP_TEST_BTRFS_DEVICES_SH" ]; then
fi
# If btrfs is not available, bail.
if ! $guestfish -a /dev/null run : available btrfs; then
if ! guestfish -a /dev/null run : available btrfs; then
echo "$0: skipping test because btrfs is not available"
exit 77
fi
rm -f test-btrfs-devices-{1,2,3,4}.img
$guestfish <<EOF
guestfish <<EOF
# Add four empty disks
sparse test-btrfs-devices-1.img 1G
sparse test-btrfs-devices-2.img 1G

View File

@@ -25,7 +25,7 @@ rm -f disk*.img file:*.img
# XXX We should also test failure paths.
../../fish/guestfish <<EOF
guestfish <<EOF
disk-create disk1.img raw 256K
disk-create disk2.img raw 256K preallocation:sparse
disk-create disk3.img raw 256K preallocation:full
@@ -45,7 +45,7 @@ rm -f disk*.img file:*.img
disk-create disk,,0.img qcow2 256K
EOF
output="$(../../fish/guestfish <<EOF
output="$(guestfish <<EOF
disk-format disk1.img
disk-format disk2.img
disk-format disk3.img

View File

@@ -41,8 +41,7 @@ if ! ../../src/libvirt-is-version 1 1 3; then
exit 77
fi
guestfish="\
../../fish/guestfish -c test://$abs_builddir/test-qemu-drive-libvirt.xml"
guestfish="guestfish -c test://$abs_builddir/test-qemu-drive-libvirt.xml"
export LIBGUESTFS_BACKEND=direct
export LIBGUESTFS_HV="${abs_srcdir}/debug-qemu.sh"

View File

@@ -21,8 +21,6 @@ export LANG=C
set -e
guestfish=../../fish/guestfish
export LIBGUESTFS_BACKEND=direct
export LIBGUESTFS_HV="${abs_srcdir}/debug-qemu.sh"
export DEBUG_QEMU_FILE="${abs_builddir}/test-qemu-drive.out"
@@ -46,7 +44,7 @@ rm -f "$DEBUG_QEMU_FILE"
# Ceph (RBD).
$guestfish <<EOF ||:
guestfish <<EOF ||:
add "abc-def/ghi-jkl" "format:raw" "protocol:rbd" \
"server:1.2.3.4:1234 1.2.3.5:1235 1.2.3.6:1236"
run
@@ -55,7 +53,7 @@ check_output
grep -sq -- '-drive file=rbd:abc-def/ghi-jkl:mon_host=1.2.3.4\\:1234\\;1.2.3.5\\:1235\\;1.2.3.6\\:1236:auth_supported=none,' "$DEBUG_QEMU_FILE" || fail
rm "$DEBUG_QEMU_FILE"
$guestfish <<EOF ||:
guestfish <<EOF ||:
add "abc-def/ghi-jkl" "format:raw" "protocol:rbd"
run
EOF
@@ -65,7 +63,7 @@ rm "$DEBUG_QEMU_FILE"
# HTTP.
$guestfish <<EOF ||:
guestfish <<EOF ||:
add "/disk.img" "format:raw" "protocol:http" "server:www.example.com"
run
EOF
@@ -75,7 +73,7 @@ rm "$DEBUG_QEMU_FILE"
# Gluster.
$guestfish <<EOF ||:
guestfish <<EOF ||:
add "volname/image" "format:raw" "protocol:gluster" "server:www.example.com:24007"
run
EOF
@@ -85,7 +83,7 @@ rm "$DEBUG_QEMU_FILE"
# iSCSI.
$guestfish <<EOF ||:
guestfish <<EOF ||:
add "target-iqn-name/lun" "format:raw" "protocol:iscsi" "server:www.example.com:3000"
run
EOF
@@ -95,7 +93,7 @@ rm "$DEBUG_QEMU_FILE"
# NBD.
$guestfish <<EOF ||:
guestfish <<EOF ||:
add "" "format:raw" "protocol:nbd" "server:1.2.3.4:1234"
run
EOF
@@ -103,7 +101,7 @@ check_output
grep -sq -- '-drive file=nbd:1.2.3.4:1234,' "$DEBUG_QEMU_FILE" || fail
rm "$DEBUG_QEMU_FILE"
$guestfish <<EOF ||:
guestfish <<EOF ||:
add "" "format:raw" "protocol:nbd" "server:unix:/socket"
run
EOF
@@ -113,7 +111,7 @@ rm "$DEBUG_QEMU_FILE"
# Sheepdog.
$guestfish <<EOF ||:
guestfish <<EOF ||:
add "volume" "format:raw" "protocol:sheepdog"
run
EOF
@@ -123,7 +121,7 @@ rm "$DEBUG_QEMU_FILE"
# SSH.
$guestfish <<EOF ||:
guestfish <<EOF ||:
add "/disk.img" "format:raw" "protocol:ssh" "server:example.com" \
"username:rich"
run

View File

@@ -31,7 +31,7 @@ LABEL=BOOT /boot ext2 default 0 0
EOF
# Create a disk image.
../../fish/guestfish <<EOF
guestfish <<EOF
sparse debian.img.tmp.$$ 512M
run

View File

@@ -39,7 +39,7 @@ DISTRIB_DESCRIPTION="Ubuntu 10.10 (Phony Pharaoh)"
EOF
# Create a disk image.
../../fish/guestfish <<EOF
guestfish <<EOF
sparse ubuntu.img.tmp.$$ 512M
run

View File

@@ -25,7 +25,7 @@ set -e
# ntfs-3g/ntfsprogs then we cannot create a Windows phony image.
# Nothing actually uses windows.img in the standard build so we can
# just 'touch' it and emit a warning.
if ! ../../fish/guestfish -a /dev/null run : available "ntfs3g ntfsprogs"; then
if ! guestfish -a /dev/null run : available "ntfs3g ntfsprogs"; then
echo "***"
echo "Warning: cannot create windows.img because there is no NTFS"
echo "support in this build of libguestfs. Just touching the output"
@@ -36,7 +36,7 @@ if ! ../../fish/guestfish -a /dev/null run : available "ntfs3g ntfsprogs"; then
fi
# Create a disk image.
../../fish/guestfish <<EOF
guestfish <<EOF
sparse windows.img.tmp.$$ 512M
run

View File

@@ -26,14 +26,14 @@ set -e
}
# If luks is not available, bail.
if ! ../../fish/guestfish -a /dev/null run : available luks; then
if ! guestfish -a /dev/null run : available luks; then
echo "$0: skipping test because luks is not available"
exit 77
fi
rm -f test-luks-list.img test-luks-list.out
../../fish/guestfish --keys-from-stdin > test-luks-list.out <<'EOF'
guestfish --keys-from-stdin > test-luks-list.out <<'EOF'
sparse test-luks-list.img 1G
run
part-init /dev/sda mbr

View File

@@ -26,14 +26,14 @@ set -e
}
# If luks is not available, bail.
if ! ../../fish/guestfish -a /dev/null run : available luks; then
if ! guestfish -a /dev/null run : available luks; then
echo "$0: skipping test because luks is not available"
exit 77
fi
rm -f test-luks.img
../../fish/guestfish --keys-from-stdin <<EOF
guestfish --keys-from-stdin <<EOF
sparse test-luks.img 1G
run
part-disk /dev/sda mbr

View File

@@ -27,7 +27,7 @@ fi
rm -f test-lvm-filtering-1.img test-lvm-filtering-2.img
actual=$(../../fish/guestfish <<'EOF'
actual=$(guestfish <<'EOF'
sparse test-lvm-filtering-1.img 1G
sparse test-lvm-filtering-2.img 1G

View File

@@ -26,15 +26,13 @@ if [ -n "$SKIP_TEST_INSPECT_FSTAB_MD_SH" ]; then
exit 77
fi
guestfish=../../fish/guestfish
rm -f inspect-fstab-md-{1,2}.img inspect-fstab-md.fstab inspect-fstab-md.output
# First, test the regular fedora image, which specifies /boot as /dev/md0
cp ../guests/fedora-md1.img inspect-fstab-md-1.img
cp ../guests/fedora-md2.img inspect-fstab-md-2.img
$guestfish -i inspect-fstab-md-[12].img <<'EOF' | sort > inspect-fstab-md.output
guestfish -i inspect-fstab-md-[12].img <<'EOF' | sort > inspect-fstab-md.output
exists /boot/grub/grub.conf
EOF
@@ -49,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 -a inspect-fstab-md-1.img -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 inspect-fstab-md-[12].img <<'EOF' | sort > inspect-fstab-md.output
exists /boot/grub/grub.conf
EOF

View File

@@ -22,10 +22,9 @@
set -e
export LANG=C
guestfish=../../fish/guestfish
canonical="sed -r s,/dev/[abce-ln-z]+d,/dev/sd,g"
if [ "$($guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: skipping test because uml backend does not support qcow2"
exit 77
fi
@@ -34,7 +33,7 @@ rm -f inspect-fstab-1.qcow2 inspect-fstab.fstab inspect-fstab.output
# Start with the regular (good) fedora image, modify /etc/fstab
# and then inspect it.
$guestfish -- \
guestfish -- \
disk-create inspect-fstab-1.qcow2 qcow2 -1 \
backingfile:../guests/fedora.img backingformat:raw
@@ -56,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 -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 -a inspect-fstab-1.qcow2 -i <<'EOF' | sort | $canonical > inspect-fstab.output
inspect-get-mountpoints /dev/VG/Root
EOF
@@ -88,13 +87,13 @@ cat <<'EOF' > inspect-fstab.fstab
/dev/xvdg1 /boot ext2 default 0 0
EOF
$guestfish -a inspect-fstab-1.qcow2 <<'EOF'
guestfish -a inspect-fstab-1.qcow2 <<'EOF'
run
mount /dev/VG/Root /
upload inspect-fstab.fstab /etc/fstab
EOF
$guestfish <<'EOF' | $canonical > inspect-fstab.output
guestfish <<'EOF' | $canonical > inspect-fstab.output
add inspect-fstab-1.qcow2 readonly:true name:xvdg
run
inspect-os
@@ -119,13 +118,13 @@ cat <<'EOF' > inspect-fstab.fstab
/dev/cciss/c1d3 /var ext2 default 0 0
EOF
$guestfish -a inspect-fstab-1.qcow2 <<'EOF'
guestfish -a inspect-fstab-1.qcow2 <<'EOF'
run
mount /dev/VG/Root /
upload inspect-fstab.fstab /etc/fstab
EOF
$guestfish <<'EOF' | $canonical > inspect-fstab.output
guestfish <<'EOF' | $canonical > inspect-fstab.output
add inspect-fstab-1.qcow2 readonly:true name:cciss/c1d3
run
inspect-os

View File

@@ -37,7 +37,7 @@ rm -f list-fs.output
# md127 : 20M ext4
# vg0 : 16M LV (lv0)
# lv0 : 16M vfat
../../fish/guestfish <<EOF | sed -r s,/dev/[abce-ln-z]+d,/dev/sd,g > list-fs.output
guestfish <<EOF | sed -r s,/dev/[abce-ln-z]+d,/dev/sd,g > list-fs.output
# Add 2 empty disks
scratch 50M
scratch 50M

View File

@@ -26,7 +26,7 @@ if [ -n "$SKIP_TEST_LIST_MD_DEVICES_SH" ]; then
fi
output=$(
../../fish/guestfish <<EOF
guestfish <<EOF
# Add 2 empty disks
sparse list-md-devices-1.img 100M
sparse list-md-devices-2.img 100M
@@ -49,7 +49,7 @@ fi
# Ensure list-md-devices now returns the newly created md device
output=$(
../../fish/guestfish -a list-md-devices-1.img -a list-md-devices-2.img <<EOF
guestfish -a list-md-devices-1.img -a list-md-devices-2.img <<EOF
run
list-md-devices
EOF

View File

@@ -27,7 +27,7 @@ fi
rm -f mdadm-{1,2,3,4}.img
../../fish/guestfish <<EOF
guestfish <<EOF
# Add four empty disks
sparse mdadm-1.img 100M
sparse mdadm-2.img 100M
@@ -97,15 +97,15 @@ write /r5t3/baz "testing"
EOF
eval `../../fish/guestfish --listen`
../../fish/guestfish --remote add-ro mdadm-1.img
../../fish/guestfish --remote add-ro mdadm-2.img
../../fish/guestfish --remote add-ro mdadm-3.img
../../fish/guestfish --remote add-ro mdadm-4.img
../../fish/guestfish --remote run
eval `guestfish --listen`
guestfish --remote add-ro mdadm-1.img
guestfish --remote add-ro mdadm-2.img
guestfish --remote add-ro mdadm-3.img
guestfish --remote add-ro mdadm-4.img
guestfish --remote run
for md in `../../fish/guestfish --remote list-md-devices`; do
../../fish/guestfish --remote md-detail "$md" > md-detail.out
for md in `guestfish --remote list-md-devices`; do
guestfish --remote md-detail "$md" > md-detail.out
sed 's/:\s*/=/' md-detail.out > md-detail.out.sh
. md-detail.out.sh
@@ -148,24 +148,24 @@ for md in `../../fish/guestfish --remote list-md-devices`; do
if [ "$error" -eq 1 ]; then
echo "$0: Unexpected output from md-detail for device $md"
cat md-detail.out
../../fish/guestfish --remote exit
guestfish --remote exit
exit 1
fi
done
../../fish/guestfish --remote exit
guestfish --remote exit
eval `../../fish/guestfish --listen`
../../fish/guestfish --remote add-ro mdadm-1.img
../../fish/guestfish --remote add-ro mdadm-2.img
../../fish/guestfish --remote add-ro mdadm-3.img
../../fish/guestfish --remote add-ro mdadm-4.img
../../fish/guestfish --remote run
eval `guestfish --listen`
guestfish --remote add-ro mdadm-1.img
guestfish --remote add-ro mdadm-2.img
guestfish --remote add-ro mdadm-3.img
guestfish --remote add-ro mdadm-4.img
guestfish --remote run
for md in `../../fish/guestfish --remote list-md-devices`; do
../../fish/guestfish --remote md-stop "$md"
for md in `guestfish --remote list-md-devices`; do
guestfish --remote md-stop "$md"
done
../../fish/guestfish --remote exit
guestfish --remote exit
rm md-detail.out mdadm-1.img mdadm-2.img mdadm-3.img mdadm-4.img

View File

@@ -19,7 +19,6 @@
set -e
export LANG=C
guestfish=../../fish/guestfish
canonical="sed s,/dev/vd,/dev/sd,g"
# Allow the test to be skipped since btrfs is often broken.
@@ -28,13 +27,13 @@ if [ -n "$SKIP_TEST_MOUNTABLE_INSPECT_SH" ]; then
exit 77
fi
if [ "$($guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: skipping test because uml backend does not support qcow2"
exit 77
fi
# Bail if btrfs is not available.
if ! $guestfish -a /dev/null run : available btrfs; then
if ! guestfish -a /dev/null run : available btrfs; then
echo "$0: skipping test because btrfs is not available"
exit 77
fi
@@ -43,13 +42,13 @@ rm -f root.tmp test.qcow2 test.output
# Start with the regular (good) fedora image, modify /etc/fstab
# and then inspect it.
$guestfish -- \
guestfish -- \
disk-create test.qcow2 qcow2 -1 \
backingfile:../guests/fedora-btrfs.img backingformat:raw
# Test that basic inspection works and the expected filesystems are
# found
$guestfish -a test.qcow2 -i <<'EOF' | sort | $canonical > test.output
guestfish -a test.qcow2 -i <<'EOF' | sort | $canonical > test.output
inspect-get-roots | head -1 > root.tmp
<! echo inspect-get-mountpoints "`cat root.tmp`"
EOF
@@ -63,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 -a test.qcow2 -i <<'EOF' > test.output
inspect-get-roots | head -1 > root.tmp
<! echo inspect-get-product-name "`cat root.tmp`"
EOF

View File

@@ -28,10 +28,10 @@ if [ -n "$SKIP_TEST_RHBZ690819_SH" ]; then
exit 77
fi
backend="$(../../fish/guestfish get-backend)"
backend="$(guestfish get-backend)"
if [[ "$backend" =~ ^uml ]]; then
echo "$0: test skipped because backend ($backend) is 'uml'."
exit 77
fi
../../fish/guestfish --network -a /dev/null run
guestfish --network -a /dev/null run

View File

@@ -27,10 +27,8 @@ fi
rm -f test-ntfsclone.img ntfsclone-backup1 ntfsclone-backup2
guestfish=../../fish/guestfish
# Skip if ntfs-3g is not supported by the appliance.
if ! $guestfish add /dev/null : run : available "ntfs3g"; then
if ! guestfish add /dev/null : run : available "ntfs3g"; then
echo "$0: skipped because ntfs-3g is not supported by the appliance"
exit 77
fi
@@ -41,14 +39,14 @@ if [ ! -s ../guests/windows.img ]; then
fi
# Export the filesystems to the backup file.
$guestfish --ro -a ../guests/windows.img <<EOF
guestfish --ro -a ../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
EOF
# Restore to another disk image.
output=$($guestfish -N test-ntfsclone.img=part:300M <<EOF
output=$(guestfish -N test-ntfsclone.img=part:300M <<EOF
ntfsclone-in ntfsclone-backup1 /dev/sda1
vfs-type /dev/sda1
EOF

View File

@@ -22,7 +22,7 @@
set -e
../../fish/guestfish <<EOF
guestfish <<EOF
scratch 100M
run
-tar-in /tmp/nosuchfile /blah

View File

@@ -31,7 +31,7 @@ tmpfile=`mktemp`
size=$(awk 'BEGIN{ srand(); print int(16*1024*rand()) }')
echo "$0: test size $size (bytes)"
../../fish/guestfish <<EOF
guestfish <<EOF
# We want the file to be fully allocated.
alloc $tmpfile 10M
run

View File

@@ -22,7 +22,7 @@
set -e
../../fish/guestfish \
guestfish \
-N test-cancellation-upload-daemoncancels.img=fs:ext2:10M \
-m /dev/sda1 <<'EOF'
# Upload image, daemon should cancel because the image is too large

View File

@@ -20,12 +20,12 @@
set -e
if [ "$(../../fish/guestfish get-backend)" != "direct" ]; then
if [ "$(guestfish get-backend)" != "direct" ]; then
echo "$0: test skipped because default backend is not 'direct'"
exit 77
fi
../../fish/guestfish <<'EOF'
guestfish <<'EOF'
scratch 100M
run
# Kill the subprocess.

View File

@@ -20,14 +20,14 @@
set -e
if [ "$(../../fish/guestfish get-backend)" != "direct" ]; then
if [ "$(guestfish get-backend)" != "direct" ]; then
echo "$0: test skipped because default backend is not 'direct'"
exit 77
fi
rm -f qemudie-midcommand.pid
../../fish/guestfish <<'EOF'
guestfish <<'EOF'
scratch 100M
run
# Kill the subprocess after a short wait.

View File

@@ -20,14 +20,14 @@
set -e
if [ "$(../../fish/guestfish get-backend)" != "direct" ]; then
if [ "$(guestfish get-backend)" != "direct" ]; then
echo "$0: test skipped because default backend is not 'direct'"
exit 77
fi
rm -f qemudie-synch.pid
../../fish/guestfish <<'EOF'
guestfish <<'EOF'
scratch 100M
run
# Kill subprocess.

View File

@@ -24,7 +24,7 @@ if [ -n "$SKIP_QEMU_FORCE_TCG_SH" ]; then
fi
# Only applicable to the direct and libvirt backends:
if [ "$(../../fish/guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
echo "$0: skipping test because it is only applicable when qemu is being used."
exit 77
fi
@@ -33,7 +33,7 @@ set -e
rm -f qemu-force-tcg.out
../../fish/guestfish -a /dev/null <<EOF
guestfish -a /dev/null <<EOF
set-backend-setting force_tcg 1
run
debug sh "cat /sys/devices/system/clocksource/clocksource0/current_clocksource" | cat > qemu-force-tcg.out

View File

@@ -24,10 +24,10 @@ set -e
rm -f liveness1.img
../../fish/guestfish sparse liveness1.img 100M
guestfish sparse liveness1.img 100M
liveness1_md5sum="$(md5sum liveness1.img | awk '{print $1}')"
../../fish/guestfish <<'EOF'
guestfish <<'EOF'
add liveness1.img format:raw
run

View File

@@ -22,23 +22,21 @@
set -e
guestfish=../../fish/guestfish
# UML backend doesn't support qcow2 format.
supports_qcow2=yes
if [ "$($guestfish get-backend)" = "uml" ]; then
if [ "$(guestfish get-backend)" = "uml" ]; then
supports_qcow2=no
fi
rm -f isolation1.img isolation2.img isolation3.img
../../fish/guestfish sparse isolation1.img 100M
guestfish sparse isolation1.img 100M
isolation1_md5sum="$(md5sum isolation1.img | awk '{print $1}')"
../../fish/guestfish sparse isolation2.img 100M
guestfish sparse isolation2.img 100M
isolation2_md5sum="$(md5sum isolation2.img | awk '{print $1}')"
if [ "$supports_qcow2" = "yes" ]; then
../../fish/guestfish \
guestfish \
disk-create isolation3.img qcow2 100M preallocation:metadata
isolation3_md5sum="$(md5sum isolation3.img | awk '{print $1}')"
add3="add-drive-opts isolation3.img format:qcow2 readonly:true"
@@ -53,7 +51,7 @@ fi
# The vitally important calls are 'add-drive-ro' and
# 'add-drive-opts ... readonly:true'.
../../fish/guestfish <<EOF
guestfish <<EOF
add-drive-ro isolation1.img
add-drive-opts isolation2.img format:raw readonly:true
$add3

View File

@@ -30,7 +30,7 @@ fi
rm -f rhbz1001875.img rhbz1001875-[123].tar
../../fish/guestfish -N rhbz1001875.img=fs -m /dev/sda1 <<EOF
guestfish -N rhbz1001875.img=fs -m /dev/sda1 <<EOF
touch /hello
touch /world
touch /helloworld

View File

@@ -28,7 +28,7 @@ if [ -n "$SKIP_TEST_RHBZ1044014_SH" ]; then
fi
# Check we are running against the libvirt backend.
backend="$(../../fish/guestfish get-backend)"
backend="$(guestfish get-backend)"
if [[ ! ( "$backend" =~ ^libvirt ) ]]; then
echo "$0: test skipped because backend ($backend) is not libvirt."
exit 77
@@ -49,7 +49,7 @@ export LIBGUESTFS_BACKEND="libvirt:test://$(pwd)/$srcdir/rhbz1044014.xml"
rm -f rhbz1044014.out
../../fish/guestfish -- -run < $srcdir/rhbz1044014.in > rhbz1044014.out 2>&1 || {
guestfish -- -run < $srcdir/rhbz1044014.in > rhbz1044014.out 2>&1 || {
r=$?
if [ $r -ne 0 ]; then
cat rhbz1044014.out

View File

@@ -30,14 +30,14 @@ fi
rm -f rhbz1054761-[ab].img
../../fish/guestfish -N rhbz1054761-a.img=disk -N rhbz1054761-b.img=disk <<EOF
guestfish -N rhbz1054761-a.img=disk -N rhbz1054761-b.img=disk <<EOF
pvcreate /dev/sda
pvcreate /dev/sdb
vgcreate VG "/dev/sda /dev/sdb"
EOF
output="$(
../../fish/guestfish -a rhbz1054761-a.img run : pvs |
guestfish -a rhbz1054761-a.img run : pvs |
sed -r 's,^/dev/[abce-ln-z]+d,/dev/sd,'
)"
if [ "$output" != "/dev/sda" ]; then

View File

@@ -28,7 +28,7 @@ if [ -n "$SKIP_TEST_RHBZ1091803_SH" ]; then
exit 77
fi
../../fish/guestfish <<EOF
guestfish <<EOF
scratch 100M
run
mkfs ext2 /dev/sda

View File

@@ -26,7 +26,7 @@
set -e
../../fish/guestfish -N rhbz503169c13.img=fs -m /dev/sda1 <<EOF
guestfish -N rhbz503169c13.img=fs -m /dev/sda1 <<EOF
mkdir /dev
-command /ignore-this-error
unmount-all

View File

@@ -24,7 +24,7 @@ set -e
rm -f rhbz557655.out rhbz557655.err
export LANG=C
../../fish/guestfish >> rhbz557655.out 2>> rhbz557655.err <<EOF
guestfish >> rhbz557655.out 2>> rhbz557655.err <<EOF
# set-memsize is just a convenient non-daemon function that
# takes a single integer argument.
set-memsize 500
@@ -46,7 +46,7 @@ get-memsize
-set-memsize 123L
EOF
../../fish/guestfish -N rhbz557655.img=fs -m /dev/sda1 >> rhbz557655.out 2>> rhbz557655.err <<EOF
guestfish -N rhbz557655.img=fs -m /dev/sda1 >> rhbz557655.out 2>> rhbz557655.err <<EOF
touch /test
# truncate-size takes an Int64 argument

View File

@@ -29,7 +29,7 @@ fi
rm -f test.out
../../fish/guestfish --ro > test.out <<EOF
guestfish --ro > test.out <<EOF
add-drive-ro ../guests/fedora.img
add-cdrom ../data/test.iso
add-drive-ro ../guests/debian.img

View File

@@ -29,7 +29,7 @@ fi
rm -f test.out
../../fish/guestfish --ro > test.out <<EOF
guestfish --ro > test.out <<EOF
add-cdrom ../data/test.iso
run

View File

@@ -22,7 +22,7 @@
set -e
../../fish/guestfish <<EOF
guestfish <<EOF
scratch 100M
run
-upload $srcdir/rhbz576879.sh /test.sh

View File

@@ -23,21 +23,19 @@
set -e
guestfish=../../fish/guestfish
# Start remote guestfish.
eval `$guestfish --listen 2>/dev/null`
eval `guestfish --listen 2>/dev/null`
# This should succeed.
$guestfish --remote version > /dev/null
guestfish --remote version > /dev/null
# This command will fail (because appliance not launched), but
# prefixing with '-' should make remote guestfish ignore the failure.
$guestfish --remote -- -lvs
guestfish --remote -- -lvs
# Remote guestfish should still be running.
$guestfish --remote version > /dev/null
$guestfish --remote exit
guestfish --remote version > /dev/null
guestfish --remote exit
# Try some other command line argument tests which are related the fix.
$guestfish -- version : -lvs : version > /dev/null 2>&1
guestfish -- version : -lvs : version > /dev/null 2>&1

View File

@@ -29,7 +29,7 @@ dd if=/dev/zero of=rhbz580246.img bs=1M count=2
tar cf rhbz580246.tar rhbz580246.img
output=$(
../../fish/guestfish 2>&1 <<'EOF'
guestfish 2>&1 <<'EOF'
add rhbz580246.img
run
mkfs ext2 /dev/sda

View File

@@ -22,11 +22,9 @@
set -e
export LANG=C
guestfish=../../fish/guestfish
rm -f test.output
$guestfish > test.output <<EOF
guestfish > test.output <<EOF
scratch 100M
run
part-init /dev/sda mbr
@@ -48,7 +46,7 @@ false" ]; then
exit 1
fi
$guestfish > test.output <<EOF
guestfish > test.output <<EOF
scratch 100M
run
part-init /dev/sda mbr

View File

@@ -38,7 +38,7 @@ if [[ "$arch" =~ ^ppc ]]; then
exit 77
fi
backend="$(../../fish/guestfish get-backend)"
backend="$(guestfish get-backend)"
if [[ "$backend" =~ ^libvirt ]]; then
echo "$0: test skipped because backend ($backend) is 'libvirt'."
exit 77
@@ -51,9 +51,9 @@ fi
rm -f rhbz690819.img
../../fish/guestfish sparse rhbz690819.img 100M
guestfish sparse rhbz690819.img 100M
../../fish/guestfish <<EOF
guestfish <<EOF
add-drive-with-if rhbz690819.img ide
run
mkfs ext3 /dev/sda

View File

@@ -23,20 +23,19 @@
set -e
export LANG=C
guestfish=../../fish/guestfish
output=rhbz727178.output
rm -f binaries.tmp $output
eval `$guestfish -a /dev/null --listen`
eval `guestfish -a /dev/null --listen`
$guestfish --remote -- run
$guestfish --remote -- debug binaries "" |
guestfish --remote -- run
guestfish --remote -- debug binaries "" |
grep -E '^/(bin|sbin|usr/bin|usr/sbin|usr/libexec)/' > binaries.tmp
while read ex; do
echo ldd $ex
$guestfish --remote -- -debug ldd $ex
guestfish --remote -- -debug ldd $ex
done < binaries.tmp > $output
if grep -E '\bnot found\b|undefined symbol' $output; then

View File

@@ -24,7 +24,7 @@ export LANG=C
rm -f test.out
../../fish/guestfish -a ../guests/fedora.img --ro > test.out <<EOF
guestfish -a ../guests/fedora.img --ro > test.out <<EOF
run
# Not a device at all, should fail.

View File

@@ -36,11 +36,11 @@ filenames[9]='raw:'
rm -f -- rhbz811649.img "${filenames[@]}"
../../fish/guestfish sparse rhbz811649.img 10M
guestfish sparse rhbz811649.img 10M
for f in "${filenames[@]}"; do
ln -- rhbz811649.img "$f"
../../fish/guestfish <<EOF
guestfish <<EOF
add "$f"
run
EOF

View File

@@ -25,7 +25,7 @@ export LANG=C
rm -f rhbz895904.img rhbz895904.out
../../fish/guestfish -N rhbz895904.img=fs -m /dev/sda1 <<EOF | sort -k 3 > rhbz895904.out
guestfish -N rhbz895904.img=fs -m /dev/sda1 <<EOF | sort -k 3 > rhbz895904.out
mkdir /test
touch /test/file1
mkdir /test/subdir

View File

@@ -26,7 +26,7 @@
set -e
export LANG=C
../../fish/guestfish <<EOF
guestfish <<EOF
add-ro /dev/null
run

Some files were not shown because too many files have changed in this diff Show More