docs: Move release notes to their own section.
[nbdkit/ericb.git] / tests / README.tests
blob745ea0b38460d6ae18d7d36fb366fa45467e1707
1 The real tests use libguestfs as a convenient way to control the qemu
2 NBD client.
4 To test a plugin using libguestfs:
6   - #include <test.h>
8   - Call:
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,
20                             -1);
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'.