diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2013-08-06 15:44:49 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-08-06 15:27:32 +0200 |
commit | 23ea2ecc2a43d850bc9482068201ece5da36a448 (patch) | |
tree | f7b276806cef137b90bd0451f06a1dedffacff59 /tests/qemu-iotests | |
parent | e98768d43799cd3f00b358bfbe455fdae793d3e8 (diff) | |
download | qemu-23ea2ecc2a43d850bc9482068201ece5da36a448.tar.gz qemu-23ea2ecc2a43d850bc9482068201ece5da36a448.tar.bz2 qemu-23ea2ecc2a43d850bc9482068201ece5da36a448.zip |
qemu-iotests: add poke_file utility function
The new poke_file function sets bytes at an offset in a file given a
printf-style format string. It can be used to corrupt an image file for
test coverage of error paths.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qemu-iotests')
-rw-r--r-- | tests/qemu-iotests/common.rc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index e9ba3586b5..5e077c3573 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -34,6 +34,12 @@ dd() fi } +# poke_file 'test.img' 512 '\xff\xfe' +poke_file() +{ + printf "$3" | dd "of=$1" bs=1 "seek=$2" conv=notrunc &>/dev/null +} + # we need common.config if [ "$iam" != "check" ] then |