cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From 1b87276ff64d27cf2ab9096f7e18ad0d71ae79ac Mon Sep 17 00:00:00 2001
0a122b
From: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
Date: Tue, 25 Mar 2014 14:23:10 +0100
0a122b
Subject: [PATCH 03/49] qemu-iotests: add cloop input validation tests
0a122b
0a122b
RH-Author: Kevin Wolf <kwolf@redhat.com>
0a122b
Message-id: <1395753835-7591-4-git-send-email-kwolf@redhat.com>
0a122b
Patchwork-id: n/a
0a122b
O-Subject: [virt-devel] [EMBARGOED RHEL-7.0 qemu-kvm PATCH 03/48] qemu-iotests: add cloop input validation tests
0a122b
Bugzilla: 1066691
0a122b
RH-Acked-by: Jeff Cody <jcody@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
From: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
0a122b
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1066691
0a122b
Upstream status: Series embargoed
0a122b
0a122b
Add a cloop format-specific test case. Later patches add tests for
0a122b
input validation to the script.
0a122b
0a122b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
0a122b
Conflicts:
0a122b
tests/qemu-iotests/group
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
---
0a122b
 tests/qemu-iotests/075                             |   53 ++++++++++++++++++++
0a122b
 tests/qemu-iotests/075.out                         |    6 ++
0a122b
 tests/qemu-iotests/group                           |    1 +
0a122b
 .../sample_images/simple-pattern.cloop.bz2         |  Bin 0 -> 488 bytes
0a122b
 4 files changed, 60 insertions(+), 0 deletions(-)
0a122b
 create mode 100755 tests/qemu-iotests/075
0a122b
 create mode 100644 tests/qemu-iotests/075.out
0a122b
 create mode 100644 tests/qemu-iotests/sample_images/simple-pattern.cloop.bz2
0a122b
0a122b
diff --git a/tests/qemu-iotests/075 b/tests/qemu-iotests/075
0a122b
new file mode 100755
0a122b
index 0000000..88ae8bb
0a122b
--- /dev/null
0a122b
+++ b/tests/qemu-iotests/075
0a122b
@@ -0,0 +1,53 @@
0a122b
+#!/bin/bash
0a122b
+#
0a122b
+# cloop format input validation tests
0a122b
+#
0a122b
+# Copyright (C) 2013 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=stefanha@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 cloop
0a122b
+_supported_proto generic
0a122b
+_supported_os Linux
0a122b
+
0a122b
+echo
0a122b
+echo "== check that the first sector can be read =="
0a122b
+_use_sample_img simple-pattern.cloop.bz2
0a122b
+$QEMU_IO -c "read 0 512" $TEST_IMG 2>&1 | _filter_qemu_io | _filter_testdir
0a122b
+
0a122b
+# success, all done
0a122b
+echo "*** done"
0a122b
+rm -f $seq.full
0a122b
+status=0
0a122b
diff --git a/tests/qemu-iotests/075.out b/tests/qemu-iotests/075.out
0a122b
new file mode 100644
0a122b
index 0000000..26661fa
0a122b
--- /dev/null
0a122b
+++ b/tests/qemu-iotests/075.out
0a122b
@@ -0,0 +1,6 @@
0a122b
+QA output created by 075
0a122b
+
0a122b
+== check that the first sector can be read ==
0a122b
+read 512/512 bytes at offset 0
0a122b
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
0a122b
+*** done
0a122b
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
0a122b
index 51e7f58..427818c 100644
0a122b
--- a/tests/qemu-iotests/group
0a122b
+++ b/tests/qemu-iotests/group
0a122b
@@ -71,6 +71,7 @@
0a122b
 067 rw auto
0a122b
 068 rw auto
0a122b
 070 rw auto
0a122b
+075 rw auto
0a122b
 077 rw auto
0a122b
 079 rw auto
0a122b
 082 rw auto quick
0a122b
-- 
0a122b
1.7.1
0a122b