[v2,01/21] iotests/qcow2.py: Add dump-header-exts
diff mbox series

Message ID 20191015142729.18123-2-mreitz@redhat.com
State New
Headers show
Series
  • iotests: Allow ./check -o data_file
Related show

Commit Message

Max Reitz Oct. 15, 2019, 2:27 p.m. UTC
This is useful for tests that want to whitelist fields from dump-header
(with grep) but still print all header extensions.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/qcow2.py | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Maxim Levitsky Nov. 6, 2019, 3:37 p.m. UTC | #1
On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> This is useful for tests that want to whitelist fields from dump-header
> (with grep) but still print all header extensions.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/qcow2.py | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
> index b392972d1b..d813b4fc81 100755
> --- a/tests/qemu-iotests/qcow2.py
> +++ b/tests/qemu-iotests/qcow2.py
> @@ -154,6 +154,10 @@ def cmd_dump_header(fd):
>      h.dump()
>      h.dump_extensions()
>  
> +def cmd_dump_header_exts(fd):
> +    h = QcowHeader(fd)
> +    h.dump_extensions()
> +
>  def cmd_set_header(fd, name, value):
>      try:
>          value = int(value, 0)
> @@ -230,6 +234,7 @@ def cmd_set_feature_bit(fd, group, bit):
>  
>  cmds = [
>      [ 'dump-header',          cmd_dump_header,          0, 'Dump image header and header extensions' ],
> +    [ 'dump-header-exts',     cmd_dump_header_exts,     0, 'Dump image header extensions' ],
>      [ 'set-header',           cmd_set_header,           2, 'Set a field in the header'],
>      [ 'add-header-ext',       cmd_add_header_ext,       2, 'Add a header extension' ],
>      [ 'add-header-ext-stdio', cmd_add_header_ext_stdio, 1, 'Add a header extension, data from stdin' ],
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky

Patch
diff mbox series

diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
index b392972d1b..d813b4fc81 100755
--- a/tests/qemu-iotests/qcow2.py
+++ b/tests/qemu-iotests/qcow2.py
@@ -154,6 +154,10 @@  def cmd_dump_header(fd):
     h.dump()
     h.dump_extensions()
 
+def cmd_dump_header_exts(fd):
+    h = QcowHeader(fd)
+    h.dump_extensions()
+
 def cmd_set_header(fd, name, value):
     try:
         value = int(value, 0)
@@ -230,6 +234,7 @@  def cmd_set_feature_bit(fd, group, bit):
 
 cmds = [
     [ 'dump-header',          cmd_dump_header,          0, 'Dump image header and header extensions' ],
+    [ 'dump-header-exts',     cmd_dump_header_exts,     0, 'Dump image header extensions' ],
     [ 'set-header',           cmd_set_header,           2, 'Set a field in the header'],
     [ 'add-header-ext',       cmd_add_header_ext,       2, 'Add a header extension' ],
     [ 'add-header-ext-stdio', cmd_add_header_ext_stdio, 1, 'Add a header extension, data from stdin' ],