2
0

link-test.c 770 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. static void
  9. panic(VuDev *dev, const char *err)
  10. {
  11. abort();
  12. }
  13. static void
  14. set_watch(VuDev *dev, int fd, int condition,
  15. vu_watch_cb cb, void *data)
  16. {
  17. abort();
  18. }
  19. static void
  20. remove_watch(VuDev *dev, int fd)
  21. {
  22. abort();
  23. }
  24. static const VuDevIface iface = {
  25. 0,
  26. };
  27. int
  28. main(int argc, const char *argv[])
  29. {
  30. bool rc;
  31. uint16_t max_queues = 2;
  32. int socket = 0;
  33. VuDev dev = { 0, };
  34. rc = vu_init(&dev, max_queues, socket, panic, NULL, set_watch, remove_watch, &iface);
  35. assert(rc == true);
  36. vu_deinit(&dev);
  37. return 0;
  38. }