xref: /openbmc/qemu/tests/qemu-iotests/120 (revision 21b43d004813ae71d964f74e59ff149bb480db73)
111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env 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 Reitzstatus=1	# failure is the default!
29a68197ffSMax Reitz
30a68197ffSMax Reitz_cleanup()
31a68197ffSMax Reitz{
32a68197ffSMax Reitz	_cleanup_test_img
33a68197ffSMax Reitz}
34a68197ffSMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15
35a68197ffSMax Reitz
36a68197ffSMax Reitz# get standard environment, filters and checks
37a68197ffSMax Reitz. ./common.rc
38a68197ffSMax Reitz. ./common.filter
39a68197ffSMax Reitz
40a68197ffSMax Reitz_supported_fmt generic
41a68197ffSMax Reitz_supported_proto file
4213a1d4a7SDaniel P. Berrange_unsupported_fmt luks
43*21b43d00SThomas Huth_require_drivers raw
44a68197ffSMax Reitz
45a68197ffSMax Reitz_make_test_img 64M
46a68197ffSMax Reitz
47a68197ffSMax Reitzecho "{'execute': 'qmp_capabilities'}
48a68197ffSMax Reitz      {'execute': 'human-monitor-command',
49a68197ffSMax Reitz       'arguments': {'command-line': 'qemu-io drv \"write -P 42 0 64k\"'}}
50a68197ffSMax Reitz      {'execute': 'quit'}" \
514d7f853fSFam Zheng    | $QEMU -qmp stdio -nographic -nodefaults \
52a68197ffSMax Reitz            -drive id=drv,if=none,file="$TEST_IMG",driver=raw,file.driver=$IMGFMT \
53a68197ffSMax Reitz    | _filter_qmp | _filter_qemu_io
54a68197ffSMax Reitz$QEMU_IO -c 'read -P 42 0 64k' "$TEST_IMG" | _filter_qemu_io
55a68197ffSMax Reitz
56a68197ffSMax Reitz$QEMU_IO_PROG -c 'read -P 42 0 64k' \
57a68197ffSMax Reitz    "json:{'driver': 'raw', 'file': {'driver': '$IMGFMT', 'file': {'filename': '$TEST_IMG'}}}" \
58a68197ffSMax Reitz    | _filter_qemu_io
59a68197ffSMax Reitz
60a68197ffSMax Reitz# success, all done
61a68197ffSMax Reitzecho
62a68197ffSMax Reitzecho '*** done'
63a68197ffSMax Reitzrm -f $seq.full
64a68197ffSMax Reitzstatus=0
65