1*11a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 2a68197ffSMax Reitz# 3a68197ffSMax Reitz# NBD test case for overriding BDRV_O_PROTOCOL by explicitly specifying 4a68197ffSMax Reitz# 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 raw 41a68197ffSMax Reitz_supported_proto nbd 42a68197ffSMax Reitz_supported_os Linux 43a68197ffSMax Reitz 44a68197ffSMax Reitz_make_test_img 64M 45a68197ffSMax Reitz# This should not crash 46a68197ffSMax Reitzecho "{'execute': 'qmp_capabilities'} 47a68197ffSMax Reitz {'execute': 'human-monitor-command', 48a68197ffSMax Reitz 'arguments': {'command-line': 'qemu-io drv \"read -P 0 0 64k\"'}} 49a68197ffSMax Reitz {'execute': 'quit'}" \ 504d7f853fSFam Zheng | $QEMU -nographic -drive id=drv,if=none,file="$TEST_IMG",driver=nbd \ 51a68197ffSMax Reitz -qmp stdio -nodefaults \ 52a68197ffSMax Reitz | _filter_qmp | _filter_qemu_io 53a68197ffSMax Reitz 54a68197ffSMax Reitz# success, all done 55a68197ffSMax Reitzecho 56a68197ffSMax Reitzecho '*** done' 57a68197ffSMax Reitzrm -f $seq.full 58a68197ffSMax Reitzstatus=0 59