Statistics
| Branch: | Revision:

root / tests / qemu-iotests / 064 @ 9a05feab

History | View | Annotate | Download (2.1 kB)

1 89e91181 Jeff Cody
#!/bin/bash
2 89e91181 Jeff Cody
#
3 89e91181 Jeff Cody
# Test VHDX read/write from a sample image created with Hyper-V
4 89e91181 Jeff Cody
#
5 89e91181 Jeff Cody
# Copyright (C) 2013 Red Hat, Inc.
6 89e91181 Jeff Cody
#
7 89e91181 Jeff Cody
# This program is free software; you can redistribute it and/or modify
8 89e91181 Jeff Cody
# it under the terms of the GNU General Public License as published by
9 89e91181 Jeff Cody
# the Free Software Foundation; either version 2 of the License, or
10 89e91181 Jeff Cody
# (at your option) any later version.
11 89e91181 Jeff Cody
#
12 89e91181 Jeff Cody
# This program is distributed in the hope that it will be useful,
13 89e91181 Jeff Cody
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14 89e91181 Jeff Cody
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 89e91181 Jeff Cody
# GNU General Public License for more details.
16 89e91181 Jeff Cody
#
17 89e91181 Jeff Cody
# You should have received a copy of the GNU General Public License
18 89e91181 Jeff Cody
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 89e91181 Jeff Cody
#
20 89e91181 Jeff Cody
21 89e91181 Jeff Cody
# creator
22 89e91181 Jeff Cody
owner=jcody@redhat.com
23 89e91181 Jeff Cody
24 89e91181 Jeff Cody
seq=`basename $0`
25 89e91181 Jeff Cody
echo "QA output created by $seq"
26 89e91181 Jeff Cody
27 89e91181 Jeff Cody
here=`pwd`
28 89e91181 Jeff Cody
tmp=/tmp/$$
29 89e91181 Jeff Cody
status=1	# failure is the default!
30 89e91181 Jeff Cody
31 89e91181 Jeff Cody
_cleanup()
32 89e91181 Jeff Cody
{
33 89e91181 Jeff Cody
    _cleanup_test_img
34 89e91181 Jeff Cody
}
35 89e91181 Jeff Cody
trap "_cleanup; exit \$status" 0 1 2 3 15
36 89e91181 Jeff Cody
37 89e91181 Jeff Cody
# get standard environment, filters and checks
38 89e91181 Jeff Cody
. ./common.rc
39 89e91181 Jeff Cody
. ./common.filter
40 89e91181 Jeff Cody
41 89e91181 Jeff Cody
_supported_fmt vhdx
42 89e91181 Jeff Cody
_supported_proto generic
43 89e91181 Jeff Cody
_supported_os Linux
44 89e91181 Jeff Cody
45 89e91181 Jeff Cody
_use_sample_img iotest-dynamic-1G.vhdx.bz2
46 89e91181 Jeff Cody
47 89e91181 Jeff Cody
echo
48 89e91181 Jeff Cody
echo "=== Verify pattern 0xa5, 0 - 33MB ==="
49 89e91181 Jeff Cody
$QEMU_IO -r -c "read -pP 0xa5 0 33M" "$TEST_IMG" | _filter_qemu_io
50 89e91181 Jeff Cody
51 89e91181 Jeff Cody
echo
52 89e91181 Jeff Cody
echo "=== Verify pattern 0x96, 33M - 66M ==="
53 89e91181 Jeff Cody
$QEMU_IO -r -c "read -pP 0x96 33M 33M" "$TEST_IMG" | _filter_qemu_io
54 89e91181 Jeff Cody
55 89e91181 Jeff Cody
echo
56 89e91181 Jeff Cody
echo "=== Verify pattern 0x00, 66M - 1024M ==="
57 89e91181 Jeff Cody
$QEMU_IO -r -c "read -pP 0x00 66M 958M" "$TEST_IMG" | _filter_qemu_io
58 89e91181 Jeff Cody
59 751aec24 Jeff Cody
echo
60 751aec24 Jeff Cody
echo "=== Verify pattern write, 0xc3 99M-157M ==="
61 751aec24 Jeff Cody
$QEMU_IO -c "write -pP 0xc3 99M 58M" "$TEST_IMG" | _filter_qemu_io
62 751aec24 Jeff Cody
# first verify we didn't write where we should not have
63 751aec24 Jeff Cody
$QEMU_IO -c "read -pP 0xa5 0 33M" "$TEST_IMG" | _filter_qemu_io
64 751aec24 Jeff Cody
$QEMU_IO -c "read -pP 0x96 33M 33M" "$TEST_IMG" | _filter_qemu_io
65 751aec24 Jeff Cody
$QEMU_IO -c "read -pP 0x00 66M 33M" "$TEST_IMG" | _filter_qemu_io
66 751aec24 Jeff Cody
$QEMU_IO -c "read -pP 0x00 157MM 867MM" "$TEST_IMG" | _filter_qemu_io
67 751aec24 Jeff Cody
# now verify what we should have actually written
68 751aec24 Jeff Cody
$QEMU_IO -c "read -pP 0xc3 99M 58M" "$TEST_IMG" | _filter_qemu_io
69 751aec24 Jeff Cody
70 89e91181 Jeff Cody
# success, all done
71 89e91181 Jeff Cody
echo "*** done"
72 89e91181 Jeff Cody
rm -f $seq.full
73 89e91181 Jeff Cody
status=0