[PATCH] tests: switch away from HAVE_SOCKETPAIR

Pino Toscano posted 1 patch 3 weeks ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200319110517.1609142-1-ptoscano@redhat.com
tests/virnetdaemontest.c       | 4 +++-
tests/virnetserverclienttest.c | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)

[PATCH] tests: switch away from HAVE_SOCKETPAIR

Posted by Pino Toscano 3 weeks ago
Since the removal of gnulib, HAVE_SOCKETPAIR is no more defined, making
these two tests effectively skipped.

Use the same strategy used in other generic library bits, i.e. exclude
the socketpair usage on Windows.

Semi-related change in virnetdaemontest.c to make it build: since
virutil.h does not include unistd.h anymore, we need to include it.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
---
 tests/virnetdaemontest.c       | 4 +++-
 tests/virnetserverclienttest.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index 825487f0a1..09d268627c 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -18,13 +18,15 @@
 
 #include <config.h>
 
+#include <unistd.h>
+
 #include "testutils.h"
 #include "virerror.h"
 #include "rpc/virnetdaemon.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
-#if defined(HAVE_SOCKETPAIR) && defined(WITH_YAJL)
+#if !defined(WIN32) && defined(WITH_YAJL)
 struct testClientPriv {
     int magic;
 };
diff --git a/tests/virnetserverclienttest.c b/tests/virnetserverclienttest.c
index a9a56c48d5..668fd02a1e 100644
--- a/tests/virnetserverclienttest.c
+++ b/tests/virnetserverclienttest.c
@@ -24,7 +24,7 @@
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
-#ifdef HAVE_SOCKETPAIR
+#ifndef WIN32
 
 static void *
 testClientNew(virNetServerClientPtr client G_GNUC_UNUSED,
-- 
2.25.1

Re: [PATCH] tests: switch away from HAVE_SOCKETPAIR

Posted by Daniel P. Berrangé 3 weeks ago
On Thu, Mar 19, 2020 at 12:05:17PM +0100, Pino Toscano wrote:
> Since the removal of gnulib, HAVE_SOCKETPAIR is no more defined, making
> these two tests effectively skipped.

Doh, I had compared the config.h file before & after gnulib removal
to identify  HAVE_* macros that no longer existed, but guess I
missed this.

> 
> Use the same strategy used in other generic library bits, i.e. exclude
> the socketpair usage on Windows.
> 
> Semi-related change in virnetdaemontest.c to make it build: since
> virutil.h does not include unistd.h anymore, we need to include it.
> 
> Signed-off-by: Pino Toscano <ptoscano@redhat.com>
> ---
>  tests/virnetdaemontest.c       | 4 +++-
>  tests/virnetserverclienttest.c | 2 +-
>  2 files changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|