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