0a122b
From c75a52dd49f8b6f888a21952a30b5e3590093fd7 Mon Sep 17 00:00:00 2001
0a122b
From: Kevin Wolf <kwolf@redhat.com>
0a122b
Date: Mon, 10 Mar 2014 10:33:23 +0100
0a122b
Subject: [PATCH 12/16] qemu-iotests: Test progress output for conversion
0a122b
0a122b
RH-Author: Kevin Wolf <kwolf@redhat.com>
0a122b
Message-id: <1394447603-30527-3-git-send-email-kwolf@redhat.com>
0a122b
Patchwork-id: 58061
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH 2/2] qemu-iotests: Test progress output for conversion
0a122b
Bugzilla: 1073728
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Max Reitz <mreitz@redhat.com>
0a122b
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
(cherry picked from commit 2fa4c042bc55ec10b9ca16163697d02cddd2d768)
0a122b
0a122b
Percentages in the output differ from upstream because RHEL 7 doesnt'
0a122b
have upstream commit 802c3d4c.
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/086     | 65 ++++++++++++++++++++++++++++++++++++++++++++++
0a122b
 tests/qemu-iotests/086.out | 18 +++++++++++++
0a122b
 tests/qemu-iotests/group   |  1 +
0a122b
 3 files changed, 84 insertions(+)
0a122b
 create mode 100755 tests/qemu-iotests/086
0a122b
 create mode 100644 tests/qemu-iotests/086.out
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/086     |   65 ++++++++++++++++++++++++++++++++++++++++++++
0a122b
 tests/qemu-iotests/086.out |   18 ++++++++++++
0a122b
 tests/qemu-iotests/group   |    1 +
0a122b
 3 files changed, 84 insertions(+), 0 deletions(-)
0a122b
 create mode 100755 tests/qemu-iotests/086
0a122b
 create mode 100644 tests/qemu-iotests/086.out
0a122b
0a122b
diff --git a/tests/qemu-iotests/086 b/tests/qemu-iotests/086
0a122b
new file mode 100755
0a122b
index 0000000..48fe85b
0a122b
--- /dev/null
0a122b
+++ b/tests/qemu-iotests/086
0a122b
@@ -0,0 +1,65 @@
0a122b
+#!/bin/bash
0a122b
+#
0a122b
+# Test qemu-img progress output
0a122b
+#
0a122b
+# Copyright (C) 2014 Red Hat, Inc.
0a122b
+#
0a122b
+# This program is free software; you can redistribute it and/or modify
0a122b
+# it under the terms of the GNU General Public License as published by
0a122b
+# the Free Software Foundation; either version 2 of the License, or
0a122b
+# (at your option) any later version.
0a122b
+#
0a122b
+# This program is distributed in the hope that it will be useful,
0a122b
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
0a122b
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0a122b
+# GNU General Public License for more details.
0a122b
+#
0a122b
+# You should have received a copy of the GNU General Public License
0a122b
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
0a122b
+#
0a122b
+
0a122b
+# creator
0a122b
+owner=kwolf@redhat.com
0a122b
+
0a122b
+seq=`basename $0`
0a122b
+echo "QA output created by $seq"
0a122b
+
0a122b
+here=`pwd`
0a122b
+tmp=/tmp/$$
0a122b
+status=1	# failure is the default!
0a122b
+
0a122b
+_cleanup()
0a122b
+{
0a122b
+	_cleanup_test_img
0a122b
+}
0a122b
+trap "_cleanup; exit \$status" 0 1 2 3 15
0a122b
+
0a122b
+# get standard environment, filters and checks
0a122b
+. ./common.rc
0a122b
+. ./common.filter
0a122b
+
0a122b
+_supported_fmt qcow2
0a122b
+_supported_proto file
0a122b
+_supported_os Linux
0a122b
+
0a122b
+function run_qemu_img()
0a122b
+{
0a122b
+    echo
0a122b
+    echo Testing: "$@" | _filter_testdir
0a122b
+}
0a122b
+
0a122b
+size=128M
0a122b
+
0a122b
+_make_test_img $size
0a122b
+$QEMU_IO -c 'write 0 1M' $TEST_IMG | _filter_qemu_io
0a122b
+$QEMU_IO -c 'write 2M 1M' $TEST_IMG | _filter_qemu_io
0a122b
+$QEMU_IO -c 'write 4M 1M' $TEST_IMG | _filter_qemu_io
0a122b
+$QEMU_IO -c 'write 32M 1M' $TEST_IMG | _filter_qemu_io
0a122b
+
0a122b
+$QEMU_IMG convert -p -O $IMGFMT -f $IMGFMT "$TEST_IMG" "$TEST_IMG".base  2>&1 |\
0a122b
+    _filter_testdir | sed -e 's/\r/\n/g'
0a122b
+
0a122b
+# success, all done
0a122b
+echo "*** done"
0a122b
+rm -f $seq.full
0a122b
+status=0
0a122b
diff --git a/tests/qemu-iotests/086.out b/tests/qemu-iotests/086.out
0a122b
new file mode 100644
0a122b
index 0000000..fcf4425
0a122b
--- /dev/null
0a122b
+++ b/tests/qemu-iotests/086.out
0a122b
@@ -0,0 +1,18 @@
0a122b
+QA output created by 086
0a122b
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 
0a122b
+wrote 1048576/1048576 bytes at offset 0
0a122b
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+wrote 1048576/1048576 bytes at offset 2097152
0a122b
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+wrote 1048576/1048576 bytes at offset 4194304
0a122b
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+wrote 1048576/1048576 bytes at offset 33554432
0a122b
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+    (0.00/100%)
0a122b
+    (1.56/100%)
0a122b
+    (3.12/100%)
0a122b
+    (4.69/100%)
0a122b
+    (26.56/100%)
0a122b
+    (100.00/100%)
0a122b
+
0a122b
+*** done
0a122b
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
0a122b
index ee95d6e..51e7f58 100644
0a122b
--- a/tests/qemu-iotests/group
0a122b
+++ b/tests/qemu-iotests/group
0a122b
@@ -74,3 +74,4 @@
0a122b
 077 rw auto
0a122b
 079 rw auto
0a122b
 082 rw auto quick
0a122b
+086 rw auto quick
0a122b
-- 
0a122b
1.7.1
0a122b