xref: /openbmc/qemu/tests/qemu-iotests/231 (revision 66e6a735)
1*66e6a735SJeff Cody#!/bin/bash
2*66e6a735SJeff Cody#
3*66e6a735SJeff Cody# Test legacy and modern option parsing for rbd/ceph.  This will not
4*66e6a735SJeff Cody# actually connect to a ceph server, but rather looks for the appropriate
5*66e6a735SJeff Cody# error message that indicates we parsed the options correctly.
6*66e6a735SJeff Cody#
7*66e6a735SJeff Cody# Copyright (C) 2018 Red Hat, Inc.
8*66e6a735SJeff Cody#
9*66e6a735SJeff Cody# This program is free software; you can redistribute it and/or modify
10*66e6a735SJeff Cody# it under the terms of the GNU General Public License as published by
11*66e6a735SJeff Cody# the Free Software Foundation; either version 2 of the License, or
12*66e6a735SJeff Cody# (at your option) any later version.
13*66e6a735SJeff Cody#
14*66e6a735SJeff Cody# This program is distributed in the hope that it will be useful,
15*66e6a735SJeff Cody# but WITHOUT ANY WARRANTY; without even the implied warranty of
16*66e6a735SJeff Cody# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*66e6a735SJeff Cody# GNU General Public License for more details.
18*66e6a735SJeff Cody#
19*66e6a735SJeff Cody# You should have received a copy of the GNU General Public License
20*66e6a735SJeff Cody# along with this program.  If not, see <http://www.gnu.org/licenses/>.
21*66e6a735SJeff Cody#
22*66e6a735SJeff Cody
23*66e6a735SJeff Cody# creator
24*66e6a735SJeff Codyowner=jcody@redhat.com
25*66e6a735SJeff Cody
26*66e6a735SJeff Codyseq=`basename $0`
27*66e6a735SJeff Codyecho "QA output created by $seq"
28*66e6a735SJeff Cody
29*66e6a735SJeff Codyhere=`pwd`
30*66e6a735SJeff Codystatus=1	# failure is the default!
31*66e6a735SJeff Cody
32*66e6a735SJeff Cody_cleanup()
33*66e6a735SJeff Cody{
34*66e6a735SJeff Cody    rm "${BOGUS_CONF}"
35*66e6a735SJeff Cody}
36*66e6a735SJeff Codytrap "_cleanup; exit \$status" 0 1 2 3 15
37*66e6a735SJeff Cody
38*66e6a735SJeff Cody# get standard environment, filters and checks
39*66e6a735SJeff Cody. ./common.rc
40*66e6a735SJeff Cody. ./common.filter
41*66e6a735SJeff Cody
42*66e6a735SJeff Cody_supported_fmt generic
43*66e6a735SJeff Cody_supported_proto rbd
44*66e6a735SJeff Cody_supported_os Linux
45*66e6a735SJeff Cody
46*66e6a735SJeff CodyBOGUS_CONF=${TEST_DIR}/ceph-$$.conf
47*66e6a735SJeff Codytouch "${BOGUS_CONF}"
48*66e6a735SJeff Cody
49*66e6a735SJeff Cody_filter_conf()
50*66e6a735SJeff Cody{
51*66e6a735SJeff Cody    sed -e "s#$BOGUS_CONF#BOGUS_CONF#g"
52*66e6a735SJeff Cody}
53*66e6a735SJeff Cody
54*66e6a735SJeff Cody# We expect this to fail, with no monitor ip provided and a null conf file.  Just want it
55*66e6a735SJeff Cody# to fail in the right way.
56*66e6a735SJeff Cody$QEMU_IMG info "json:{'file.driver':'rbd','file.filename':'rbd:rbd/bogus:conf=${BOGUS_CONF}'}" 2>&1 | _filter_conf
57*66e6a735SJeff Cody$QEMU_IMG info "json:{'file.driver':'rbd','file.pool':'rbd','file.image':'bogus','file.conf':'${BOGUS_CONF}'}" 2>&1 | _filter_conf
58*66e6a735SJeff Cody
59*66e6a735SJeff Cody# success, all done
60*66e6a735SJeff Codyecho "*** done"
61*66e6a735SJeff Codyrm -f $seq.full
62*66e6a735SJeff Codystatus=0
63