1*34250395SMax Reitz#!/bin/bash 2*34250395SMax Reitz# 3*34250395SMax Reitz# Test case for connecting to a non-existing NBD export name 4*34250395SMax Reitz# 5*34250395SMax Reitz# Copyright (C) 2016 Red Hat, Inc. 6*34250395SMax Reitz# 7*34250395SMax Reitz# This program is free software; you can redistribute it and/or modify 8*34250395SMax Reitz# it under the terms of the GNU General Public License as published by 9*34250395SMax Reitz# the Free Software Foundation; either version 2 of the License, or 10*34250395SMax Reitz# (at your option) any later version. 11*34250395SMax Reitz# 12*34250395SMax Reitz# This program is distributed in the hope that it will be useful, 13*34250395SMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of 14*34250395SMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*34250395SMax Reitz# GNU General Public License for more details. 16*34250395SMax Reitz# 17*34250395SMax Reitz# You should have received a copy of the GNU General Public License 18*34250395SMax Reitz# along with this program. If not, see <http://www.gnu.org/licenses/>. 19*34250395SMax Reitz# 20*34250395SMax Reitz 21*34250395SMax Reitz# creator 22*34250395SMax Reitzowner=mreitz@redhat.com 23*34250395SMax Reitz 24*34250395SMax Reitzseq="$(basename $0)" 25*34250395SMax Reitzecho "QA output created by $seq" 26*34250395SMax Reitz 27*34250395SMax Reitzhere="$PWD" 28*34250395SMax Reitztmp=/tmp/$$ 29*34250395SMax Reitzstatus=1 # failure is the default! 30*34250395SMax Reitz 31*34250395SMax Reitz_cleanup() 32*34250395SMax Reitz{ 33*34250395SMax Reitz rm -f "$TEST_DIR/nbd" 34*34250395SMax Reitz} 35*34250395SMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15 36*34250395SMax Reitz 37*34250395SMax Reitz# get standard environment, filters and checks 38*34250395SMax Reitz. ./common.rc 39*34250395SMax Reitz. ./common.filter 40*34250395SMax Reitz. ./common.qemu 41*34250395SMax Reitz 42*34250395SMax Reitz_supported_fmt generic 43*34250395SMax Reitz_supported_proto generic 44*34250395SMax Reitz_supported_os Linux 45*34250395SMax Reitz 46*34250395SMax Reitzkeep_stderr=y \ 47*34250395SMax Reitz_launch_qemu 2> >(_filter_nbd) 48*34250395SMax Reitz 49*34250395SMax Reitz_send_qemu_cmd $QEMU_HANDLE \ 50*34250395SMax Reitz "{ 'execute': 'qmp_capabilities' }" \ 51*34250395SMax Reitz 'return' 52*34250395SMax Reitz 53*34250395SMax Reitz_send_qemu_cmd $QEMU_HANDLE \ 54*34250395SMax Reitz "{ 'execute': 'nbd-server-start', 55*34250395SMax Reitz 'arguments': { 'addr': { 'type': 'unix', 56*34250395SMax Reitz 'data': { 'path': '$TEST_DIR/nbd' }}}}" \ 57*34250395SMax Reitz 'return' 58*34250395SMax Reitz 59*34250395SMax Reitz# This should just result in a client error, not in the server crashing 60*34250395SMax Reitz$QEMU_IO_PROG -f raw -c quit \ 61*34250395SMax Reitz "nbd+unix:///no_such_export?socket=$TEST_DIR/nbd" 2>&1 \ 62*34250395SMax Reitz | _filter_qemu_io | _filter_nbd 63*34250395SMax Reitz 64*34250395SMax Reitz_send_qemu_cmd $QEMU_HANDLE \ 65*34250395SMax Reitz "{ 'execute': 'quit' }" \ 66*34250395SMax Reitz 'return' 67*34250395SMax Reitz 68*34250395SMax Reitzwait=1 _cleanup_qemu 69*34250395SMax Reitz 70*34250395SMax Reitz# success, all done 71*34250395SMax Reitzecho '*** done' 72*34250395SMax Reitzrm -f $seq.full 73*34250395SMax Reitzstatus=0 74