111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 2*9dd003a9SVladimir Sementsov-Ogievskiy# group: rw auto quick 32fa4c042SKevin Wolf# 42fa4c042SKevin Wolf# Test qemu-img progress output 52fa4c042SKevin Wolf# 62fa4c042SKevin Wolf# Copyright (C) 2014 Red Hat, Inc. 72fa4c042SKevin Wolf# 82fa4c042SKevin Wolf# This program is free software; you can redistribute it and/or modify 92fa4c042SKevin Wolf# it under the terms of the GNU General Public License as published by 102fa4c042SKevin Wolf# the Free Software Foundation; either version 2 of the License, or 112fa4c042SKevin Wolf# (at your option) any later version. 122fa4c042SKevin Wolf# 132fa4c042SKevin Wolf# This program is distributed in the hope that it will be useful, 142fa4c042SKevin Wolf# but WITHOUT ANY WARRANTY; without even the implied warranty of 152fa4c042SKevin Wolf# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 162fa4c042SKevin Wolf# GNU General Public License for more details. 172fa4c042SKevin Wolf# 182fa4c042SKevin Wolf# You should have received a copy of the GNU General Public License 192fa4c042SKevin Wolf# along with this program. If not, see <http://www.gnu.org/licenses/>. 202fa4c042SKevin Wolf# 212fa4c042SKevin Wolf 222fa4c042SKevin Wolf# creator 232fa4c042SKevin Wolfowner=kwolf@redhat.com 242fa4c042SKevin Wolf 252fa4c042SKevin Wolfseq=`basename $0` 262fa4c042SKevin Wolfecho "QA output created by $seq" 272fa4c042SKevin Wolf 282fa4c042SKevin Wolfstatus=1 # failure is the default! 292fa4c042SKevin Wolf 302fa4c042SKevin Wolf_cleanup() 312fa4c042SKevin Wolf{ 322fa4c042SKevin Wolf _cleanup_test_img 332fa4c042SKevin Wolf} 342fa4c042SKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15 352fa4c042SKevin Wolf 362fa4c042SKevin Wolf# get standard environment, filters and checks 372fa4c042SKevin Wolf. ./common.rc 382fa4c042SKevin Wolf. ./common.filter 392fa4c042SKevin Wolf 40253597d8SFam Zheng_supported_fmt qcow2 raw 414e24ed13SKevin Wolf_supported_proto file 422fa4c042SKevin Wolf_supported_os Linux 432fa4c042SKevin Wolf 448cedcffdSEric Blakerun_qemu_img() 452fa4c042SKevin Wolf{ 462fa4c042SKevin Wolf echo 472fa4c042SKevin Wolf echo Testing: "$@" | _filter_testdir 482fa4c042SKevin Wolf} 492fa4c042SKevin Wolf 502fa4c042SKevin Wolfsize=128M 512fa4c042SKevin Wolf 522fa4c042SKevin Wolf_make_test_img $size 53cc8a7e56SJeff Cody$QEMU_IO -c 'write 0 1M' "$TEST_IMG" | _filter_qemu_io 54cc8a7e56SJeff Cody$QEMU_IO -c 'write 2M 1M' "$TEST_IMG" | _filter_qemu_io 55cc8a7e56SJeff Cody$QEMU_IO -c 'write 4M 1M' "$TEST_IMG" | _filter_qemu_io 56cc8a7e56SJeff Cody$QEMU_IO -c 'write 32M 1M' "$TEST_IMG" | _filter_qemu_io 572fa4c042SKevin Wolf 582fa4c042SKevin Wolf$QEMU_IMG convert -p -O $IMGFMT -f $IMGFMT "$TEST_IMG" "$TEST_IMG".base 2>&1 |\ 592fa4c042SKevin Wolf _filter_testdir | sed -e 's/\r/\n/g' 602fa4c042SKevin Wolf 612fa4c042SKevin Wolf# success, all done 622fa4c042SKevin Wolfecho "*** done" 632fa4c042SKevin Wolfrm -f $seq.full 642fa4c042SKevin Wolfstatus=0 65