Skip to contentSkip to conversation

vhost-user qtest fixes

PATCH In review Nikolay Nikolaev 4 participants 15 messages Jun 19, 2014 Networking

lore
Share & tools
lore
#0 lore raw

cover vhost-user qtest fixes

The following series enables vhost-user-test in make check.

The first patch adds a new CONFIG_VHOST_NET_USED in configure to be used in net.c to enable vhost-user netdev backend.

Fifth patch fixes an error when calling erro_setg in vhost_dev_init.

---

Nikolay Nikolaev (6):
configure: add new config define CONFIG_VHOST_NET_USED
libqemustub: add more stubs for qemu-char
qtest: fix qtest for vhost-user
qtest: fix vhost-user-test unbalanced mutex locks
vhost: fix migration_blocker initialization
qtest: enable vhost-user-test

 configure                   |    3 +
 hw/virtio/vhost.c           |    3 -
 net/net.c                   |    4 +
 stubs/Makefile.objs         |    2 +
 stubs/chr-baum-init.c       |    7 ++
 stubs/qemu-chr-open-spice.c |   12 ++++
 tests/Makefile              |    6 +-
 tests/vhost-user-test.c     |  128 ++++++++++++++++++++++++++++++++++++++-----
 8 files changed, 143 insertions(+), 22 deletions(-)
 create mode 100644 stubs/chr-baum-init.c
 create mode 100644 stubs/qemu-chr-open-spice.c

--
Signature

#1 lore raw

PATCH 1/6 configure: add new config define CONFIG_VHOST_NET_USED

This will be used in net.c (for now) to enable vhos-user netdev backend.

---
 configure |    3 +++
 net/net.c |    4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)
configure +3 -0
index 9f4ba45..fb3c856 100755
@@ -4543,6 +4543,9 @@ fi
 if test "$vhost_scsi" = "yes" ; then
   echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
 fi
+if test "$vhost_net" = "yes" ; then
+  echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
+fi
 if test "$blobs" = "yes" ; then
   echo "INSTALL_BLOBS=yes" >> $config_host_mak
 fi
net/net.c +2 -2
index 0c30414..3dac29b 100644
@@ -803,7 +803,7 @@ static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
         [NET_CLIENT_OPTIONS_KIND_BRIDGE]    = net_init_bridge,
 #endif
         [NET_CLIENT_OPTIONS_KIND_HUBPORT]   = net_init_hubport,
-#ifdef CONFIG_VHOST_NET
+#ifdef CONFIG_VHOST_NET_USED
         [NET_CLIENT_OPTIONS_KIND_VHOST_USER] = net_init_vhost_user,
 #endif
 };
@@ -839,7 +839,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
         case NET_CLIENT_OPTIONS_KIND_BRIDGE:
 #endif
         case NET_CLIENT_OPTIONS_KIND_HUBPORT:
-#ifdef CONFIG_VHOST_NET
+#ifdef CONFIG_VHOST_NET_USED
         case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
 #endif
             break;
#2 lore raw

Re: [Qemu-devel] [PATCH 1/6] configure: add new config define CONFIG_VHOST_NET_USED

Quoted 3 lines · Nikolay Nikolaev

This will be used in net.c (for now) to enable vhos-user netdev backend.

Did you test this with mingw?

Quoted 41 lines
---
 configure |    3 +++
 net/net.c |    4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)
configure +3 -0
index 9f4ba45..fb3c856 100755
@@ -4543,6 +4543,9 @@ fi
 if test "$vhost_scsi" = "yes" ; then
   echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
 fi
+if test "$vhost_net" = "yes" ; then
+  echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
+fi
 if test "$blobs" = "yes" ; then
   echo "INSTALL_BLOBS=yes" >> $config_host_mak
 fi
net/net.c +2 -2
index 0c30414..3dac29b 100644
@@ -803,7 +803,7 @@ static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
         [NET_CLIENT_OPTIONS_KIND_BRIDGE]    = net_init_bridge,
 #endif
         [NET_CLIENT_OPTIONS_KIND_HUBPORT]   = net_init_hubport,
-#ifdef CONFIG_VHOST_NET
+#ifdef CONFIG_VHOST_NET_USED
         [NET_CLIENT_OPTIONS_KIND_VHOST_USER] = net_init_vhost_user,
 #endif
 };
@@ -839,7 +839,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
         case NET_CLIENT_OPTIONS_KIND_BRIDGE:
 #endif
         case NET_CLIENT_OPTIONS_KIND_HUBPORT:
-#ifdef CONFIG_VHOST_NET
+#ifdef CONFIG_VHOST_NET_USED
         case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
 #endif
             break;
#3 lore raw

Re: [Qemu-devel] [snabb-devel] Re: [PATCH 1/6] configure: add new config define CONFIG_VHOST_NET_USED

Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines · Nikolay Nikolaev

This will be used in net.c (for now) to enable vhos-user netdev backend.

Did you test this with mingw?

No, I didn't manage to setup mingw under linux. But this "vhost_net" should be enabled only for linux in configure. So if I understand it properly, mingw should be safe.

regards,
Nikolay Nikolaev

Quoted 53 lines

net/net.c static int (* const

Quoted 25 lines
---
 configure |    3 +++
 net/net.c |    4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)
configure +3 -0
index 9f4ba45..fb3c856 100755
@@ -4543,6 +4543,9 @@ fi
 if test "$vhost_scsi" = "yes" ; then
   echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
 fi
+if test "$vhost_net" = "yes" ; then
+  echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
+fi
 if test "$blobs" = "yes" ; then
   echo "INSTALL_BLOBS=yes" >> $config_host_mak
 fi
net/net.c +0 -0
index 0c30414..3dac29b 100644
@@ -803,7 +803,7 @@ static int (* const

net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(

net/net.c static int net_client_init1(const void *object, int

Quoted 9 lines
net/net.c +1 -1
         [NET_CLIENT_OPTIONS_KIND_BRIDGE]    = net_init_bridge,
 #endif
         [NET_CLIENT_OPTIONS_KIND_HUBPORT]   = net_init_hubport,
-#ifdef CONFIG_VHOST_NET
+#ifdef CONFIG_VHOST_NET_USED
         [NET_CLIENT_OPTIONS_KIND_VHOST_USER] = net_init_vhost_user,
 #endif
 };
@@ -839,7 +839,7 @@ static int net_client_init1(const void *object, int

is_netdev, Error **errp)

net/net.c static int net_client_init1(const void *object, int is_netdev, Error **errp) · line 845

Quoted 8 lines
net/net.c +1 -1
         case NET_CLIENT_OPTIONS_KIND_BRIDGE:
 #endif
         case NET_CLIENT_OPTIONS_KIND_HUBPORT:
-#ifdef CONFIG_VHOST_NET
+#ifdef CONFIG_VHOST_NET_USED
         case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
 #endif
             break;

--
You received this message because you are subscribed to the Google Groups "Snabb Switch development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send an email to [email protected]. Visit this group at http://groups.google.com/group/snabb-devel.

#4 lore raw

PATCH 2/6 libqemustub: add more stubs for qemu-char

In reply to Nikolay Nikolaev

Additional stubs:
- chr_baum_init
- qemu_chr_open_spice_vmc
- qemu_chr_open_spice_port

---
 stubs/Makefile.objs         |    2 ++
 stubs/chr-baum-init.c       |    7 +++++++
 stubs/qemu-chr-open-spice.c |   12 ++++++++++++
 3 files changed, 21 insertions(+)
 create mode 100644 stubs/chr-baum-init.c
 create mode 100644 stubs/qemu-chr-open-spice.c
stubs/Makefile.objs +2 -0
index 997d68d..2312076 100644
@@ -1,5 +1,6 @@
 stub-obj-y += arch-query-cpu-def.o
 stub-obj-y += bdrv-commit-all.o
+stub-obj-y += chr-baum-init.o
 stub-obj-y += chr-msmouse.o
 stub-obj-y += clock-warp.o
 stub-obj-y += cpu-get-clock.o
@@ -24,6 +25,7 @@ stub-obj-y += mon-set-error.o
 stub-obj-y += monitor-init.o
 stub-obj-y += notify-event.o
 stub-obj-y += pci-drive-hot-add.o
+stub-obj-y += qemu-chr-open-spice.o
 stub-obj-y += qtest.o
 stub-obj-y += reset.o
 stub-obj-y += runstate-check.o
stubs/chr-baum-init.c new file +7 -0
new file mode 100644
index 0000000..f5cc6ce
@@ -0,0 +1,7 @@
+#include "qemu-common.h"
+#include "sysemu/char.h"
+
+CharDriverState *chr_baum_init(void)
+{
+    return NULL;
+}
stubs/qemu-chr-open-spice.c new file +12 -0
new file mode 100644
index 0000000..40a29a9
@@ -0,0 +1,12 @@
+#include "qemu-common.h"
+#include "ui/qemu-spice.h"
+
+CharDriverState *qemu_chr_open_spice_vmc(const char *type)
+{
+    return NULL;
+}
+
+CharDriverState *qemu_chr_open_spice_port(const char *name)
+{
+    return NULL;
+}
#5 lore raw

Re: [Qemu-devel] [PATCH 2/6] libqemustub: add more stubs for qemu-char

Quoted 56 lines · Nikolay Nikolaev

Additional stubs:
- chr_baum_init
- qemu_chr_open_spice_vmc
- qemu_chr_open_spice_port

---
 stubs/Makefile.objs         |    2 ++
 stubs/chr-baum-init.c       |    7 +++++++
 stubs/qemu-chr-open-spice.c |   12 ++++++++++++
 3 files changed, 21 insertions(+)
 create mode 100644 stubs/chr-baum-init.c
 create mode 100644 stubs/qemu-chr-open-spice.c
stubs/Makefile.objs +2 -0
index 997d68d..2312076 100644
@@ -1,5 +1,6 @@
 stub-obj-y += arch-query-cpu-def.o
 stub-obj-y += bdrv-commit-all.o
+stub-obj-y += chr-baum-init.o
 stub-obj-y += chr-msmouse.o
 stub-obj-y += clock-warp.o
 stub-obj-y += cpu-get-clock.o
@@ -24,6 +25,7 @@ stub-obj-y += mon-set-error.o
 stub-obj-y += monitor-init.o
 stub-obj-y += notify-event.o
 stub-obj-y += pci-drive-hot-add.o
+stub-obj-y += qemu-chr-open-spice.o
 stub-obj-y += qtest.o
 stub-obj-y += reset.o
 stub-obj-y += runstate-check.o
stubs/chr-baum-init.c new file +7 -0
new file mode 100644
index 0000000..f5cc6ce
@@ -0,0 +1,7 @@
+#include "qemu-common.h"
+#include "sysemu/char.h"
+
+CharDriverState *chr_baum_init(void)
+{
+    return NULL;
+}
stubs/qemu-chr-open-spice.c new file +2 -0
new file mode 100644
index 0000000..40a29a9
@@ -0,0 +1,12 @@
+#include "qemu-common.h"
+#include "ui/qemu-spice.h"

stubs/qemu-chr-open-spice.c line 12

Quoted 10 lines
stubs/qemu-chr-open-spice.c new file +10 -0
+
+CharDriverState *qemu_chr_open_spice_vmc(const char *type)
+{
+    return NULL;
+}
+
+CharDriverState *qemu_chr_open_spice_port(const char *name)
+{
+    return NULL;
+}

The build breaks for '--disable-spice' configs now. You get

.../stubs/qemu-chr-open-spice.c:4:18:
error: no previous prototype for 'qemu_chr_open_spice_vmc' [-Werror=missing-prototypes]
CharDriverState *qemu_chr_open_spice_vmc(const char *type)

                  ^

.../stubs/qemu-chr-open-spice.c:9:18:
error: no previous prototype for 'qemu_chr_open_spice_port' [-Werror=missing-prototypes]
CharDriverState *qemu_chr_open_spice_port(const char *name)

                  ^

I believe you need something like the following instead

drew

#include "qemu-common.h"
#include "ui/qemu-spice.h"

#ifdef CONFIG_SPICE
CharDriverState *qemu_chr_open_spice_vmc(const char *type)

{
    return NULL;
}

#if SPICE_SERVER_VERSION >= 0x000c02 CharDriverState *qemu_chr_open_spice_port(const char *name)

{
    return NULL;
}

#endif
#endif

#6 lore raw

PATCH 3/6 qtest: fix qtest for vhost-user

In reply to Nikolay Nikolaev

Fix compile for older glib, provide conditionally compiled versions of the used glib APIs.

---
 tests/vhost-user-test.c |  128 +++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 113 insertions(+), 15 deletions(-)
tests/vhost-user-test.c +113 -15
index 7c826b4..2934379 100644
@@ -8,17 +8,30 @@
  *
  */
 
+#define QEMU_GLIB_COMPAT_H
+#include <glib.h>
+
 #include "libqtest.h"
 #include "qemu/option.h"
 #include "sysemu/char.h"
 #include "sysemu/sysemu.h"
 
-#include <glib.h>
 #include <linux/vhost.h>
 #include <sys/mman.h>
 #include <sys/vfs.h>
 #include <qemu/sockets.h>
 
+/* GLIB version compatibility flags */
+#if GLIB_CHECK_VERSION(2, 28, 0)
+#define HAVE_MONOTONIC_TIME
+#endif
+
+#if GLIB_CHECK_VERSION(2, 32, 0)
+#define HAVE_MUTEX_INIT
+#define HAVE_COND_INIT
+#define HAVE_THREAD_NEW
+#endif
+
 #define QEMU_CMD_ACCEL  " -machine accel=tcg"
 #define QEMU_CMD_MEM    " -m 512 -object memory-backend-file,id=mem,size=512M,"\
                         "mem-path=%s,share=on -numa node,memdev=mem"
@@ -95,8 +108,93 @@ static VhostUserMsg m __attribute__ ((unused));
 
 int fds_num = 0, fds[VHOST_MEMORY_MAX_NREGIONS];
 static VhostUserMemory memory;
-static GMutex data_mutex;
-static GCond data_cond;
+static GMutex *data_mutex;
+static GCond *data_cond;
+
+static gint64 _get_time(void)
+{
+#ifdef HAVE_MONOTONIC_TIME
+    return g_get_monotonic_time();
+#else
+    GTimeVal time;
+    g_get_current_time(&time);
+
+    return time.tv_sec * G_TIME_SPAN_SECOND + time.tv_usec;
+#endif
+}
+
+static GMutex *_mutex_new(void)
+{
+    GMutex *mutex;
+
+#ifdef HAVE_MUTEX_INIT
+    mutex = g_new(GMutex, 1);
+    g_mutex_init(mutex);
+#else
+    mutex = g_mutex_new();
+#endif
+
+    return mutex;
+}
+
+static void _mutex_free(GMutex *mutex)
+{
+#ifdef HAVE_MUTEX_INIT
+    g_mutex_clear(mutex);
+    g_free(mutex);
+#else
+    g_mutex_free(mutex);
+#endif
+}
+
+static GCond *_cond_new(void)
+{
+    GCond *cond;
+
+#ifdef HAVE_COND_INIT
+    cond = g_new(GCond, 1);
+    g_cond_init(cond);
+#else
+    cond = g_cond_new();
+#endif
+
+    return cond;
+}
+
+static gboolean _cond_wait_until(GCond *cond, GMutex *mutex, gint64 end_time)
+{
+    gboolean ret = FALSE;
+#ifdef HAVE_COND_INIT
+    ret = g_cond_wait_until(cond, mutex, end_time);
+#else
+    GTimeVal time = { end_time / G_TIME_SPAN_SECOND,
+                      end_time % G_TIME_SPAN_SECOND };
+    ret = g_cond_timed_wait(cond, mutex, &time);
+#endif
+    return ret;
+}
+
+static void _cond_free(GCond *cond)
+{
+#ifdef HAVE_COND_INIT
+    g_cond_clear(cond);
+    g_free(cond);
+#else
+    g_cond_free(cond);
+#endif
+}
+
+static GThread *_thread_new(const gchar *name, GThreadFunc func, gpointer data)
+{
+    GThread *thread = NULL;
+    GError *error = NULL;
+#ifdef HAVE_THREAD_NEW
+    thread = g_thread_try_new(name, func, data, &error);
+#else
+    thread = g_thread_create(func, data, TRUE, &error);
+#endif
+    return thread;
+}
 
 static void read_guest_mem(void)
 {
@@ -104,11 +202,11 @@ static void read_guest_mem(void)
     gint64 end_time;
     int i, j;
 
-    g_mutex_lock(&data_mutex);
+    g_mutex_lock(data_mutex);
 
-    end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
+    end_time = _get_time() + 5 * G_TIME_SPAN_SECOND;
     while (!fds_num) {
-        if (!g_cond_wait_until(&data_cond, &data_mutex, end_time)) {
+        if (!_cond_wait_until(data_cond, data_mutex, end_time)) {
             /* timeout has passed */
             g_assert(fds_num);
             break;
@@ -143,7 +241,7 @@ static void read_guest_mem(void)
     }
 
     g_assert_cmpint(1, ==, 1);
-    g_mutex_unlock(&data_mutex);
+    g_mutex_unlock(data_mutex);
 }
 
 static void *thread_function(void *data)
@@ -203,8 +301,8 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
         fds_num = qemu_chr_fe_get_msgfds(chr, fds, sizeof(fds) / sizeof(int));
 
         /* signal the test that it can continue */
-        g_cond_signal(&data_cond);
-        g_mutex_unlock(&data_mutex);
+        g_cond_signal(data_cond);
+        g_mutex_unlock(data_mutex);
         break;
 
     case VHOST_USER_SET_VRING_KICK:
@@ -285,10 +383,10 @@ int main(int argc, char **argv)
     qemu_chr_add_handlers(chr, chr_can_read, chr_read, NULL, chr);
 
     /* run the main loop thread so the chardev may operate */
-    g_mutex_init(&data_mutex);
-    g_cond_init(&data_cond);
-    g_mutex_lock(&data_mutex);
-    g_thread_new(NULL, thread_function, NULL);
+    data_mutex = _mutex_new();
+    data_cond = _cond_new();
+    g_mutex_lock(data_mutex);
+    _thread_new(NULL, thread_function, NULL);
 
     qemu_cmd = g_strdup_printf(QEMU_CMD, hugefs, socket_path);
     s = qtest_start(qemu_cmd);
@@ -305,8 +403,8 @@ int main(int argc, char **argv)
     /* cleanup */
     unlink(socket_path);
     g_free(socket_path);
-    g_cond_clear(&data_cond);
-    g_mutex_clear(&data_mutex);
+    _cond_free(data_cond);
+    _mutex_free(data_mutex);
 
     return ret;
 }
#7 lore raw

PATCH 4/6 qtest: fix vhost-user-test unbalanced mutex locks

In reply to Nikolay Nikolaev
---
 tests/vhost-user-test.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/vhost-user-test.c +2 -2
index 2934379..2af2381 100644
@@ -269,6 +269,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
         return;
     }
 
+    g_mutex_lock(data_mutex);
     memcpy(p, buf, VHOST_USER_HDR_SIZE);
 
     if (msg.size) {
@@ -302,7 +303,6 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
 
         /* signal the test that it can continue */
         g_cond_signal(data_cond);
-        g_mutex_unlock(data_mutex);
         break;
 
     case VHOST_USER_SET_VRING_KICK:
@@ -319,6 +319,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
     default:
         break;
     }
+    g_mutex_unlock(data_mutex);
 }
 
 static const char *init_hugepagefs(void)
@@ -385,7 +386,6 @@ int main(int argc, char **argv)
     /* run the main loop thread so the chardev may operate */
     data_mutex = _mutex_new();
     data_cond = _cond_new();
-    g_mutex_lock(data_mutex);
     _thread_new(NULL, thread_function, NULL);
 
     qemu_cmd = g_strdup_printf(QEMU_CMD, hugefs, socket_path);
#8 lore raw

PATCH 5/6 vhost: fix migration_blocker initialization

In reply to Nikolay Nikolaev

error_set expect errp to be a NULL initialized pointer.

---
 hw/virtio/vhost.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/virtio/vhost.c +1 -2
index c44c15c..e55fe1c 100644
@@ -857,12 +857,11 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
         .eventfd_del = vhost_eventfd_del,
         .priority = 10
     };
+    hdev->migration_blocker = NULL;
     if (!(hdev->features & (0x1 << VHOST_F_LOG_ALL))) {
         error_setg(&hdev->migration_blocker,
                    "Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.");
         migrate_add_blocker(hdev->migration_blocker);
-    } else {
-        hdev->migration_blocker = NULL;
     }
     hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions));
     hdev->n_mem_sections = 0;
#9 lore raw

PATCH 6/6 qtest: enable vhost-user-test

In reply to Nikolay Nikolaev

Also use qtest-obj-y to get the right library order.

---
 tests/Makefile |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/Makefile +3 -3
index 4caf7de..db4accf 100644
@@ -156,7 +156,7 @@ gcov-files-i386-y += hw/usb/hcd-ehci.c
 gcov-files-i386-y += hw/usb/hcd-uhci.c
 gcov-files-i386-y += hw/usb/dev-hid.c
 gcov-files-i386-y += hw/usb/dev-storage.c
-#check-qtest-i386-y += tests/vhost-user-test$(EXESUF)
+check-qtest-i386-y += tests/vhost-user-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -323,11 +323,11 @@ tests/es1370-test$(EXESUF): tests/es1370-test.o
 tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
 tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
 tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
-tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o libqemuutil.a libqemustub.a
+tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y)
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
 
-#LIBS+= -lutil
+LIBS+= -lutil
 
 # QTest rules
 
#10 lore raw

Re: [Qemu-devel] [PATCH 6/6] qtest: enable vhost-user-test

Quoted 3 lines · Nikolay Nikolaev

Also use qtest-obj-y to get the right library order.

Seems to still break mingw build.
Please build-test it.

Quoted 31 lines
---
 tests/Makefile |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/Makefile +3 -3
index 4caf7de..db4accf 100644
@@ -156,7 +156,7 @@ gcov-files-i386-y += hw/usb/hcd-ehci.c
 gcov-files-i386-y += hw/usb/hcd-uhci.c
 gcov-files-i386-y += hw/usb/dev-hid.c
 gcov-files-i386-y += hw/usb/dev-storage.c
-#check-qtest-i386-y += tests/vhost-user-test$(EXESUF)
+check-qtest-i386-y += tests/vhost-user-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
@@ -323,11 +323,11 @@ tests/es1370-test$(EXESUF): tests/es1370-test.o
 tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
 tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
 tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
-tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o libqemuutil.a libqemustub.a
+tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y)
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
 
-#LIBS+= -lutil
+LIBS+= -lutil
 
 # QTest rules
 
#11 lore raw

Re: [Qemu-devel] [PATCH 6/6] qtest: enable vhost-user-test

Il 19/06/2014 17:41, Michael S. Tsirkin ha scritto:

Quoted 1 line
Quoted 1 line

+check-qtest-i386-y += tests/vhost-user-test$(EXESUF)

Just using check-qtest-i386-$(CONFIG_POSIX) will work. Windows doesn't have Unix sockets.

Paolo

#12 lore raw
In reply to Nikolay Nikolaev
Quoted 6 lines · Nikolay Nikolaev

The following series enables vhost-user-test in make check.

The first patch adds a new CONFIG_VHOST_NET_USED in configure to be used in net.c to enable vhost-user netdev backend.

Fifth patch fixes an error when calling erro_setg in vhost_dev_init.

I squashed path 5 into mine, thanks a lot for the fix.
Patch 1-4 applied on the pci branch.
Patch 6 breaks mingw build (-lutil isn't present) so it's still pending.

Quoted 25 lines

---

Nikolay Nikolaev (6):
configure: add new config define CONFIG_VHOST_NET_USED
libqemustub: add more stubs for qemu-char
qtest: fix qtest for vhost-user
qtest: fix vhost-user-test unbalanced mutex locks
vhost: fix migration_blocker initialization
qtest: enable vhost-user-test

 configure                   |    3 +
 hw/virtio/vhost.c           |    3 -
 net/net.c                   |    4 +
 stubs/Makefile.objs         |    2 +
 stubs/chr-baum-init.c       |    7 ++
 stubs/qemu-chr-open-spice.c |   12 ++++
 tests/Makefile              |    6 +-
 tests/vhost-user-test.c     |  128 ++++++++++++++++++++++++++++++++++++++-----
 8 files changed, 143 insertions(+), 22 deletions(-)
 create mode 100644 stubs/chr-baum-init.c
 create mode 100644 stubs/qemu-chr-open-spice.c

--
Signature

#13 lore raw
Quoted 12 lines · Michael S. Tsirkin
Quoted 6 lines · Nikolay Nikolaev

The following series enables vhost-user-test in make check.

The first patch adds a new CONFIG_VHOST_NET_USED in configure to be used in net.c to enable vhost-user netdev backend.

Fifth patch fixes an error when calling erro_setg in vhost_dev_init.

I squashed path 5 into mine, thanks a lot for the fix.
Patch 1-4 applied on the pci branch.
Patch 6 breaks mingw build (-lutil isn't present) so it's still pending.

OK, thanks Michael!
I am still looking how to setup mingw. Any hints? Is compiling on windows simpler?

regards,
Niklay Nikolaev

Quoted 36 lines
Quoted 12 lines

---

Nikolay Nikolaev (6):
configure: add new config define CONFIG_VHOST_NET_USED
libqemustub: add more stubs for qemu-char
qtest: fix qtest for vhost-user
qtest: fix vhost-user-test unbalanced mutex locks
vhost: fix migration_blocker initialization
qtest: enable vhost-user-test

Quoted 8 lines
 configure                   |    3 +
 hw/virtio/vhost.c           |    3 -
 net/net.c                   |    4 +
 stubs/Makefile.objs         |    2 +
 stubs/chr-baum-init.c       |    7 ++
 stubs/qemu-chr-open-spice.c |   12 ++++
 tests/Makefile              |    6 +-
 tests/vhost-user-test.c     |  128

++++++++++++++++++++++++++++++++++++++-----

Quoted 6 lines
 8 files changed, 143 insertions(+), 22 deletions(-)
 create mode 100644 stubs/chr-baum-init.c
 create mode 100644 stubs/qemu-chr-open-spice.c

--
Signature

--
You received this message because you are subscribed to the Google Groups "Snabb Switch development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send an email to [email protected]. Visit this group at http://groups.google.com/group/snabb-devel.

#14 lore raw
Quoted 19 lines · Nikolay Nikolaev
Quoted 12 lines · Michael S. Tsirkin
Quoted 6 lines · Nikolay Nikolaev

The following series enables vhost-user-test in make check.

The first patch adds a new CONFIG_VHOST_NET_USED in configure to be used in net.c to enable vhost-user netdev backend.

Fifth patch fixes an error when calling erro_setg in vhost_dev_init.

I squashed path 5 into mine, thanks a lot for the fix.
Patch 1-4 applied on the pci branch.
Patch 6 breaks mingw build (-lutil isn't present) so it's still pending.

Quoted 7 lines

OK, thanks Michael!
I am still looking how to setup mingw. Any hints? Is compiling on windows simpler?

regards,
Niklay Nikolaev

After removing the -lutil line it still breaks for my mingw:

../backends/hostmem.o: In function `host_memory_backend_memory_complete':
/home/nickolaev/workspace/qemu/backends/hostmem.c:342: undefined reference to `os_mem_prealloc'

regards,
Nikolay Nikolaev

Quoted 40 lines
Quoted 38 lines
Quoted 14 lines

---

Nikolay Nikolaev (6):
configure: add new config define CONFIG_VHOST_NET_USED
libqemustub: add more stubs for qemu-char
qtest: fix qtest for vhost-user
qtest: fix vhost-user-test unbalanced mutex locks
vhost: fix migration_blocker initialization
qtest: enable vhost-user-test

Quoted 8 lines
 configure                   |    3 +
 hw/virtio/vhost.c           |    3 -
 net/net.c                   |    4 +
 stubs/Makefile.objs         |    2 +
 stubs/chr-baum-init.c       |    7 ++
 stubs/qemu-chr-open-spice.c |   12 ++++
 tests/Makefile              |    6 +-
 tests/vhost-user-test.c     |  128

++++++++++++++++++++++++++++++++++++++-----

Quoted 6 lines
 8 files changed, 143 insertions(+), 22 deletions(-)
 create mode 100644 stubs/chr-baum-init.c
 create mode 100644 stubs/qemu-chr-open-spice.c

--
Signature

--
You received this message because you are subscribed to the Google Groups "Snabb Switch development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send an email to [email protected]. Visit this group at http://groups.google.com/group/snabb-devel.