Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / qemu-iotests / 192
blobe66e1a4f06af4df4ad739fbb30e4133aadfd73b2
1 #!/usr/bin/env bash
2 # group: rw auto quick
4 # Test NBD export with -incoming (non-shared storage migration use case from
5 # libvirt)
7 # Copyright (C) 2017 Red Hat, Inc.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 # creator
24 owner=fam@euphon.net
26 seq=`basename $0`
27 echo "QA output created by $seq"
29 status=1 # failure is the default!
31 _cleanup()
33 _cleanup_qemu
34 _cleanup_test_img
35 rm -f "$SOCK_DIR/nbd"
37 trap "_cleanup; exit \$status" 0 1 2 3 15
39 # get standard environment, filters and checks
40 . ./common.rc
41 . ./common.filter
42 . ./common.qemu
44 _supported_fmt generic
45 _supported_proto file
47 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
48 _notrun "Requires a PC machine"
51 size=64M
52 _make_test_img $size
54 if test "$IMGOPTSSYNTAX" = "true"
55 then
56 DRIVE_ARG=if=ide,id=drive0,$TEST_IMG
57 else
58 DRIVE_ARG=if=ide,id=drive0,format=$IMGFMT,file=$TEST_IMG
61 qemu_comm_method="monitor"
62 _launch_qemu -drive $DRIVE_ARG -incoming defer
63 h=$QEMU_HANDLE
64 if [ "${VALGRIND_QEMU}" == "y" ]; then
65 QEMU_COMM_TIMEOUT=7
66 else
67 QEMU_COMM_TIMEOUT=1
70 _send_qemu_cmd $h "nbd_server_start unix:$SOCK_DIR/nbd" "(qemu)"
71 _send_qemu_cmd $h "nbd_server_add -w drive0" "(qemu)"
72 _send_qemu_cmd $h "q" "(qemu)"
74 # success, all done
75 echo "*** done"
76 rm -f $seq.full
77 status=0