7 output=$(./virt-df test.img -h)
9 # The output will be slightly different from one machine to another.
10 # So just do some tests to make sure it looks reasonable.
12 # Check title is the first line.
13 if [[ ! $output =~ ^Filesystem[[:space:]]+Size[[:space:]]+Used[[:space:]]+Available[[:space:]]+Use% ]]; then
14 echo "$0: error: no title line"
18 # Check 6 lines (title line + 5 * filesystems).
19 if [ $(echo "$output" | wc -l) -ne 6 ]; then
20 echo "$0: error: not all filesystems were found"
24 # Check /dev/VG/LV[1-3] and /dev/VG/Root were found.
25 if [[ ! $output =~ test.img:/dev/VG/LV1 ]]; then
26 echo "$0: error: filesystem /dev/VG/LV1 was not found"
29 if [[ ! $output =~ test.img:/dev/VG/LV2 ]]; then
30 echo "$0: error: filesystem /dev/VG/LV2 was not found"
33 if [[ ! $output =~ test.img:/dev/VG/LV3 ]]; then
34 echo "$0: error: filesystem /dev/VG/LV3 was not found"
37 if [[ ! $output =~ test.img:/dev/VG/Root ]]; then
38 echo "$0: error: filesystem /dev/VG/Root was not found"
42 # Check /dev/sda1 was found. Might be called /dev/vda1.
43 if [[ ! $output =~ test.img:/dev/[hsv]da1 ]]; then
44 echo "$0: error: filesystem /dev/VG/sda1 was not found"