xref: /openbmc/qemu/tests/qemu-iotests/231 (revision 11a82d14)
1*11a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash
266e6a735SJeff Cody#
366e6a735SJeff Cody# Test legacy and modern option parsing for rbd/ceph.  This will not
466e6a735SJeff Cody# actually connect to a ceph server, but rather looks for the appropriate
566e6a735SJeff Cody# error message that indicates we parsed the options correctly.
666e6a735SJeff Cody#
766e6a735SJeff Cody# Copyright (C) 2018 Red Hat, Inc.
866e6a735SJeff Cody#
966e6a735SJeff Cody# This program is free software; you can redistribute it and/or modify
1066e6a735SJeff Cody# it under the terms of the GNU General Public License as published by
1166e6a735SJeff Cody# the Free Software Foundation; either version 2 of the License, or
1266e6a735SJeff Cody# (at your option) any later version.
1366e6a735SJeff Cody#
1466e6a735SJeff Cody# This program is distributed in the hope that it will be useful,
1566e6a735SJeff Cody# but WITHOUT ANY WARRANTY; without even the implied warranty of
1666e6a735SJeff Cody# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1766e6a735SJeff Cody# GNU General Public License for more details.
1866e6a735SJeff Cody#
1966e6a735SJeff Cody# You should have received a copy of the GNU General Public License
2066e6a735SJeff Cody# along with this program.  If not, see <http://www.gnu.org/licenses/>.
2166e6a735SJeff Cody#
2266e6a735SJeff Cody
2366e6a735SJeff Cody# creator
2466e6a735SJeff Codyowner=jcody@redhat.com
2566e6a735SJeff Cody
2666e6a735SJeff Codyseq=`basename $0`
2766e6a735SJeff Codyecho "QA output created by $seq"
2866e6a735SJeff Cody
2966e6a735SJeff Codystatus=1	# failure is the default!
3066e6a735SJeff Cody
3166e6a735SJeff Cody_cleanup()
3266e6a735SJeff Cody{
3366e6a735SJeff Cody    rm "${BOGUS_CONF}"
3466e6a735SJeff Cody}
3566e6a735SJeff Codytrap "_cleanup; exit \$status" 0 1 2 3 15
3666e6a735SJeff Cody
3766e6a735SJeff Cody# get standard environment, filters and checks
3866e6a735SJeff Cody. ./common.rc
3966e6a735SJeff Cody. ./common.filter
4066e6a735SJeff Cody
4166e6a735SJeff Cody_supported_fmt generic
4266e6a735SJeff Cody_supported_proto rbd
4366e6a735SJeff Cody_supported_os Linux
4466e6a735SJeff Cody
4566e6a735SJeff CodyBOGUS_CONF=${TEST_DIR}/ceph-$$.conf
4666e6a735SJeff Codytouch "${BOGUS_CONF}"
4766e6a735SJeff Cody
4866e6a735SJeff Cody_filter_conf()
4966e6a735SJeff Cody{
5066e6a735SJeff Cody    sed -e "s#$BOGUS_CONF#BOGUS_CONF#g"
5166e6a735SJeff Cody}
5266e6a735SJeff Cody
5366e6a735SJeff Cody# We expect this to fail, with no monitor ip provided and a null conf file.  Just want it
5466e6a735SJeff Cody# to fail in the right way.
5566e6a735SJeff Cody$QEMU_IMG info "json:{'file.driver':'rbd','file.filename':'rbd:rbd/bogus:conf=${BOGUS_CONF}'}" 2>&1 | _filter_conf
5666e6a735SJeff Cody$QEMU_IMG info "json:{'file.driver':'rbd','file.pool':'rbd','file.image':'bogus','file.conf':'${BOGUS_CONF}'}" 2>&1 | _filter_conf
5766e6a735SJeff Cody
5866e6a735SJeff Cody# success, all done
5966e6a735SJeff Codyecho "*** done"
6066e6a735SJeff Codyrm -f $seq.full
6166e6a735SJeff Codystatus=0
62