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