[Libguestfs] [libnbd PATCH v3 0/2] Implementing NBD_OPT_LIST

Eric Blake eblake at redhat.com
Tue Aug 18 02:09:20 UTC 2020


This is a subset of my v2 posting, but limited to just the
NBD_OPT_LIST handling.  The biggest change since v2 is the addition of
added unit testing in all four language bindings (C, python, ocaml,
golang). The tests require nbdkit built from git on PATH, and may not
be entirely idiomatic, but I at least validated that they catch issues
(for example, adding an exit statement near the end of the test
reliably caused failure).

I'm also working on similar unit testing for opt_go/opt_list; I'm
leaning more towards having opt_go have a completion handler, if only
because opt_list has to have one (with opt_go, you can tell by whether
the state is negotiating vs. ready whether it passed or failed, but
with info, the state is always negotiating either way).  That should
get me to the point of figuring out where my work-in-progress posted
in patches 12-13 of v2 was going wrong.

Eric Blake (2):
  api: Add nbd_opt_list
  api: Add nbd_aio_opt_list

 lib/internal.h                                |  28 +--
 generator/API.ml                              | 152 +++++++---------
 generator/state_machine.ml                    |   4 +-
 generator/states-newstyle-opt-list.c          |  82 ++++-----
 generator/states-newstyle-opt-starttls.c      |   8 +-
 generator/states-newstyle.c                   |   3 +
 generator/states.c                            |  18 +-
 lib/handle.c                                  |  78 +-------
 lib/opt.c                                     |  74 ++++++++
 python/t/220-opt-list.py                      |  64 +++++++
 ocaml/tests/Makefile.am                       |   3 +
 ocaml/tests/test_220_opt_list.ml              |  78 ++++++++
 tests/Makefile.am                             |  11 ++
 tests/meta-base-allocation.sh                 |   4 +-
 tests/newstyle-limited.c                      |  17 +-
 tests/opt-list.c                              | 171 ++++++++++++++++++
 tests/opt-list.sh                             |  44 +++++
 examples/list-exports.c                       |  85 ++++++---
 interop/list-exports.c                        |  77 ++++----
 .gitignore                                    |   1 +
 .../libnbd/libnbd_220_opt_list_test.go        | 110 +++++++++++
 .../libnbd/libnbd_460_block_status_test.go    |   6 +-
 info/nbdinfo.c                                | 106 +++++++----
 23 files changed, 881 insertions(+), 343 deletions(-)
 create mode 100644 python/t/220-opt-list.py
 create mode 100644 ocaml/tests/test_220_opt_list.ml
 create mode 100644 tests/opt-list.c
 create mode 100755 tests/opt-list.sh
 create mode 100644 golang/src/libguestfs.org/libnbd/libnbd_220_opt_list_test.go

-- 
2.28.0




More information about the Libguestfs mailing list