hw/arm/sbsa-ref: Remove unnecessary check for secure_sysmem == NULL
[qemu/ar7.git] / tests / qemu-iotests / 049
blobc100d30ed07c45a949a9213c71400e08eb3135cf
1 #!/usr/bin/env bash
3 # Check qemu-img option parsing
5 # Copyright (C) 2013 Red Hat, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # creator
22 owner=kwolf@redhat.com
24 seq=`basename $0`
25 echo "QA output created by $seq"
27 status=1 # failure is the default!
29 _cleanup()
31 _cleanup_test_img
33 trap "_cleanup; exit \$status" 0 1 2 3 15
35 # get standard environment, filters and checks
36 . ./common.rc
37 . ./common.filter
39 _supported_fmt qcow2
40 _supported_proto file
42 filter_test_dir()
44 sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
45 -e "s#$TEST_DIR#TEST_DIR#g"
48 test_qemu_img()
50 echo qemu-img "$@" | filter_test_dir
51 $QEMU_IMG "$@" 2>&1 | filter_test_dir
52 echo
55 echo "=== Check correct interpretation of suffixes for image size ==="
56 echo
57 sizes="1024 1024b 1k 1K 1M 1G 1T "
58 sizes+="1024.0 1024.0b 1.5k 1.5K 1.5M 1.5G 1.5T"
60 echo "== 1. Traditional size parameter =="
61 echo
62 for s in $sizes; do
63 test_qemu_img create -f $IMGFMT "$TEST_IMG" $s
64 done
66 echo "== 2. Specifying size via -o =="
67 echo
68 for s in $sizes; do
69 test_qemu_img create -f $IMGFMT -o size=$s "$TEST_IMG"
70 done
72 echo "== 3. Invalid sizes =="
73 echo
74 sizes="-1024 -1k 1kilobyte foobar"
76 for s in $sizes; do
77 test_qemu_img create -f $IMGFMT "$TEST_IMG" -- $s
78 test_qemu_img create -f $IMGFMT -o size=$s "$TEST_IMG"
79 done
81 echo "== Check correct interpretation of suffixes for cluster size =="
82 echo
83 sizes="1024 1024b 1k 1K 1M "
84 sizes+="1024.0 1024.0b 0.5k 0.5K 0.5M"
86 for s in $sizes; do
87 test_qemu_img create -f $IMGFMT -o cluster_size=$s "$TEST_IMG" 64M
88 done
90 echo "== Check compat level option =="
91 echo
92 test_qemu_img create -f $IMGFMT -o compat=0.10 "$TEST_IMG" 64M
93 test_qemu_img create -f $IMGFMT -o compat=1.1 "$TEST_IMG" 64M
95 test_qemu_img create -f $IMGFMT -o compat=0.42 "$TEST_IMG" 64M
96 test_qemu_img create -f $IMGFMT -o compat=foobar "$TEST_IMG" 64M
98 echo "== Check preallocation option =="
99 echo
100 test_qemu_img create -f $IMGFMT -o preallocation=off "$TEST_IMG" 64M
101 test_qemu_img create -f $IMGFMT -o preallocation=metadata "$TEST_IMG" 64M
102 test_qemu_img create -f $IMGFMT -o preallocation=1234 "$TEST_IMG" 64M
104 echo "== Check encryption option =="
105 echo
106 test_qemu_img create -f $IMGFMT -o encryption=off "$TEST_IMG" 64M
107 test_qemu_img create -f $IMGFMT --object secret,id=sec0,data=123456 -o encryption=on,encrypt.key-secret=sec0 "$TEST_IMG" 64M
109 echo "== Check lazy_refcounts option (only with v3) =="
110 echo
111 test_qemu_img create -f $IMGFMT -o compat=1.1,lazy_refcounts=off "$TEST_IMG" 64M
112 test_qemu_img create -f $IMGFMT -o compat=1.1,lazy_refcounts=on "$TEST_IMG" 64M
114 test_qemu_img create -f $IMGFMT -o compat=0.10,lazy_refcounts=off "$TEST_IMG" 64M
115 test_qemu_img create -f $IMGFMT -o compat=0.10,lazy_refcounts=on "$TEST_IMG" 64M
117 # success, all done
118 echo "*** done"
119 rm -f $seq.full
120 status=0