[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 15/16] iotests: Add peek_file* functions
From: |
Max Reitz |
Subject: |
[PATCH v3 15/16] iotests: Add peek_file* functions |
Date: |
Fri, 11 Oct 2019 17:28:13 +0200 |
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
tests/qemu-iotests/common.rc | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 12b4751848..fa7bae2422 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -53,6 +53,26 @@ poke_file()
printf "$3" | dd "of=$1" bs=1 "seek=$2" conv=notrunc &>/dev/null
}
+# peek_file_le 'test.img' 512 2 => 65534
+peek_file_le()
+{
+ # Wrap in echo $() to strip spaces
+ echo $(od -j"$2" -N"$3" --endian=little -An -vtu"$3" "$1")
+}
+
+# peek_file_be 'test.img' 512 2 => 65279
+peek_file_be()
+{
+ # Wrap in echo $() to strip spaces
+ echo $(od -j"$2" -N"$3" --endian=big -An -vtu"$3" "$1")
+}
+
+# peek_file_raw 'test.img' 512 2 => '\xff\xfe'
+peek_file_raw()
+{
+ dd if="$1" bs=1 skip="$2" count="$3" status=none
+}
+
if ! . ./common.config
then
--
2.21.0
- Re: [PATCH v3 07/16] qcow2: Write v3-compliant snapshot list on upgrade, (continued)
- [PATCH v3 08/16] qcow2: Separate qcow2_check_read_snapshot_table(), Max Reitz, 2019/10/11
- [PATCH v3 09/16] qcow2: Add qcow2_check_fix_snapshot_table(), Max Reitz, 2019/10/11
- [PATCH v3 10/16] qcow2: Fix broken snapshot table entries, Max Reitz, 2019/10/11
- [PATCH v3 11/16] qcow2: Keep track of the snapshot table length, Max Reitz, 2019/10/11
- [PATCH v3 12/16] qcow2: Fix overly long snapshot tables, Max Reitz, 2019/10/11
- [PATCH v3 13/16] qcow2: Repair snapshot table with too many entries, Max Reitz, 2019/10/11
- [PATCH v3 14/16] qcow2: Fix v3 snapshot table entry compliancy, Max Reitz, 2019/10/11
- [PATCH v3 15/16] iotests: Add peek_file* functions,
Max Reitz <=
- [PATCH v3 16/16] iotests: Test qcow2's snapshot table handling, Max Reitz, 2019/10/11
- Re: [PATCH v3 00/16] qcow2: Let check -r all repair some snapshot bits, Max Reitz, 2019/10/28