build: Link user-only with crypto random number objects
[qemu/ar7.git] / tests / qemu-iotests / 225
blobfbd7404791838ff9377ebdb38473ab7b5f735522
1 #!/usr/bin/env bash
3 # Test vmdk backing file correlation
5 # Copyright (C) 2018 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=mreitz@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
32 rm -f "$TEST_IMG.not_base"
34 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
37 . ./common.rc
38 . ./common.filter
39 . ./common.qemu
41 # This tests vmdk-specific low-level functionality
42 _supported_fmt vmdk
43 _supported_proto file
44 _supported_os Linux
45 _unsupported_imgopts "subformat=monolithicFlat" \
46 "subformat=twoGbMaxExtentFlat" \
47 "subformat=twoGbMaxExtentSparse"
49 TEST_IMG="$TEST_IMG.base" _make_test_img 1M
50 TEST_IMG="$TEST_IMG.not_base" _make_test_img 1M
51 _make_test_img -b "$TEST_IMG.base"
53 make_opts()
55 node_name=$1
56 filename=$2
57 backing=$3
59 if [ -z "$backing" ]; then
60 backing="null"
61 else
62 backing="'$backing'"
65 echo "{ 'node-name': '$node_name',
66 'driver': 'vmdk',
67 'file': {
68 'driver': 'file',
69 'filename': '$filename'
71 'backing': $backing }"
74 overlay_opts=$(make_opts overlay "$TEST_IMG" backing)
75 base_opts=$(make_opts backing "$TEST_IMG.base")
76 not_base_opts=$(make_opts backing "$TEST_IMG.not_base")
78 not_vmdk_opts="{ 'node-name': 'backing', 'driver': 'null-co' }"
80 echo
81 echo '=== Testing fitting VMDK backing image ==='
82 echo
84 qemu_comm_method=monitor \
85 _launch_qemu -blockdev "$base_opts" -blockdev "$overlay_opts"
87 # Should not return an error
88 _send_qemu_cmd $QEMU_HANDLE 'qemu-io overlay "read 0 512"' 'ops'
90 _cleanup_qemu
93 echo
94 echo '=== Testing unrelated VMDK backing image ==='
95 echo
97 qemu_comm_method=monitor \
98 _launch_qemu -blockdev "$not_base_opts" -blockdev "$overlay_opts"
100 # Should fail (gracefully)
101 _send_qemu_cmd $QEMU_HANDLE 'qemu-io overlay "read 0 512"' 'failed'
103 _cleanup_qemu
106 echo
107 echo '=== Testing non-VMDK backing image ==='
108 echo
110 # FIXME: This is the reason why we have to use two -blockdev
111 # invocations. You can only fully override the backing file options
112 # if you either specify a node reference (as done here) or the new
113 # options contain file.filename (which in this case they do not).
114 # In other cases, file.filename will be set to whatever the image
115 # header of the overlay contains (which we do not want). I consider
116 # this a FIXME because with -blockdev, you cannot specify "partial"
117 # options, so setting file.filename but leaving the rest as specified
118 # by the user does not make sense.
119 qemu_comm_method=monitor \
120 _launch_qemu -blockdev "$not_vmdk_opts" -blockdev "$overlay_opts"
122 # Should fail (gracefully)
123 _send_qemu_cmd $QEMU_HANDLE 'qemu-io overlay "read 0 512"' 'failed'
125 _cleanup_qemu
128 # success, all done
129 echo "*** done"
130 rm -f $seq.full
131 status=0