target/arm: Take VSTCR.SW, VTCR.NSW into account in final stage 2 walk
[qemu/ar7.git] / tests / qemu-iotests / 201
blob1b8eb51d8f389e212d0248c71a4336b77bfbe524
1 #!/usr/bin/env bash
2 # group: rw migration quick
4 # Test savevm and loadvm after live migration with postcopy flag
6 # Copyright (C) 2017, IBM Corporation.
8 # This file is derived from tests/qemu-iotests/181 by Kevin Wolf
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 seq=`basename $0`
24 echo "QA output created by $seq"
26 status=1 # failure is the default!
28 MIG_SOCKET="${SOCK_DIR}/migrate"
30 # get standard environment, filters and checks
31 . ./common.rc
32 . ./common.filter
33 . ./common.qemu
35 _cleanup()
37 rm -f "${MIG_SOCKET}"
38 _cleanup_test_img
39 _cleanup_qemu
41 trap "_cleanup; exit \$status" 0 1 2 3 15
43 _supported_fmt qcow2
44 _supported_proto generic
45 _supported_os Linux
47 # Internal snapshots are (currently) impossible with refcount_bits=1,
48 # and generally impossible with external data files
49 _unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
51 size=64M
52 _make_test_img $size
54 echo
55 echo === Starting VMs ===
56 echo
58 qemu_comm_method="monitor"
60 if [ "$IMGOPTSSYNTAX" = "true" ]; then
61 _launch_qemu \
62 -drive "${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,id=disk
63 else
64 _launch_qemu \
65 -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,driver=$IMGFMT,id=disk
67 src=$QEMU_HANDLE
69 if [ "$IMGOPTSSYNTAX" = "true" ]; then
70 _launch_qemu \
71 -drive "${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,id=disk \
72 -incoming "unix:${MIG_SOCKET}"
73 else
74 _launch_qemu \
75 -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,driver=$IMGFMT,id=disk \
76 -incoming "unix:${MIG_SOCKET}"
78 dest=$QEMU_HANDLE
80 echo
81 echo === Set \'migrate_set_capability postcopy-ram on\' and migrate ===
82 echo
84 silent=yes
85 _send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)"
87 qemu_error_no_exit=yes success_or_failure=yes \
88 _send_qemu_cmd $dest '' "(qemu)" "Postcopy is not supported"
89 if [ ${QEMU_STATUS[$dest]} -lt 0 ]; then
90 _send_qemu_cmd $dest '' "(qemu)"
92 _send_qemu_cmd $src 'quit' ""
93 _send_qemu_cmd $dest 'quit' ""
94 wait=1 _cleanup_qemu
96 _notrun 'Postcopy is not supported'
99 _send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)"
100 _send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)"
102 QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \
103 _send_qemu_cmd $src "info migrate" "completed\|failed"
104 silent=yes _send_qemu_cmd $src "" "(qemu)"
106 echo
107 echo === Check if migration was successful ===
108 echo
110 QEMU_COMM_TIMEOUT=1 silent=yes \
111 _send_qemu_cmd $src "info migrate" "completed"
112 silent=yes _send_qemu_cmd $src "" "(qemu)"
114 echo
115 echo === On destination, execute savevm and loadvm ===
116 echo
118 silent=
119 _send_qemu_cmd $dest 'savevm state1' "(qemu)"
120 _send_qemu_cmd $dest 'loadvm state1' "(qemu)"
122 echo
123 echo === Shut down and check image ===
124 echo
126 _send_qemu_cmd $src 'quit' ""
127 _send_qemu_cmd $dest 'quit' ""
128 wait=1 _cleanup_qemu
130 _check_test_img
132 # success, all done
133 echo "*** done"
134 status=0