qemu

FORK: QEMU emulator
git clone https://git.neptards.moe/neptards/qemu.git
Log | Files | Refs | Submodules | LICENSE

link-test.c (770B)


      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 
      9 static void
     10 panic(VuDev *dev, const char *err)
     11 {
     12     abort();
     13 }
     14 
     15 static void
     16 set_watch(VuDev *dev, int fd, int condition,
     17           vu_watch_cb cb, void *data)
     18 {
     19     abort();
     20 }
     21 
     22 static void
     23 remove_watch(VuDev *dev, int fd)
     24 {
     25     abort();
     26 }
     27 
     28 static const VuDevIface iface = {
     29     0,
     30 };
     31 
     32 int
     33 main(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 }