xref: /openbmc/qemu/tests/qemu-iotests/086 (revision 11a82d14)
1*11a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env 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 Wolfstatus=1	# failure is the default!
282fa4c042SKevin Wolf
292fa4c042SKevin Wolf_cleanup()
302fa4c042SKevin Wolf{
312fa4c042SKevin Wolf	_cleanup_test_img
322fa4c042SKevin Wolf}
332fa4c042SKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15
342fa4c042SKevin Wolf
352fa4c042SKevin Wolf# get standard environment, filters and checks
362fa4c042SKevin Wolf. ./common.rc
372fa4c042SKevin Wolf. ./common.filter
382fa4c042SKevin Wolf
39253597d8SFam Zheng_supported_fmt qcow2 raw
404e24ed13SKevin Wolf_supported_proto file
412fa4c042SKevin Wolf_supported_os Linux
422fa4c042SKevin Wolf
438cedcffdSEric Blakerun_qemu_img()
442fa4c042SKevin Wolf{
452fa4c042SKevin Wolf    echo
462fa4c042SKevin Wolf    echo Testing: "$@" | _filter_testdir
472fa4c042SKevin Wolf}
482fa4c042SKevin Wolf
492fa4c042SKevin Wolfsize=128M
502fa4c042SKevin Wolf
512fa4c042SKevin Wolf_make_test_img $size
52cc8a7e56SJeff Cody$QEMU_IO -c 'write 0 1M' "$TEST_IMG" | _filter_qemu_io
53cc8a7e56SJeff Cody$QEMU_IO -c 'write 2M 1M' "$TEST_IMG" | _filter_qemu_io
54cc8a7e56SJeff Cody$QEMU_IO -c 'write 4M 1M' "$TEST_IMG" | _filter_qemu_io
55cc8a7e56SJeff Cody$QEMU_IO -c 'write 32M 1M' "$TEST_IMG" | _filter_qemu_io
562fa4c042SKevin Wolf
572fa4c042SKevin Wolf$QEMU_IMG convert -p -O $IMGFMT -f $IMGFMT "$TEST_IMG" "$TEST_IMG".base  2>&1 |\
582fa4c042SKevin Wolf    _filter_testdir | sed -e 's/\r/\n/g'
592fa4c042SKevin Wolf
602fa4c042SKevin Wolf# success, all done
612fa4c042SKevin Wolfecho "*** done"
622fa4c042SKevin Wolfrm -f $seq.full
632fa4c042SKevin Wolfstatus=0
64