111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 2*9dd003a9SVladimir Sementsov-Ogievskiy# group: quick 366e6a735SJeff Cody# 466e6a735SJeff Cody# Test legacy and modern option parsing for rbd/ceph. This will not 566e6a735SJeff Cody# actually connect to a ceph server, but rather looks for the appropriate 666e6a735SJeff Cody# error message that indicates we parsed the options correctly. 766e6a735SJeff Cody# 866e6a735SJeff Cody# Copyright (C) 2018 Red Hat, Inc. 966e6a735SJeff Cody# 1066e6a735SJeff Cody# This program is free software; you can redistribute it and/or modify 1166e6a735SJeff Cody# it under the terms of the GNU General Public License as published by 1266e6a735SJeff Cody# the Free Software Foundation; either version 2 of the License, or 1366e6a735SJeff Cody# (at your option) any later version. 1466e6a735SJeff Cody# 1566e6a735SJeff Cody# This program is distributed in the hope that it will be useful, 1666e6a735SJeff Cody# but WITHOUT ANY WARRANTY; without even the implied warranty of 1766e6a735SJeff Cody# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1866e6a735SJeff Cody# GNU General Public License for more details. 1966e6a735SJeff Cody# 2066e6a735SJeff Cody# You should have received a copy of the GNU General Public License 2166e6a735SJeff Cody# along with this program. If not, see <http://www.gnu.org/licenses/>. 2266e6a735SJeff Cody# 2366e6a735SJeff Cody 2466e6a735SJeff Cody# creator 2566e6a735SJeff Codyowner=jcody@redhat.com 2666e6a735SJeff Cody 2766e6a735SJeff Codyseq=`basename $0` 2866e6a735SJeff Codyecho "QA output created by $seq" 2966e6a735SJeff Cody 3066e6a735SJeff Codystatus=1 # failure is the default! 3166e6a735SJeff Cody 3266e6a735SJeff Cody_cleanup() 3366e6a735SJeff Cody{ 3466e6a735SJeff Cody rm "${BOGUS_CONF}" 3566e6a735SJeff Cody} 3666e6a735SJeff Codytrap "_cleanup; exit \$status" 0 1 2 3 15 3766e6a735SJeff Cody 3866e6a735SJeff Cody# get standard environment, filters and checks 3966e6a735SJeff Cody. ./common.rc 4066e6a735SJeff Cody. ./common.filter 4166e6a735SJeff Cody 4266e6a735SJeff Cody_supported_fmt generic 4366e6a735SJeff Cody_supported_proto rbd 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