6 # Engage in some montecarlo testing of virt-make-fs.
7 case $((RANDOM % 4)) in
8 0) type="--type=ext2" ;;
9 1) type="--type=ext3" ;;
10 2) type="--type=ext4" ;;
11 3) type="--type=ntfs" ;;
12 # Can't test vfat because we cannot create a tar archive
13 # where files are owned by UID:GID 0:0. As a result, tar
14 # in the appliance fails when trying to change the UID of
15 # the files to some non-zero value (not supported by FAT).
16 # 4) type="--type=vfat" ;;
19 case $((RANDOM % 2)) in
20 0) format="--format=raw" ;;
21 1) format="--format=qcow2" ;;
24 case $((RANDOM % 3)) in
25 0) partition="--partition" ;;
26 1) partition="--partition=gpt" ;;
30 case $((RANDOM % 2)) in
32 1) size="--size=+1M" ;;
35 if [ -n "$LIBGUESTFS_DEBUG" ]; then debug=--debug; fi
37 params="$type $format $partition $size $debug"
38 echo "test-virt-make-fs: parameters: $params"
40 rm -f test.file test.tar output.img
42 tarsize=$((RANDOM & 8191))
43 echo "test-virt-make-fs: size of test file: $tarsize KB"
44 dd if=/dev/zero of=test.file bs=1024 count=$tarsize
45 tar -c -f test.tar test.file
48 ./virt-make-fs $params -- test.tar output.img
50 rm test.tar output.img