summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-06-18 13:04:46 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-06-21 13:17:11 +0100
commit5e658a650a690720c712c01ab68dc306f41fa25e (patch)
tree00aedd2bda784d4348145459c74645d7b01efe3a
parent305991b79230fb61cd28e21a9b3d14c1a5177437 (diff)
downloadlibguestfs-5e658a650a690720c712c01ab68dc306f41fa25e.tar.gz
libguestfs-5e658a650a690720c712c01ab68dc306f41fa25e.tar.xz
libguestfs-5e658a650a690720c712c01ab68dc306f41fa25e.zip
tests: Replace truncate command with 'guestfish sparse'.
RHEL 5 didn't have the truncate command, but we can replace: truncate -s SIZE FILE with the roughly equivalent command: guestfish sparse FILE SIZE Cherry picked from commit 39df80dcc0e485e69048bddbf33c259ce532e50d and backported to libguestfs 1.16 branch.
-rwxr-xr-xfish/test-add-domain.sh5
-rwxr-xr-xfish/test-d.sh5
-rwxr-xr-xtests/qemu/qemu-liveness.sh2
-rwxr-xr-xtests/qemu/qemu-snapshot-isolation.sh4
-rwxr-xr-xtests/regressions/rhbz690819.sh2
5 files changed, 12 insertions, 6 deletions
diff --git a/fish/test-add-domain.sh b/fish/test-add-domain.sh
index 85937088..749f3bcd 100755
--- a/fish/test-add-domain.sh
+++ b/fish/test-add-domain.sh
@@ -24,7 +24,10 @@ rm -f test1.img test2.img test3.img test4.img test.xml test.out
cwd="$(pwd)"
-truncate -s 1M test1.img test2.img test3.img test4.img
+./guestfish sparse test1.img 1M
+./guestfish sparse test2.img 1M
+./guestfish sparse test3.img 1M
+./guestfish sparse test4.img 1M
# Libvirt test XML, see libvirt.git/examples/xml/test/testnode.xml
cat > test.xml <<EOF
diff --git a/fish/test-d.sh b/fish/test-d.sh
index 6475ad83..104b8f3b 100755
--- a/fish/test-d.sh
+++ b/fish/test-d.sh
@@ -24,7 +24,10 @@ rm -f test1.img test2.img test3.img test4.img test.xml test.out
cwd="$(pwd)"
-truncate -s 1M test1.img test2.img test3.img test4.img
+./guestfish sparse test1.img 1M
+./guestfish sparse test2.img 1M
+./guestfish sparse test3.img 1M
+./guestfish sparse test4.img 1M
# Libvirt test XML, see libvirt.git/examples/xml/test/testnode.xml
cat > test.xml <<EOF
diff --git a/tests/qemu/qemu-liveness.sh b/tests/qemu/qemu-liveness.sh
index 945b2a29..d95321c7 100755
--- a/tests/qemu/qemu-liveness.sh
+++ b/tests/qemu/qemu-liveness.sh
@@ -24,7 +24,7 @@ set -e
rm -f test1.img
-truncate -s 100M test1.img
+../../fish/guestfish sparse test1.img 100M
test1_md5sum="$(md5sum test1.img | awk '{print $1}')"
../../fish/guestfish <<'EOF'
diff --git a/tests/qemu/qemu-snapshot-isolation.sh b/tests/qemu/qemu-snapshot-isolation.sh
index 70b68392..17e3bab4 100755
--- a/tests/qemu/qemu-snapshot-isolation.sh
+++ b/tests/qemu/qemu-snapshot-isolation.sh
@@ -24,9 +24,9 @@ set -e
rm -f test1.img test2.img test3.img
-truncate -s 100M test1.img
+../../fish/guestfish sparse test1.img 100M
test1_md5sum="$(md5sum test1.img | awk '{print $1}')"
-truncate -s 100M test2.img
+../../fish/guestfish sparse test2.img 100M
test2_md5sum="$(md5sum test2.img | awk '{print $1}')"
qemu-img create -f qcow2 test3.img 100M
test3_md5sum="$(md5sum test3.img | awk '{print $1}')"
diff --git a/tests/regressions/rhbz690819.sh b/tests/regressions/rhbz690819.sh
index ff4430f9..9d8e38ca 100755
--- a/tests/regressions/rhbz690819.sh
+++ b/tests/regressions/rhbz690819.sh
@@ -37,7 +37,7 @@ export LANG=C
rm -f test.img
-truncate -s 100M test.img
+../../fish/guestfish sparse test.img 100M
../../fish/guestfish <<EOF
add-drive-with-if test.img ide