[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 49/65] libvhost-user: add a simple link test without glib
From: |
Michael S. Tsirkin |
Subject: |
[PULL v2 49/65] libvhost-user: add a simple link test without glib |
Date: |
Wed, 9 Dec 2020 13:10:22 -0500 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
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>
---
subprojects/libvhost-user/link-test.c | 45 +++++++++++++++++++++++++++
subprojects/libvhost-user/meson.build | 4 +++
2 files changed, 49 insertions(+)
create mode 100644 subprojects/libvhost-user/link-test.c
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;
+}
diff --git a/subprojects/libvhost-user/meson.build
b/subprojects/libvhost-user/meson.build
index f9ecc534cf..c5d85c11d7 100644
--- a/subprojects/libvhost-user/meson.build
+++ b/subprojects/libvhost-user/meson.build
@@ -10,6 +10,10 @@ vhost_user = static_library('vhost-user',
include_directories: inc,
c_args: '-D_GNU_SOURCE')
+executable('link-test', files('link-test.c'),
+ link_whole: vhost_user,
+ include_directories: inc)
+
vhost_user_glib = static_library('vhost-user-glib',
files('libvhost-user-glib.c'),
include_directories: inc,
--
MST
- [PULL v2 41/65] failover: simplify failover_unplug_primary, (continued)
- [PULL v2 41/65] failover: simplify failover_unplug_primary, Michael S. Tsirkin, 2020/12/09
- [PULL v2 43/65] hw: add compat machines for 6.0, Michael S. Tsirkin, 2020/12/09
- [PULL v2 44/65] libvhost-user: replace qemu/bswap.h with glibc endian.h, Michael S. Tsirkin, 2020/12/09
- [PULL v2 45/65] libvhost-user: replace qemu/memfd.h usage, Michael S. Tsirkin, 2020/12/09
- [PULL v2 46/65] libvhost-user: remove qemu/compiler.h usage, Michael S. Tsirkin, 2020/12/09
- [PULL v2 47/65] libvhost-user: drop qemu/osdep.h dependency, Michael S. Tsirkin, 2020/12/09
- [PULL v2 48/65] libvhost-user: make it a meson subproject, Michael S. Tsirkin, 2020/12/09
- [PULL v2 49/65] libvhost-user: add a simple link test without glib,
Michael S. Tsirkin <=
- [PULL v2 51/65] contrib/vhost-user-blk: avoid g_return_val_if() input validation, Michael S. Tsirkin, 2020/12/09
- [PULL v2 50/65] .gitlab-ci: add build-libvhost-user, Michael S. Tsirkin, 2020/12/09
- [PULL v2 52/65] contrib/vhost-user-gpu: avoid g_return_val_if() input validation, Michael S. Tsirkin, 2020/12/09
- [PULL v2 53/65] contrib/vhost-user-input: avoid g_return_val_if() input validation, Michael S. Tsirkin, 2020/12/09
- [PULL v2 55/65] hw/i386/pc: add max combined fw size as machine configuration option, Michael S. Tsirkin, 2020/12/09
- [PULL v2 54/65] block/export: avoid g_return_val_if() input validation, Michael S. Tsirkin, 2020/12/09
- [PULL v2 56/65] acpi: cpuhp: introduce 'firmware performs eject' status/control bits, Michael S. Tsirkin, 2020/12/09
- [PULL v2 57/65] x86: acpi: introduce AcpiPmInfo::smi_on_cpu_unplug, Michael S. Tsirkin, 2020/12/09
- [PULL v2 58/65] tests/acpi: allow expected files change, Michael S. Tsirkin, 2020/12/09
- [PULL v2 59/65] x86: acpi: let the firmware handle pending "CPU remove" events in SMM, Michael S. Tsirkin, 2020/12/09