Hi, small series with small improvements to the tests. Pino Toscano (3): tests: specify the image format when possible tests: remove remaining relative paths to binaries fish: generate test-prep.sh with generator .gitignore | 1 + align/test-virt-alignment-scan.sh | 2 +- cat/Makefile.am | 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/Makefile.am | 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-prep.sh | 35 ------------------------------- fish/test-run.sh | 2 +- format/test-virt-format.sh | 4 ++-- fuse/test-fuse-umount-race.sh | 6 +++--- fuse/test-guestmount-fd.c | 4 ++-- fuse/test-guestunmount-fd.c | 2 +- fuse/test-guestunmount-not-mounted.sh | 2 +- generator/fish.ml | 33 +++++++++++++++++++++++++++++ generator/fish.mli | 1 + generator/main.ml | 1 + inspector/Makefile.am | 2 +- inspector/test-virt-inspector.sh | 2 +- rescue/test-virt-rescue-suggest.sh | 2 +- rescue/test-virt-rescue.pl | 2 +- sparsify/test-virt-sparsify-in-place.sh | 2 +- sparsify/test-virt-sparsify.sh | 2 +- sysprep/Makefile.am | 6 +++--- 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 +- 54 files changed, 113 insertions(+), 111 deletions(-) delete mode 100755 fish/test-prep.sh -- 2.5.5
Pino Toscano
2016-May-19 16:57 UTC
[Libguestfs] [PATCH 1/3] 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.
---
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
Pino Toscano
2016-May-19 16:57 UTC
[Libguestfs] [PATCH 2/3] tests: remove remaining relative paths to binaries
Tests are run via the ./run binary, so all the binaries in the build
directory are available via $PATH already.
Followup of commit e85a976c5a474d751c6e8352370047a3177a7c45.
---
cat/Makefile.am | 2 +-
df/Makefile.am | 2 +-
fuse/test-fuse-umount-race.sh | 4 ++--
fuse/test-guestmount-fd.c | 4 ++--
fuse/test-guestunmount-fd.c | 2 +-
fuse/test-guestunmount-not-mounted.sh | 2 +-
inspector/Makefile.am | 2 +-
rescue/test-virt-rescue.pl | 2 +-
sysprep/Makefile.am | 6 +++---
9 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/cat/Makefile.am b/cat/Makefile.am
index e2fe84d..1a3482b 100644
--- a/cat/Makefile.am
+++ b/cat/Makefile.am
@@ -214,5 +214,5 @@ check-valgrind:
check-valgrind-local-guests:
for g in $(GUESTS); do \
- $(top_builddir)/run --test @VG@ ./virt-filesystems -c
"$(libvirt_ro_uri)" -d "$$g" --all --long -h --uuid || exit
$$?; \
+ $(top_builddir)/run --test @VG@ virt-filesystems -c
"$(libvirt_ro_uri)" -d "$$g" --all --long -h --uuid || exit
$$?; \
done
diff --git a/df/Makefile.am b/df/Makefile.am
index 83879cd..2cf487d 100644
--- a/df/Makefile.am
+++ b/df/Makefile.am
@@ -107,4 +107,4 @@ check-valgrind:
$(MAKE) VG="$(top_builddir)/run @VG@" check
check-valgrind-local-guests:
- $(top_builddir)/run --test @VG@ ./virt-df -c "$(libvirt_ro_uri)"
+ $(top_builddir)/run --test @VG@ virt-df -c "$(libvirt_ro_uri)"
diff --git a/fuse/test-fuse-umount-race.sh b/fuse/test-fuse-umount-race.sh
index 3c85f17..5d582c4 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 --format=qcow2 -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.
@@ -66,7 +66,7 @@ pid="$(cat test.pid)"
timeout=10
# Unmount the mountpoint.
-./guestunmount -v mp
+guestunmount -v mp
# Wait for guestmount to exit.
count=$timeout
diff --git a/fuse/test-guestmount-fd.c b/fuse/test-guestmount-fd.c
index 3889094..9f302b4 100644
--- a/fuse/test-guestmount-fd.c
+++ b/fuse/test-guestmount-fd.c
@@ -34,8 +34,8 @@
#include "guestfs.h"
#include "guestfs-internal-frontend.h"
-#define GUESTMOUNT_BINARY "./guestmount"
-#define GUESTUNMOUNT_BINARY "./guestunmount"
+#define GUESTMOUNT_BINARY "guestmount"
+#define GUESTUNMOUNT_BINARY "guestunmount"
#define TEST_IMAGE "../test-data/phony-guests/fedora.img"
#define MOUNTPOINT "test-guestmount-fd.d"
#define TEST_FILE MOUNTPOINT "/etc/fstab"
diff --git a/fuse/test-guestunmount-fd.c b/fuse/test-guestunmount-fd.c
index ad7ff74..019f821 100644
--- a/fuse/test-guestunmount-fd.c
+++ b/fuse/test-guestunmount-fd.c
@@ -70,7 +70,7 @@ main (int argc, char *argv[])
snprintf (fd_str, sizeof fd_str, "%d", pipefd[0]);
- execlp ("./guestunmount", "guestunmount",
"--fd", fd_str, "/", NULL);
+ execlp ("guestunmount", "guestunmount",
"--fd", fd_str, "/", NULL);
perror ("execlp");
_exit (EXIT_FAILURE);
}
diff --git a/fuse/test-guestunmount-not-mounted.sh
b/fuse/test-guestunmount-not-mounted.sh
index 5e1febe..7d65dba 100755
--- a/fuse/test-guestunmount-not-mounted.sh
+++ b/fuse/test-guestunmount-not-mounted.sh
@@ -40,7 +40,7 @@ if [ ! -w /dev/fuse ]; then
fi
# Not expecting cwd to be a FUSE mountpoint.
-./guestunmount --quiet $(pwd)
+guestunmount --quiet $(pwd)
r=$?
case $r in
0)
diff --git a/inspector/Makefile.am b/inspector/Makefile.am
index 127bf03..cfb39ba 100644
--- a/inspector/Makefile.am
+++ b/inspector/Makefile.am
@@ -117,5 +117,5 @@ check-valgrind:
check-valgrind-local-guests:
for g in $(GUESTS); do \
- $(top_builddir)/run --test @VG@ ./virt-inspector -c
"$(libvirt_ro_uri)" -d "$$g" || exit $$?; \
+ $(top_builddir)/run --test @VG@ virt-inspector -c
"$(libvirt_ro_uri)" -d "$$g" || exit $$?; \
done
diff --git a/rescue/test-virt-rescue.pl b/rescue/test-virt-rescue.pl
index f149e48..9eaeb4e 100755
--- a/rescue/test-virt-rescue.pl
+++ b/rescue/test-virt-rescue.pl
@@ -32,7 +32,7 @@ unless (exists $INC{"Expect.pm"}) {
}
# Run virt-rescue and make sure we get to the rescue prompt.
-my $exp = Expect->spawn ("./virt-rescue", "--scratch")
+my $exp = Expect->spawn ("virt-rescue", "--scratch")
or die "$progname: Expect could not spawn virt-rescue: $!\n";
my $timeout = 5 * 60;
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index ceb165c..7913484 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -194,12 +194,12 @@ stamp-virt-sysprep.pod: virt-sysprep.pod
sysprep-extra-options.pod sysprep-opera
sysprep-extra-options.pod: virt-sysprep
rm -f $@ $@-t
- $(top_builddir)/run ./$< --dump-pod-options > $@-t
+ $(top_builddir)/run $< --dump-pod-options > $@-t
mv $@-t $@
sysprep-operations.pod: virt-sysprep
rm -f $@ $@-t
- $(top_builddir)/run ./$< --dump-pod > $@-t
+ $(top_builddir)/run $< --dump-pod > $@-t
mv $@-t $@
# Tests.
@@ -226,7 +226,7 @@ check-valgrind:
check-valgrind-local-guests:
for g in $(GUESTS); do \
- $(top_builddir)/run --test @VG@ ./virt-sysprep -n -c
"$(libvirt_ro_uri)" -d "$$g" || exit $$?; \
+ $(top_builddir)/run --test @VG@ virt-sysprep -n -c
"$(libvirt_ro_uri)" -d "$$g" || exit $$?; \
done
# Dependencies.
--
2.5.5
Pino Toscano
2016-May-19 16:57 UTC
[Libguestfs] [PATCH 3/3] fish: generate test-prep.sh with generator
Generate test-prep.sh using the generator, so the prepared disk types
tested are the same as the ones configured in prepopts.ml.
---
.gitignore | 1 +
fish/test-prep.sh | 35 -----------------------------------
generator/fish.ml | 33 +++++++++++++++++++++++++++++++++
generator/fish.mli | 1 +
generator/main.ml | 1 +
5 files changed, 36 insertions(+), 35 deletions(-)
delete mode 100755 fish/test-prep.sh
diff --git a/.gitignore b/.gitignore
index a6be0f0..285b28d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -206,6 +206,7 @@ Makefile.in
/fish/stamp-virt-copy-out.pod
/fish/stamp-virt-tar-in.pod
/fish/stamp-virt-tar-out.pod
+/fish/test-prep.sh
/fish/virt-copy-in.1
/fish/virt-copy-out.1
/fish/virt-tar-in.1
diff --git a/fish/test-prep.sh b/fish/test-prep.sh
deleted file mode 100755
index e2b972a..0000000
--- a/fish/test-prep.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash -
-# libguestfs
-# Copyright (C) 2012 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-set -e
-
-rm -f prep*.img
-
-# It would be nice if we could keep this automatically in sync
-# with the prepared disk types. XXX
-$VG guestfish \
- -N prep1.img=disk \
- -N prep2.img=part \
- -N prep3.img=fs \
- -N prep4.img=lv:/dev/VG1/LV \
- -N prep5.img=lvfs:/dev/VG2/LV \
- -N prep6.img=bootroot \
- -N prep7.img=bootrootlv:/dev/VG3/LV \
- exit
-
-rm prep*.img
diff --git a/generator/fish.ml b/generator/fish.ml
index 646674d..980f55f 100644
--- a/generator/fish.ml
+++ b/generator/fish.ml
@@ -1106,3 +1106,36 @@ event_bitmask_of_event_set (const char *arg, uint64_t
*eventset_r)
return 0;
}
"
+
+and generate_fish_test_prep_sh () + pr "#!/bin/bash -\n";
+ generate_header HashStyle GPLv2plus;
+
+ let all_disks = sprintf "prep{1..%d}.img" (List.length prepopts) in
+
+ pr "\
+set -e
+
+rm -f %s
+
+$VG guestfish \\
+" all_disks;
+
+ let vg_count = ref 0 in
+
+ iteri (
+ fun i (name, _, _, _) ->
+ let params = [name] in
+ let params + if find name "lv" <> -1 then (
+ incr vg_count;
+ sprintf "/dev/VG%d/LV" !vg_count :: params
+ ) else params in
+ let params = List.rev params in
+ pr " -N prep%d.img=%s \\\n" (i + 1) (String.concat
":" params)
+ ) prepopts;
+
+ pr " exit
+
+rm %s
+" all_disks
diff --git a/generator/fish.mli b/generator/fish.mli
index c654bf6..bb4376a 100644
--- a/generator/fish.mli
+++ b/generator/fish.mli
@@ -26,3 +26,4 @@ val generate_fish_event_names : unit -> unit
val generate_fish_prep_options_c : unit -> unit
val generate_fish_prep_options_h : unit -> unit
val generate_fish_prep_options_pod : unit -> unit
+val generate_fish_test_prep_sh : unit -> unit
diff --git a/generator/main.ml b/generator/main.ml
index 8d08d83..91ca4d7 100644
--- a/generator/main.ml
+++ b/generator/main.ml
@@ -124,6 +124,7 @@ Run it from the top source directory using the command
output_to "fish/prepopts.c" generate_fish_prep_options_c;
output_to "fish/prepopts.h" generate_fish_prep_options_h;
output_to "fish/guestfish-prepopts.pod"
generate_fish_prep_options_pod;
+ output_to ~perm:0o555 "fish/test-prep.sh"
generate_fish_test_prep_sh;
output_to "ocaml/guestfs.mli" generate_ocaml_mli;
output_to "ocaml/guestfs.ml" generate_ocaml_ml;
output_to "ocaml/guestfs-c-actions.c" generate_ocaml_c;
--
2.5.5
Richard W.M. Jones
2016-May-19 21:49 UTC
Re: [Libguestfs] [PATCH 1/3] tests: specify the image format when possible
This one looks fine, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Richard W.M. Jones
2016-May-19 21:50 UTC
Re: [Libguestfs] [PATCH 2/3] tests: remove remaining relative paths to binaries
This one looks fine, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Richard W.M. Jones
2016-May-19 21:51 UTC
Re: [Libguestfs] [PATCH 3/3] fish: generate test-prep.sh with generator
Yup, all good, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Apparently Analagous Threads
- [PATCH 0/3] misc tests-only changes
- [PATCH v4 2/2] fish: add journal-view command
- [PATCH v5 2/2] fish: add journal-view command (RHBZ#988100)
- [PATCH 1/4] generator: Add interfaces to all modules.
- [PATCH] p2v: tests: Don't fail when test machine has only a single hard disk.