xref: /openbmc/qemu/tests/qemu-iotests/120 (revision 68894b5fed671d49587209697f2224b4e857fd1a)
111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash
29dd003a9SVladimir Sementsov-Ogievskiy# group: rw auto quick
3a68197ffSMax Reitz#
4a68197ffSMax Reitz# Non-NBD test cases for overriding BDRV_O_PROTOCOL by explicitly
5a68197ffSMax Reitz# specifying a driver
6a68197ffSMax Reitz#
7a68197ffSMax Reitz# Copyright (C) 2015 Red Hat, Inc.
8a68197ffSMax Reitz#
9a68197ffSMax Reitz# This program is free software; you can redistribute it and/or modify
10a68197ffSMax Reitz# it under the terms of the GNU General Public License as published by
11a68197ffSMax Reitz# the Free Software Foundation; either version 2 of the License, or
12a68197ffSMax Reitz# (at your option) any later version.
13a68197ffSMax Reitz#
14a68197ffSMax Reitz# This program is distributed in the hope that it will be useful,
15a68197ffSMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of
16a68197ffSMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17a68197ffSMax Reitz# GNU General Public License for more details.
18a68197ffSMax Reitz#
19a68197ffSMax Reitz# You should have received a copy of the GNU General Public License
20a68197ffSMax Reitz# along with this program.  If not, see <http://www.gnu.org/licenses/>.
21a68197ffSMax Reitz#
22a68197ffSMax Reitz
23a68197ffSMax Reitz# creator
24*42a5009dSJohn Snowowner=hreitz@redhat.com
25a68197ffSMax Reitz
26a68197ffSMax Reitzseq="$(basename $0)"
27a68197ffSMax Reitzecho "QA output created by $seq"
28a68197ffSMax Reitz
29a68197ffSMax Reitzstatus=1	# failure is the default!
30a68197ffSMax Reitz
31a68197ffSMax Reitz_cleanup()
32a68197ffSMax Reitz{
33a68197ffSMax Reitz	_cleanup_test_img
34a68197ffSMax Reitz}
35a68197ffSMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15
36a68197ffSMax Reitz
37a68197ffSMax Reitz# get standard environment, filters and checks
38a68197ffSMax Reitz. ./common.rc
39a68197ffSMax Reitz. ./common.filter
40a68197ffSMax Reitz
41a68197ffSMax Reitz_supported_fmt generic
4257284d2aSMax Reitz_supported_proto file fuse
4313a1d4a7SDaniel P. Berrange_unsupported_fmt luks
4421b43d00SThomas Huth_require_drivers raw
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'}" \
524d7f853fSFam 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