[PATCH 00/14] iotests: ensure all qemu-img calls are either checked or logged

John Snow posted 14 patches 2 years, 1 month ago
Failed in applying to current master (apply log)
tests/qemu-iotests/041                        |   5 +-
tests/qemu-iotests/065                        |   7 +-
tests/qemu-iotests/149                        |   7 +-
tests/qemu-iotests/149.out                    |  21 ---
tests/qemu-iotests/194                        |   4 +-
tests/qemu-iotests/202                        |   4 +-
tests/qemu-iotests/203                        |   4 +-
tests/qemu-iotests/211                        |   6 +-
tests/qemu-iotests/234                        |   4 +-
tests/qemu-iotests/237                        |   3 +-
tests/qemu-iotests/237.out                    |   3 -
tests/qemu-iotests/242                        |   5 +-
tests/qemu-iotests/255                        |   8 +-
tests/qemu-iotests/255.out                    |   4 -
tests/qemu-iotests/262                        |   2 +-
tests/qemu-iotests/274                        |  17 ++-
tests/qemu-iotests/274.out                    |  29 ----
tests/qemu-iotests/280                        |   2 +-
tests/qemu-iotests/280.out                    |   1 -
tests/qemu-iotests/296                        |  12 +-
tests/qemu-iotests/303                        |   2 +-
tests/qemu-iotests/iotests.py                 | 134 +++++++++++++-----
tests/qemu-iotests/tests/block-status-cache   |  11 +-
.../qemu-iotests/tests/parallels-read-bitmap  |   6 +-
.../tests/remove-bitmap-from-backing          |   6 +-
25 files changed, 150 insertions(+), 157 deletions(-)
[PATCH 00/14] iotests: ensure all qemu-img calls are either checked or logged
Posted by John Snow 2 years, 1 month ago
Based-On: 20220308015728.1269649-1-jsnow@redhat.com

Hi, this series ensures all calls to qemu-img ultimately go through
qemu_img(). After the previous series, qemu_img() is a function that
defaults to raising a VerboseProcessError exception when qemu-img
returns a non-zero exit code.

After this series, all qemu-img invocations from the iotests suite are
guaranteed to go through either qemu_img_log(), which allows non-zero
exit codes (but logs its output), or qemu_img().

Some callsites manually disable the error checking with check=False,
which is a good visual reminder directly at the callsite that additional
verification must be performed. The callsites utilizing this are very
few and far between.

The VerboseProcessError exception will print the command line, return
code, and all console output to the terminal if it goes unhandled. In
effect, all non-logging calls to qemu-img are now guaranteed to print
detailed failure information to the terminal on any unanticipated
behavior.

(Even logging calls will still raise this exception if the exit code was
negative, so you get all of the same failure output whenever qemu-img
crashes *anywhere* in iotests now.)

As a result of this change, some of the helpers change. Here's a summary
of the changes between the last series and this one:

qemu_img()                   => qemu_img().returncode
qemu_img_pipe()              => qemu_img().stdout
qemu_img_pipe_and_status()   => qemu_img()
json.loads(qemu_img_pipe())) => qemu_img_json()
qemu_img_log()               => qemu_img_log()

John Snow (14):
  iotests: add qemu_img_json()
  iotests: use qemu_img_json() when applicable
  iotests: add qemu_img_info()
  iotests/remove-bitmap-from-backing: use qemu_img_info()
  iotests: add qemu_img_map() function
  iotests: change supports_quorum to use qemu_img
  iotests: replace unchecked calls to qemu_img_pipe()
  iotests/149: Remove qemu_img_pipe() call
  iotests: remove remaining calls to qemu_img_pipe()
  iotests: use qemu_img() in has_working_luks()
  iotests: replace qemu_img_log('create', ...) calls
  iotests: remove qemu_img_pipe_and_status()
  iotests: make qemu_img_log() check log level
  iotests: make img_info_log() call qemu_img_log()

 tests/qemu-iotests/041                        |   5 +-
 tests/qemu-iotests/065                        |   7 +-
 tests/qemu-iotests/149                        |   7 +-
 tests/qemu-iotests/149.out                    |  21 ---
 tests/qemu-iotests/194                        |   4 +-
 tests/qemu-iotests/202                        |   4 +-
 tests/qemu-iotests/203                        |   4 +-
 tests/qemu-iotests/211                        |   6 +-
 tests/qemu-iotests/234                        |   4 +-
 tests/qemu-iotests/237                        |   3 +-
 tests/qemu-iotests/237.out                    |   3 -
 tests/qemu-iotests/242                        |   5 +-
 tests/qemu-iotests/255                        |   8 +-
 tests/qemu-iotests/255.out                    |   4 -
 tests/qemu-iotests/262                        |   2 +-
 tests/qemu-iotests/274                        |  17 ++-
 tests/qemu-iotests/274.out                    |  29 ----
 tests/qemu-iotests/280                        |   2 +-
 tests/qemu-iotests/280.out                    |   1 -
 tests/qemu-iotests/296                        |  12 +-
 tests/qemu-iotests/303                        |   2 +-
 tests/qemu-iotests/iotests.py                 | 134 +++++++++++++-----
 tests/qemu-iotests/tests/block-status-cache   |  11 +-
 .../qemu-iotests/tests/parallels-read-bitmap  |   6 +-
 .../tests/remove-bitmap-from-backing          |   6 +-
 25 files changed, 150 insertions(+), 157 deletions(-)

-- 
2.34.1