diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2020-11-25 14:06:39 +0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2020-12-09 13:04:17 -0500 |
commit | e0193568daf1785772c9d97a9825c401d463865f (patch) | |
tree | d79c71e39725aa0d4f687d2837c9d9a470108c6c /subprojects/libvhost-user/link-test.c | |
parent | 0df750e9d3a5fea5e19f4750582121c9293a9d71 (diff) |
libvhost-user: add a simple link test without glib
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20201125100640.366523-8-marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'subprojects/libvhost-user/link-test.c')
-rw-r--r-- | subprojects/libvhost-user/link-test.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/subprojects/libvhost-user/link-test.c b/subprojects/libvhost-user/link-test.c new file mode 100644 index 0000000000..e01d6eb1fa --- /dev/null +++ b/subprojects/libvhost-user/link-test.c @@ -0,0 +1,45 @@ +/* + * A trivial unit test to check linking without glib. A real test suite should + * probably based off libvhost-user-glib instead. + */ +#include <assert.h> +#include <stdlib.h> +#include "libvhost-user.h" + +static void +panic(VuDev *dev, const char *err) +{ + abort(); +} + +static void +set_watch(VuDev *dev, int fd, int condition, + vu_watch_cb cb, void *data) +{ + abort(); +} + +static void +remove_watch(VuDev *dev, int fd) +{ + abort(); +} + +static const VuDevIface iface = { + 0, +}; + +int +main(int argc, const char *argv[]) +{ + bool rc; + uint16_t max_queues = 2; + int socket = 0; + VuDev dev = { 0, }; + + rc = vu_init(&dev, max_queues, socket, panic, NULL, set_watch, remove_watch, &iface); + assert(rc == true); + vu_deinit(&dev); + + return 0; +} |