test-virt-resize: Skip this test on 32 bit hosts.
[libguestfs.git] / tools / test-virt-resize.sh
1 #!/bin/bash -
2
3 # virt-resize does not work on 32 bit because of limitations in Perl
4 # so short-circuit this test on a 32 bit host.
5 perl -e 'exit 1 if ~1 == 4294967294' || {
6     echo "$0: Skipping this test on 32 bit."
7     exit 0
8 }
9
10 export LANG=C
11 set -e
12
13 # Test expanding.
14 #
15 # This exercises a number of interesting codepaths including resizing
16 # LV content, handling GPT, and using qcow2 as a target.
17
18 ../fish/guestfish -N bootrootlv:/dev/VG/LV:ext2:ext4:400M:32M:gpt </dev/null
19
20 qemu-img create -f qcow2 test2.img 500M
21 ./virt-resize -d --expand /dev/sda2 --lv-expand /dev/VG/LV test1.img test2.img
22
23 # Test shrinking in a semi-realistic scenario.  Although the disk
24 # image created above contains no data, we will nevertheless use
25 # similar operations to ones that might be used by a real admin.
26
27 ../fish/guestfish -a test1.img <<EOF
28 run
29 resize2fs-size /dev/VG/LV 190M
30 lvresize /dev/VG/LV 190
31 pvresize-size /dev/sda2 200M
32 fsck ext4 /dev/VG/LV
33 EOF
34
35 rm -f test2.img; truncate -s 300M test2.img
36 ./virt-resize -d --shrink /dev/sda2 test1.img test2.img
37
38 rm -f test1.img test2.img