185 (9d2a09063922757ec3640d93f6b35921ab95b1c2) 185 (ddf2d98a94c8a98a661a217fb629cfd15f4dcec7)
1#!/bin/bash
2#
3# Test exiting qemu while jobs are still running
4#
5# Copyright (C) 2017 Red Hat, Inc.
6#
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

--- 104 unchanged lines hidden (view full) ---

113_send_qemu_cmd $h \
114 "{ 'execute': 'block-commit',
115 'arguments': { 'device': 'disk',
116 'base':'$TEST_IMG.base',
117 'top': '$TEST_IMG.mid',
118 'speed': 65536 } }" \
119 "return"
120
1#!/bin/bash
2#
3# Test exiting qemu while jobs are still running
4#
5# Copyright (C) 2017 Red Hat, Inc.
6#
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

--- 104 unchanged lines hidden (view full) ---

113_send_qemu_cmd $h \
114 "{ 'execute': 'block-commit',
115 'arguments': { 'device': 'disk',
116 'base':'$TEST_IMG.base',
117 'top': '$TEST_IMG.mid',
118 'speed': 65536 } }" \
119 "return"
120
121# If we don't sleep here 'quit' command races with disk I/O
122sleep 0.5
123
121_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
122wait=1 _cleanup_qemu
123
124echo
125echo === Start active commit job and exit qemu ===
126echo
127
128_launch_qemu \
129 -drive file="${TEST_IMG}",cache=$CACHEMODE,driver=$IMGFMT,id=disk
130h=$QEMU_HANDLE
131_send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" 'return'
132
133_send_qemu_cmd $h \
134 "{ 'execute': 'block-commit',
135 'arguments': { 'device': 'disk',
136 'base':'$TEST_IMG.base',
137 'speed': 65536 } }" \
138 "return"
139
124_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
125wait=1 _cleanup_qemu
126
127echo
128echo === Start active commit job and exit qemu ===
129echo
130
131_launch_qemu \
132 -drive file="${TEST_IMG}",cache=$CACHEMODE,driver=$IMGFMT,id=disk
133h=$QEMU_HANDLE
134_send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" 'return'
135
136_send_qemu_cmd $h \
137 "{ 'execute': 'block-commit',
138 'arguments': { 'device': 'disk',
139 'base':'$TEST_IMG.base',
140 'speed': 65536 } }" \
141 "return"
142
143# If we don't sleep here 'quit' command races with disk I/O
144sleep 0.5
145
140_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
141wait=1 _cleanup_qemu
142
143echo
144echo === Start mirror job and exit qemu ===
145echo
146
147_launch_qemu \

--- 30 unchanged lines hidden (view full) ---

178 "{ 'execute': 'drive-backup',
179 'arguments': { 'device': 'disk',
180 'target': '$TEST_IMG.copy',
181 'format': '$IMGFMT',
182 'sync': 'full',
183 'speed': 65536 } }" \
184 "return"
185
146_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
147wait=1 _cleanup_qemu
148
149echo
150echo === Start mirror job and exit qemu ===
151echo
152
153_launch_qemu \

--- 30 unchanged lines hidden (view full) ---

184 "{ 'execute': 'drive-backup',
185 'arguments': { 'device': 'disk',
186 'target': '$TEST_IMG.copy',
187 'format': '$IMGFMT',
188 'sync': 'full',
189 'speed': 65536 } }" \
190 "return"
191
192# If we don't sleep here 'quit' command races with disk I/O
193sleep 0.5
194
186_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
187wait=1 _cleanup_qemu
188
189echo
190echo === Start streaming job and exit qemu ===
191echo
192
193_launch_qemu \
194 -drive file="${TEST_IMG}",cache=$CACHEMODE,driver=$IMGFMT,id=disk
195h=$QEMU_HANDLE
196_send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" 'return'
197
198_send_qemu_cmd $h \
199 "{ 'execute': 'block-stream',
200 'arguments': { 'device': 'disk',
201 'speed': 65536 } }" \
202 "return"
203
195_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
196wait=1 _cleanup_qemu
197
198echo
199echo === Start streaming job and exit qemu ===
200echo
201
202_launch_qemu \
203 -drive file="${TEST_IMG}",cache=$CACHEMODE,driver=$IMGFMT,id=disk
204h=$QEMU_HANDLE
205_send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" 'return'
206
207_send_qemu_cmd $h \
208 "{ 'execute': 'block-stream',
209 'arguments': { 'device': 'disk',
210 'speed': 65536 } }" \
211 "return"
212
213# If we don't sleep here 'quit' command races with disk I/O
214sleep 0.5
215
204_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
205wait=1 _cleanup_qemu
206
207_check_test_img
208
209# success, all done
210echo "*** done"
211rm -f $seq.full
212status=0
216_send_qemu_cmd $h "{ 'execute': 'quit' }" "return"
217wait=1 _cleanup_qemu
218
219_check_test_img
220
221# success, all done
222echo "*** done"
223rm -f $seq.full
224status=0