root / tests / qemu-iotests / 052 @ 98289620
History | View | Annotate | Download (1.5 kB)
1 | f95e26dd | Stefan Hajnoczi | #!/bin/bash |
---|---|---|---|
2 | f95e26dd | Stefan Hajnoczi | # |
3 | f95e26dd | Stefan Hajnoczi | # Test bdrv_read/bdrv_write using BDRV_O_SNAPSHOT |
4 | f95e26dd | Stefan Hajnoczi | # |
5 | f95e26dd | Stefan Hajnoczi | # Copyright (C) 2013 Red Hat, Inc. |
6 | f95e26dd | Stefan Hajnoczi | # |
7 | f95e26dd | Stefan Hajnoczi | # This program is free software; you can redistribute it and/or modify |
8 | f95e26dd | Stefan Hajnoczi | # it under the terms of the GNU General Public License as published by |
9 | f95e26dd | Stefan Hajnoczi | # the Free Software Foundation; either version 2 of the License, or |
10 | f95e26dd | Stefan Hajnoczi | # (at your option) any later version. |
11 | f95e26dd | Stefan Hajnoczi | # |
12 | f95e26dd | Stefan Hajnoczi | # This program is distributed in the hope that it will be useful, |
13 | f95e26dd | Stefan Hajnoczi | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | f95e26dd | Stefan Hajnoczi | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | f95e26dd | Stefan Hajnoczi | # GNU General Public License for more details. |
16 | f95e26dd | Stefan Hajnoczi | # |
17 | f95e26dd | Stefan Hajnoczi | # You should have received a copy of the GNU General Public License |
18 | f95e26dd | Stefan Hajnoczi | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | f95e26dd | Stefan Hajnoczi | # |
20 | f95e26dd | Stefan Hajnoczi | |
21 | f95e26dd | Stefan Hajnoczi | # creator |
22 | f95e26dd | Stefan Hajnoczi | owner=stefanha@redhat.com |
23 | f95e26dd | Stefan Hajnoczi | |
24 | f95e26dd | Stefan Hajnoczi | seq=`basename $0` |
25 | f95e26dd | Stefan Hajnoczi | echo "QA output created by $seq" |
26 | f95e26dd | Stefan Hajnoczi | |
27 | f95e26dd | Stefan Hajnoczi | here=`pwd` |
28 | f95e26dd | Stefan Hajnoczi | tmp=/tmp/$$ |
29 | f95e26dd | Stefan Hajnoczi | status=1 # failure is the default! |
30 | f95e26dd | Stefan Hajnoczi | |
31 | f95e26dd | Stefan Hajnoczi | _cleanup() |
32 | f95e26dd | Stefan Hajnoczi | { |
33 | f95e26dd | Stefan Hajnoczi | _cleanup_test_img |
34 | f95e26dd | Stefan Hajnoczi | } |
35 | f95e26dd | Stefan Hajnoczi | trap "_cleanup; exit \$status" 0 1 2 3 15 |
36 | f95e26dd | Stefan Hajnoczi | |
37 | f95e26dd | Stefan Hajnoczi | # get standard environment, filters and checks |
38 | f95e26dd | Stefan Hajnoczi | . ./common.rc |
39 | f95e26dd | Stefan Hajnoczi | . ./common.filter |
40 | f95e26dd | Stefan Hajnoczi | |
41 | f95e26dd | Stefan Hajnoczi | _supported_fmt generic |
42 | f95e26dd | Stefan Hajnoczi | _supported_proto generic |
43 | f95e26dd | Stefan Hajnoczi | _supported_os Linux |
44 | f95e26dd | Stefan Hajnoczi | |
45 | f95e26dd | Stefan Hajnoczi | |
46 | f95e26dd | Stefan Hajnoczi | size=128M |
47 | f95e26dd | Stefan Hajnoczi | _make_test_img $size |
48 | f95e26dd | Stefan Hajnoczi | |
49 | f95e26dd | Stefan Hajnoczi | echo |
50 | f95e26dd | Stefan Hajnoczi | echo "== reading whole image ==" |
51 | f95e26dd | Stefan Hajnoczi | $QEMU_IO -s -c "read 0 $size" $TEST_IMG | _filter_qemu_io |
52 | f95e26dd | Stefan Hajnoczi | |
53 | f95e26dd | Stefan Hajnoczi | echo |
54 | f95e26dd | Stefan Hajnoczi | echo "== writing whole image does not modify image ==" |
55 | f95e26dd | Stefan Hajnoczi | $QEMU_IO -s -c "write -P 0xa 0 $size" $TEST_IMG | _filter_qemu_io |
56 | f95e26dd | Stefan Hajnoczi | $QEMU_IO -c "read -P 0 0 $size" $TEST_IMG | _filter_qemu_io |
57 | f95e26dd | Stefan Hajnoczi | |
58 | f95e26dd | Stefan Hajnoczi | # success, all done |
59 | f95e26dd | Stefan Hajnoczi | echo "*** done" |
60 | f95e26dd | Stefan Hajnoczi | rm -f $seq.full |
61 | f95e26dd | Stefan Hajnoczi | status=0 |