mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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}')"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -36,7 +36,7 @@ filenames[5]='-hda'
|
||||
|
||||
rm -f -- test1.img "${filenames[@]}"
|
||||
|
||||
truncate -s 10M test1.img
|
||||
../../fish/guestfish sparse test1.img 10M
|
||||
|
||||
for f in "${filenames[@]}"; do
|
||||
ln -- test1.img "$f"
|
||||
|
||||
Reference in New Issue
Block a user