xref: /openbmc/qemu/tests/qemu-iotests/059 (revision f8ce0403)
1ca6cbb65SFam Zheng#!/bin/bash
2ca6cbb65SFam Zheng#
3ca6cbb65SFam Zheng# Test case for vmdk
4ca6cbb65SFam Zheng#
5ca6cbb65SFam Zheng# Copyright (C) 2013 Red Hat, Inc.
6ca6cbb65SFam Zheng#
7ca6cbb65SFam Zheng# This program is free software; you can redistribute it and/or modify
8ca6cbb65SFam Zheng# it under the terms of the GNU General Public License as published by
9ca6cbb65SFam Zheng# the Free Software Foundation; either version 2 of the License, or
10ca6cbb65SFam Zheng# (at your option) any later version.
11ca6cbb65SFam Zheng#
12ca6cbb65SFam Zheng# This program is distributed in the hope that it will be useful,
13ca6cbb65SFam Zheng# but WITHOUT ANY WARRANTY; without even the implied warranty of
14ca6cbb65SFam Zheng# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15ca6cbb65SFam Zheng# GNU General Public License for more details.
16ca6cbb65SFam Zheng#
17ca6cbb65SFam Zheng# You should have received a copy of the GNU General Public License
18ca6cbb65SFam Zheng# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19ca6cbb65SFam Zheng#
20ca6cbb65SFam Zheng
21ca6cbb65SFam Zheng# creator
22ca6cbb65SFam Zhengowner=famz@redhat.com
23ca6cbb65SFam Zheng
24ca6cbb65SFam Zhengseq=`basename $0`
25ca6cbb65SFam Zhengecho "QA output created by $seq"
26ca6cbb65SFam Zheng
27ca6cbb65SFam Zhenghere=`pwd`
28ca6cbb65SFam Zhengtmp=/tmp/$$
29ca6cbb65SFam Zhengstatus=1	# failure is the default!
30ca6cbb65SFam Zheng
31ca6cbb65SFam Zheng_cleanup()
32ca6cbb65SFam Zheng{
33ca6cbb65SFam Zheng	_cleanup_test_img
34ca6cbb65SFam Zheng}
35ca6cbb65SFam Zhengtrap "_cleanup; exit \$status" 0 1 2 3 15
36ca6cbb65SFam Zheng
37ca6cbb65SFam Zheng# get standard environment, filters and checks
38ca6cbb65SFam Zheng. ./common.rc
39ca6cbb65SFam Zheng. ./common.filter
40ca6cbb65SFam Zheng
41ca6cbb65SFam Zheng# This tests vmdk-specific low-level functionality
42ca6cbb65SFam Zheng_supported_fmt vmdk
43ca6cbb65SFam Zheng_supported_proto generic
44ca6cbb65SFam Zheng_supported_os Linux
45ca6cbb65SFam Zheng
468aa1331cSFam Zhenggranularity_offset=20
47*f8ce0403SFam Zhenggrain_table_size_offset=44
488aa1331cSFam Zheng
498aa1331cSFam Zhengecho "=== Testing invalid granularity ==="
508aa1331cSFam Zhengecho
518aa1331cSFam Zheng_make_test_img 64M
528aa1331cSFam Zhengpoke_file "$TEST_IMG" "$granularity_offset" "\xff\xff\xff\xff\xff\xff\xff\xff"
538aa1331cSFam Zheng{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
54ca6cbb65SFam Zheng
55*f8ce0403SFam Zhengecho "=== Testing too big L2 table size ==="
56*f8ce0403SFam Zhengecho
57*f8ce0403SFam Zheng_make_test_img 64M
58*f8ce0403SFam Zhengpoke_file "$TEST_IMG" "$grain_table_size_offset" "\xff\xff\xff\xff"
59*f8ce0403SFam Zheng{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
60*f8ce0403SFam Zheng
61ca6cbb65SFam Zheng# success, all done
62ca6cbb65SFam Zhengecho "*** done"
63ca6cbb65SFam Zhengrm -f $seq.full
64ca6cbb65SFam Zhengstatus=0
65