xref: /openbmc/qemu/tests/qemu-iotests/120 (revision 4d7f853ff0054989a4f20f1f22d1ec489c669c3b)
1a68197ffSMax Reitz#!/bin/bash
2a68197ffSMax Reitz#
3a68197ffSMax Reitz# Non-NBD test cases for overriding BDRV_O_PROTOCOL by explicitly
4a68197ffSMax Reitz# specifying a driver
5a68197ffSMax Reitz#
6a68197ffSMax Reitz# Copyright (C) 2015 Red Hat, Inc.
7a68197ffSMax Reitz#
8a68197ffSMax Reitz# This program is free software; you can redistribute it and/or modify
9a68197ffSMax Reitz# it under the terms of the GNU General Public License as published by
10a68197ffSMax Reitz# the Free Software Foundation; either version 2 of the License, or
11a68197ffSMax Reitz# (at your option) any later version.
12a68197ffSMax Reitz#
13a68197ffSMax Reitz# This program is distributed in the hope that it will be useful,
14a68197ffSMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of
15a68197ffSMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16a68197ffSMax Reitz# GNU General Public License for more details.
17a68197ffSMax Reitz#
18a68197ffSMax Reitz# You should have received a copy of the GNU General Public License
19a68197ffSMax Reitz# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20a68197ffSMax Reitz#
21a68197ffSMax Reitz
22a68197ffSMax Reitz# creator
23a68197ffSMax Reitzowner=mreitz@redhat.com
24a68197ffSMax Reitz
25a68197ffSMax Reitzseq="$(basename $0)"
26a68197ffSMax Reitzecho "QA output created by $seq"
27a68197ffSMax Reitz
28a68197ffSMax Reitzhere="$PWD"
29a68197ffSMax Reitztmp=/tmp/$$
30a68197ffSMax Reitzstatus=1	# failure is the default!
31a68197ffSMax Reitz
32a68197ffSMax Reitz_cleanup()
33a68197ffSMax Reitz{
34a68197ffSMax Reitz	_cleanup_test_img
35a68197ffSMax Reitz}
36a68197ffSMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15
37a68197ffSMax Reitz
38a68197ffSMax Reitz# get standard environment, filters and checks
39a68197ffSMax Reitz. ./common.rc
40a68197ffSMax Reitz. ./common.filter
41a68197ffSMax Reitz
42a68197ffSMax Reitz_supported_fmt generic
43a68197ffSMax Reitz_supported_proto file
44a68197ffSMax Reitz_supported_os Linux
45a68197ffSMax Reitz
46a68197ffSMax Reitz_make_test_img 64M
47a68197ffSMax Reitz
48a68197ffSMax Reitzecho "{'execute': 'qmp_capabilities'}
49a68197ffSMax Reitz      {'execute': 'human-monitor-command',
50a68197ffSMax Reitz       'arguments': {'command-line': 'qemu-io drv \"write -P 42 0 64k\"'}}
51a68197ffSMax Reitz      {'execute': 'quit'}" \
52*4d7f853fSFam Zheng    | $QEMU -qmp stdio -nographic -nodefaults \
53a68197ffSMax Reitz            -drive id=drv,if=none,file="$TEST_IMG",driver=raw,file.driver=$IMGFMT \
54a68197ffSMax Reitz    | _filter_qmp | _filter_qemu_io
55a68197ffSMax Reitz$QEMU_IO -c 'read -P 42 0 64k' "$TEST_IMG" | _filter_qemu_io
56a68197ffSMax Reitz
57a68197ffSMax Reitz$QEMU_IO_PROG -c 'read -P 42 0 64k' \
58a68197ffSMax Reitz    "json:{'driver': 'raw', 'file': {'driver': '$IMGFMT', 'file': {'filename': '$TEST_IMG'}}}" \
59a68197ffSMax Reitz    | _filter_qemu_io
60a68197ffSMax Reitz
61a68197ffSMax Reitz# success, all done
62a68197ffSMax Reitzecho
63a68197ffSMax Reitzecho '*** done'
64a68197ffSMax Reitzrm -f $seq.full
65a68197ffSMax Reitzstatus=0
66