qemu/subprojects/libvhost-user/link-test.c
<<
>>
Prefs
   1/*
   2 * A trivial unit test to check linking without glib. A real test suite should
   3 * probably based off libvhost-user-glib instead.
   4 */
   5#include <assert.h>
   6#include <stdlib.h>
   7#include "libvhost-user.h"
   8
   9static void
  10panic(VuDev *dev, const char *err)
  11{
  12    abort();
  13}
  14
  15static void
  16set_watch(VuDev *dev, int fd, int condition,
  17          vu_watch_cb cb, void *data)
  18{
  19    abort();
  20}
  21
  22static void
  23remove_watch(VuDev *dev, int fd)
  24{
  25    abort();
  26}
  27
  28static const VuDevIface iface = {
  29    0,
  30};
  31
  32int
  33main(int argc, const char *argv[])
  34{
  35    bool rc;
  36    uint16_t max_queues = 2;
  37    int socket = 0;
  38    VuDev dev = { 0, };
  39
  40    rc = vu_init(&dev, max_queues, socket, panic, NULL, set_watch, remove_watch, &iface);
  41    assert(rc == true);
  42    vu_deinit(&dev);
  43
  44    return 0;
  45}
  46