1*11a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 26bf19c94SChristoph Hellwig# 36bf19c94SChristoph Hellwig# Make sure we can open read-only images 46bf19c94SChristoph Hellwig# 56bf19c94SChristoph Hellwig# Regression fixed by commit 11a1feb6552e3a4709e454faea5e3be5ca8d9e6a. 66bf19c94SChristoph Hellwig# 76bf19c94SChristoph Hellwig# Copyright (C) 2009 Red Hat, Inc. 86bf19c94SChristoph Hellwig# 96bf19c94SChristoph Hellwig# This program is free software; you can redistribute it and/or modify 106bf19c94SChristoph Hellwig# it under the terms of the GNU General Public License as published by 116bf19c94SChristoph Hellwig# the Free Software Foundation; either version 2 of the License, or 126bf19c94SChristoph Hellwig# (at your option) any later version. 136bf19c94SChristoph Hellwig# 146bf19c94SChristoph Hellwig# This program is distributed in the hope that it will be useful, 156bf19c94SChristoph Hellwig# but WITHOUT ANY WARRANTY; without even the implied warranty of 166bf19c94SChristoph Hellwig# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 176bf19c94SChristoph Hellwig# GNU General Public License for more details. 186bf19c94SChristoph Hellwig# 196bf19c94SChristoph Hellwig# You should have received a copy of the GNU General Public License 20e8c212d6SChristoph Hellwig# along with this program. If not, see <http://www.gnu.org/licenses/>. 216bf19c94SChristoph Hellwig# 226bf19c94SChristoph Hellwig 236bf19c94SChristoph Hellwig# creator 246bf19c94SChristoph Hellwigowner=hch@lst.de 256bf19c94SChristoph Hellwig 266bf19c94SChristoph Hellwigseq=`basename $0` 276bf19c94SChristoph Hellwigecho "QA output created by $seq" 286bf19c94SChristoph Hellwig 296bf19c94SChristoph Hellwigstatus=1 # failure is the default! 306bf19c94SChristoph Hellwig 316bf19c94SChristoph Hellwig_cleanup() 326bf19c94SChristoph Hellwig{ 336bf19c94SChristoph Hellwig _cleanup_test_img 346bf19c94SChristoph Hellwig} 356bf19c94SChristoph Hellwigtrap "_cleanup; exit \$status" 0 1 2 3 15 366bf19c94SChristoph Hellwig 376bf19c94SChristoph Hellwig# get standard environment, filters and checks 386bf19c94SChristoph Hellwig. ./common.rc 396bf19c94SChristoph Hellwig. ./common.filter 406bf19c94SChristoph Hellwig 416bf19c94SChristoph Hellwig_supported_fmt generic 429cdfa1b3SMORITA Kazutaka_supported_proto file 436bf19c94SChristoph Hellwig_supported_os Linux 446bf19c94SChristoph Hellwig 454e9b25fbSDaniel P. Berrange# Remove once all tests are fixed to use TEST_IMG_FILE 464e9b25fbSDaniel P. Berrange# correctly and common.rc sets it unconditionally 474e9b25fbSDaniel P. Berrangetest -z "$TEST_IMG_FILE" && TEST_IMG_FILE=$TEST_IMG 486bf19c94SChristoph Hellwig 496bf19c94SChristoph Hellwigsize=128M 506bf19c94SChristoph Hellwig_make_test_img $size 516bf19c94SChristoph Hellwig 526bf19c94SChristoph Hellwigecho 536bf19c94SChristoph Hellwigecho "== mark image read-only" 544e9b25fbSDaniel P. Berrangechmod a-w "$TEST_IMG_FILE" 556bf19c94SChristoph Hellwig 566bf19c94SChristoph Hellwigecho 576bf19c94SChristoph Hellwigecho "== read from read-only image" 58fef9c191SJeff Cody$QEMU_IO -r -c "read 0 512" "$TEST_IMG" | _filter_qemu_io 596bf19c94SChristoph Hellwig 606bf19c94SChristoph Hellwig# success, all done 616bf19c94SChristoph Hellwigecho "*** done" 626bf19c94SChristoph Hellwigrm -f $seq.full 636bf19c94SChristoph Hellwigstatus=0 64