iotests: trivial cleanups
cover iotests: trivial cleanups
The most trivial set of cleanups to iotests common libraries and the 044 test.
Cleber Rosa (4):
qemu-iotests: remove bash shebang from library files
qemu-iotests: remove forceful execution success from library files
qemu-iotests: 044: pass is actually a noop, so remove it
qemu-iotests: 044: remove inaccurate docstring class description
tests/qemu-iotests/044 | 4 ---- tests/qemu-iotests/common.config | 5 ----- tests/qemu-iotests/common.filter | 5 ----- tests/qemu-iotests/common.nbd | 1 - tests/qemu-iotests/common.pattern | 2 -- tests/qemu-iotests/common.qemu | 2 -- tests/qemu-iotests/common.rc | 5 ----- tests/qemu-iotests/common.tls | 2 -- 8 files changed, 26 deletions(-)
Signature · 1 line
2.21.0
PATCH 1/4 qemu-iotests: remove bash shebang from library files
Due to not being able to find a reason to have shebangs on files that are not executable.
--- tests/qemu-iotests/common.config | 2 -- tests/qemu-iotests/common.filter | 2 -- tests/qemu-iotests/common.nbd | 1 - tests/qemu-iotests/common.pattern | 2 -- tests/qemu-iotests/common.qemu | 2 -- tests/qemu-iotests/common.rc | 2 -- tests/qemu-iotests/common.tls | 2 -- 7 files changed, 13 deletions(-)
tests/qemu-iotests/common.config +0 -2
@@ -1,5 +1,3 @@ -#!/usr/bin/env bash -# # Copyright (C) 2009 Red Hat, Inc. # Copyright (c) 2000-2003,2006 Silicon Graphics, Inc. All Rights Reserved. #
tests/qemu-iotests/common.filter +0 -2
@@ -1,5 +1,3 @@ -#!/usr/bin/env bash -# # Copyright (C) 2009 Red Hat, Inc. # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. #
tests/qemu-iotests/common.nbd +0 -1
@@ -1,4 +1,3 @@ -#!/usr/bin/env bash # -*- shell-script-mode -*- # # Helpers for NBD server related config
tests/qemu-iotests/common.pattern +0 -2
@@ -1,5 +1,3 @@ -#!/usr/bin/env bash -# # Copyright (C) 2009 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify
tests/qemu-iotests/common.qemu +0 -2
@@ -1,5 +1,3 @@ -#!/usr/bin/env bash -# # This allows for launching of multiple QEMU instances, with independent # communication possible to each instance. #
tests/qemu-iotests/common.rc +0 -2
@@ -1,5 +1,3 @@ -#!/usr/bin/env bash -# # Copyright (C) 2009 Red Hat, Inc. # Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved. #
tests/qemu-iotests/common.tls +0 -2
@@ -1,5 +1,3 @@ -#!/usr/bin/env bash -# # Helpers for TLS related config # # Copyright (C) 2018 Red Hat, Inc.
Signature · 1 line
2.21.0
Re: [PATCH 1/4] qemu-iotests: remove bash shebang from library files
Quoted 4 lines · Cleber Rosa
Due to not being able to find a reason to have shebangs on files that are not executable.
Signed-off-by Cleber Rosa <[email protected]>
Quoted 10 lines
--- tests/qemu-iotests/common.config | 2 -- tests/qemu-iotests/common.filter | 2 -- tests/qemu-iotests/common.nbd | 1 - tests/qemu-iotests/common.pattern | 2 -- tests/qemu-iotests/common.qemu | 2 -- tests/qemu-iotests/common.rc | 2 -- tests/qemu-iotests/common.tls | 2 -- 7 files changed, 13 deletions(-)
Loss of the shebang changes the mode in which emacs opens the files (from Shell-script[bash] to Conf[space] in my case). I agree that a #! comment is not appropriate for a file that is not executable as a standalone file, but it becomes harder to edit the file correctly unless we replace it with some other way of letting editors realize that the contents of each file is still meant to be consumed by bash.
Something like this would work:
# hey emacs, this file will be sourced by bash: -*- sh -*-
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 1/4] qemu-iotests: remove bash shebang from library files
Quoted 23 lines · Eric Blake
Quoted 4 lines · Cleber Rosa
Due to not being able to find a reason to have shebangs on files that are not executable.
Signed-off-by Cleber Rosa <[email protected]>Quoted 10 lines
--- tests/qemu-iotests/common.config | 2 -- tests/qemu-iotests/common.filter | 2 -- tests/qemu-iotests/common.nbd | 1 - tests/qemu-iotests/common.pattern | 2 -- tests/qemu-iotests/common.qemu | 2 -- tests/qemu-iotests/common.rc | 2 -- tests/qemu-iotests/common.tls | 2 -- 7 files changed, 13 deletions(-)Loss of the shebang changes the mode in which emacs opens the files (from Shell-script[bash] to Conf[space] in my case). I agree that a #! comment is not appropriate for a file that is not executable as a standalone file, but it becomes harder to edit the file correctly unless we replace it with some other way of letting editors realize that the contents of each file is still meant to be consumed by bash.
Quoted 4 lines
Something like this would work:
# hey emacs, this file will be sourced by bash: -*- sh -*-
Yes, good point. Will send that on a v2.
- Cleber.
Quoted 4 lines
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 1/4] qemu-iotests: remove bash shebang from library files
Quoted 24 lines · Cleber Rosa
Quoted 23 lines · Eric Blake
Quoted 4 lines · Cleber Rosa
Due to not being able to find a reason to have shebangs on files that are not executable.
Signed-off-by Cleber Rosa <[email protected]>Quoted 10 lines
--- tests/qemu-iotests/common.config | 2 -- tests/qemu-iotests/common.filter | 2 -- tests/qemu-iotests/common.nbd | 1 - tests/qemu-iotests/common.pattern | 2 -- tests/qemu-iotests/common.qemu | 2 -- tests/qemu-iotests/common.rc | 2 -- tests/qemu-iotests/common.tls | 2 -- 7 files changed, 13 deletions(-)Loss of the shebang changes the mode in which emacs opens the files (from Shell-script[bash] to Conf[space] in my case). I agree that a #! comment is not appropriate for a file that is not executable as a standalone file, but it becomes harder to edit the file correctly unless we replace it with some other way of letting editors realize that the contents of each file is still meant to be consumed by bash.
Quoted 7 lines
Quoted 4 lines
Something like this would work:
# hey emacs, this file will be sourced by bash: -*- sh -*-Yes, good point. Will send that on a v2.
BTW, in addition to that, we may add to .editorconfig something like:
[tests/qemu-iotests/common.*]indent_style = spaceindent_size = 4file_type_emacs = sh
Although I was expecting editorconfig to provide a mode hint for other editors, which doesn't seem to be the case.
Cheers,
- Cleber.
Quoted 6 lines
- Cleber.
Quoted 4 lines
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
PATCH 2/4 qemu-iotests: remove forceful execution success from library files
In reply to Cleber RosaShould not be necessary on files that are not executed standalone.
--- tests/qemu-iotests/common.config | 3 --- tests/qemu-iotests/common.filter | 3 --- tests/qemu-iotests/common.rc | 3 --- 3 files changed, 9 deletions(-)
tests/qemu-iotests/common.config +0 -3
@@ -34,6 +34,3 @@ _optstr_add() echo "$2" fi } - -# make sure this script returns success -true
tests/qemu-iotests/common.filter +0 -3
@@ -221,6 +221,3 @@ _filter_qmp_empty_return() { grep -v '{"return": {}}' } - -# make sure this script returns success -true
tests/qemu-iotests/common.rc +0 -3
@@ -600,6 +600,3 @@ _require_drivers() fi done } - -# make sure this script returns success -true
Signature · 1 line
2.21.0
Re: [PATCH 2/4] qemu-iotests: remove forceful execution success from library files
Quoted 14 lines · Cleber Rosa
Should not be necessary on files that are not executed standalone.
Signed-off-by Cleber Rosa <[email protected]>--- tests/qemu-iotests/common.config | 3 --- tests/qemu-iotests/common.filter | 3 --- tests/qemu-iotests/common.rc | 3 --- 3 files changed, 9 deletions(-)tests/qemu-iotests/common.config +0
-0
tests/qemu-iotests/common.config _optstr_add() · line 39
Quoted 6 lines
tests/qemu-iotests/common.config +0
-3@@ -34,6 +34,3 @@ _optstr_add() echo "$2" fi } - -# make sure this script returns success -true
The exit status of the source command in the caller depends on the last command executed here.
However, you also have the point that if you delete this line, the last command executed is a function definition which is successful (for all 3 files touched). So there is no behavior change in dropping this line.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
PATCH 3/4 qemu-iotests: 044: pass is actually a noop, so remove it
In reply to Cleber Rosa--- tests/qemu-iotests/044 | 3 --- 1 file changed, 3 deletions(-)
tests/qemu-iotests/044 +0 -3
@@ -105,17 +105,14 @@ class TestRefcountTableGrowth(iotests.QMPTestCase): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=512', test_img, '16G') self.preallocate(test_img) - pass def tearDown(self): os.remove(test_img) - pass def test_grow_refcount_table(self): qemu_io('-c', 'write 3800M 1M', test_img) qemu_img_verbose('check' , test_img) - pass if __name__ == '__main__': iotests.main(supported_fmts=['qcow2'],
Signature · 1 line
2.21.0
Re: [PATCH 3/4] qemu-iotests: 044: pass is actually a noop, so remove it
Quoted 4 lines · Cleber Rosa
Signed-off-by Cleber Rosa <[email protected]>--- tests/qemu-iotests/044 | 3 --- 1 file changed, 3 deletions(-)
It's useful when there is nothing else, but here we definitely have something else.
Quoted 24 lines
tests/qemu-iotests/044 +0
-3@@ -105,17 +105,14 @@ class TestRefcountTableGrowth(iotests.QMPTestCase): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=512', test_img, '16G') self.preallocate(test_img) - pass def tearDown(self): os.remove(test_img) - pass def test_grow_refcount_table(self): qemu_io('-c', 'write 3800M 1M', test_img) qemu_img_verbose('check' , test_img) - pass if __name__ == '__main__': iotests.main(supported_fmts=['qcow2'],
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 3/4] qemu-iotests: 044: pass is actually a noop, so remove it
In reply to Cleber RosaQuoted 1 line · Cleber Rosa
Signed-off-by Cleber Rosa <[email protected]>
PATCH 4/4 qemu-iotests: 044: remove inaccurate docstring class description
In reply to Cleber Rosa--- tests/qemu-iotests/044 | 1 - 1 file changed, 1 deletion(-)
tests/qemu-iotests/044 +0 -1
@@ -34,7 +34,6 @@ if sys.version_info.major == 2: test_img = os.path.join(iotests.test_dir, 'test.img') class TestRefcountTableGrowth(iotests.QMPTestCase): - '''Abstract base class for image mirroring test cases''' def preallocate(self, name): fd = open(name, "r+b")
Signature · 1 line
2.21.0
Re: [PATCH 4/4] qemu-iotests: 044: remove inaccurate docstring class description
Quoted 10 lines · Cleber Rosa
Signed-off-by Cleber Rosa <[email protected]>--- tests/qemu-iotests/044 | 1 - 1 file changed, 1 deletion(-)tests/qemu-iotests/044 +0
-0
tests/qemu-iotests/044 if sys.version_info.major == 2: · line 37
Quoted 5 lines
tests/qemu-iotests/044 +0
-1@@ -34,7 +34,6 @@ if sys.version_info.major == 2: test_img = os.path.join(iotests.test_dir, 'test.img') class TestRefcountTableGrowth(iotests.QMPTestCase): - '''Abstract base class for image mirroring test cases'''
Should we replace it with something useful? But this isn't meant to be reused outside this test, so it doesn't hurt to have no documentation.
Quoted 3 lines
tests/qemu-iotests/044 +0
-0def preallocate(self, name): fd = open(name, "r+b")
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH 4/4] qemu-iotests: 044: remove inaccurate docstring class description
In reply to Cleber RosaQuoted 11 lines · Cleber Rosa
Signed-off-by Cleber Rosa <[email protected]>--- tests/qemu-iotests/044 | 1 - 1 file changed, 1 deletion(-)tests/qemu-iotests/044 +0
-0
tests/qemu-iotests/044 if sys.version_info.major == 2: · line 39
Quoted 7 lines
tests/qemu-iotests/044 +0
-1@@ -34,7 +34,6 @@ if sys.version_info.major == 2: test_img = os.path.join(iotests.test_dir, 'test.img') class TestRefcountTableGrowth(iotests.QMPTestCase): - '''Abstract base class for image mirroring test cases''' def preallocate(self, name): fd = open(name, "r+b")
Quoted 9 lines · Cleber Rosa
The most trivial set of cleanups to iotests common libraries and the 044 test.
Cleber Rosa (4):
qemu-iotests: remove bash shebang from library files
qemu-iotests: remove forceful execution success from library files
qemu-iotests: 044: pass is actually a noop, so remove it
qemu-iotests: 044: remove inaccurate docstring class description
Quoted 9 lines
tests/qemu-iotests/044 | 4 ---- tests/qemu-iotests/common.config | 5 ----- tests/qemu-iotests/common.filter | 5 ----- tests/qemu-iotests/common.nbd | 1 - tests/qemu-iotests/common.pattern | 2 -- tests/qemu-iotests/common.qemu | 2 -- tests/qemu-iotests/common.rc | 5 ----- tests/qemu-iotests/common.tls | 2 -- 8 files changed, 26 deletions(-)
Looks OK to me, but I’d like to know what you think about Eric’s concern on patch 1.
Max
Quoted 20 lines · Max Reitz
Quoted 9 lines · Cleber Rosa
The most trivial set of cleanups to iotests common libraries and the 044 test.
Cleber Rosa (4):
qemu-iotests: remove bash shebang from library files
qemu-iotests: remove forceful execution success from library files
qemu-iotests: 044: pass is actually a noop, so remove it
qemu-iotests: 044: remove inaccurate docstring class descriptionQuoted 9 lines
tests/qemu-iotests/044 | 4 ---- tests/qemu-iotests/common.config | 5 ----- tests/qemu-iotests/common.filter | 5 ----- tests/qemu-iotests/common.nbd | 1 - tests/qemu-iotests/common.pattern | 2 -- tests/qemu-iotests/common.qemu | 2 -- tests/qemu-iotests/common.rc | 5 ----- tests/qemu-iotests/common.tls | 2 -- 8 files changed, 26 deletions(-)
Quoted 5 lines
Looks OK to me, but I’d like to know what you think about Eric’s concern on patch 1.
Max
Yep, I agree with Eric's point. Will send a v2 shortly.
Thanks,
- Cleber.