1 The real tests use libguestfs as a convenient way to control the qemu
4 To test a plugin using libguestfs:
10 test_start_nbdkit ("plugin", <plugin args ...>, NULL)
12 at the beginning. This starts the nbdkit server.
14 - Open a libguestfs handle, and configure the NBD client using:
16 guestfs_add_drive_opts (g, "",
17 GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
18 GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd",
19 GUESTFS_ADD_DRIVE_OPTS_SERVER, server,
22 'server' is a global that is initialized by 'test_start_nbdkit' and
23 points to the nbdkit server socket.
25 - Perform tests via libguestfs using the libguestfs device "/dev/sda",
26 which corresponds to the NBD drive exposed by the plugin.
28 - Close the handle and exit. An 'atexit' handler installed by
29 'test_start_nbdkit' cleans up the server automatically.
31 For an example, see 'test-file.c'.