|
|
9ae3a8 |
From 43e2ea9a31c301e162507a3f656b8719454df086 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 6 Aug 2013 15:44:49 +0800
|
|
|
9ae3a8 |
Subject: [PATCH 03/13] qemu-iotests: add poke_file utility function
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1377573001-27070-4-git-send-email-famz@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 53783
|
|
|
9ae3a8 |
O-Subject: [RHEL-7 qemu-kvm PATCH 03/13] qemu-iotests: add poke_file utility function
|
|
|
9ae3a8 |
Bugzilla: 995866
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The new poke_file function sets bytes at an offset in a file given a
|
|
|
9ae3a8 |
printf-style format string. It can be used to corrupt an image file for
|
|
|
9ae3a8 |
test coverage of error paths.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 23ea2ecc2a43d850bc9482068201ece5da36a448)
|
|
|
9ae3a8 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
tests/qemu-iotests/common.rc | 6 ++++++
|
|
|
9ae3a8 |
1 files changed, 6 insertions(+), 0 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
|
|
|
9ae3a8 |
index 1e9b2f4..1187b86 100644
|
|
|
9ae3a8 |
--- a/tests/qemu-iotests/common.rc
|
|
|
9ae3a8 |
+++ b/tests/qemu-iotests/common.rc
|
|
|
9ae3a8 |
@@ -34,6 +34,12 @@ dd()
|
|
|
9ae3a8 |
fi
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+# poke_file 'test.img' 512 '\xff\xfe'
|
|
|
9ae3a8 |
+poke_file()
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ printf "$3" | dd "of=$1" bs=1 "seek=$2" conv=notrunc &>/dev/null
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
# we need common.config
|
|
|
9ae3a8 |
if [ "$iam" != "check" ]
|
|
|
9ae3a8 |
then
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|