xref: /openbmc/qemu/tests/qemu-iotests/119 (revision 9dd003a9)
111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash
2*9dd003a9SVladimir Sementsov-Ogievskiy# group: rw quick
3a68197ffSMax Reitz#
4a68197ffSMax Reitz# NBD test case for overriding BDRV_O_PROTOCOL by explicitly specifying
5a68197ffSMax Reitz# 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
24a68197ffSMax Reitzowner=mreitz@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 raw
42a68197ffSMax Reitz_supported_proto nbd
43a68197ffSMax Reitz_supported_os Linux
44a68197ffSMax Reitz
45a68197ffSMax Reitz_make_test_img 64M
46a68197ffSMax Reitz# This should not crash
47a68197ffSMax Reitzecho "{'execute': 'qmp_capabilities'}
48a68197ffSMax Reitz      {'execute': 'human-monitor-command',
49a68197ffSMax Reitz       'arguments': {'command-line': 'qemu-io drv \"read -P 0 0 64k\"'}}
50a68197ffSMax Reitz      {'execute': 'quit'}" \
514d7f853fSFam Zheng    | $QEMU -nographic -drive id=drv,if=none,file="$TEST_IMG",driver=nbd \
52a68197ffSMax Reitz            -qmp stdio -nodefaults \
53a68197ffSMax Reitz    | _filter_qmp | _filter_qemu_io
54a68197ffSMax Reitz
55a68197ffSMax Reitz# success, all done
56a68197ffSMax Reitzecho
57a68197ffSMax Reitzecho '*** done'
58a68197ffSMax Reitzrm -f $seq.full
59a68197ffSMax Reitzstatus=0
60