bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] testsuite for poll(2)


From: Paolo Bonzini
Subject: Re: [PATCH] testsuite for poll(2)
Date: Fri, 12 Sep 2008 15:49:14 +0200
User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707)

Thanks Yoann!

> - enum { TRUE, FALSE } will fail to compile on WIN32, better use
> stdbool, or :

See patch at end of message.

> - The code need to be linked to -lws2_32 to avoid undefined symbols, yet
> the dependency is not pulled automatically.

Also fixed in the patch by using the sockets module.  If you report good
things about it, I'll commit it.

> i586-mingw32msvc-gcc  -g -O2   -o test-poll.exe
> test-poll.o ../gllib/libgnu.a -lws2_32
> test-poll.o: In function `test_pipe':
> /home/yoann/dev/prelude/git/gnulib/poll/gltests/test-poll.c:347:
> undefined reference to `_pipe'

Also fixed in the patch (there should really be a unistd.h replacement
in gnulib...).

> test-poll.o: In function `open_server_socket':
> /home/yoann/dev/prelude/git/gnulib/poll/gltests/test-poll.c:91:
> undefined reference to `_inet_aton'
> test-poll.o: In function `connect_to_socket':
> /home/yoann/dev/prelude/git/gnulib/poll/gltests/test-poll.c:121:
> undefined reference to `_inet_aton'

These should be provided by ws2_32.

> ../gllib/libgnu.a(poll.o): In function `rpl_poll':
> /home/yoann/dev/prelude/git/gnulib/poll/gllib/poll.c:154: undefined
> reference to `_select_not_supported_under_win32_use_poll'

I suppose this is with the winsock patch, but without the poll patch?
The two go together -- either both, or none.

Paolo

diff --git a/modules/poll-tests b/modules/poll-tests
index 1484aaa..5eb269b 100644
--- a/modules/poll-tests
+++ b/modules/poll-tests
@@ -2,10 +2,12 @@ Files:
 tests/test-poll.c

 Depends-on:
+stdbool
 sys_socket
 netinet_in
 arpa_inet
 extensions
+sockets

 configure.ac:
 AC_CHECK_HEADERS_ONCE([io.h unistd.h sys/wait.h])
diff --git a/tests/test-poll.c b/tests/test-poll.c
index cacb3a2..ed99faf 100644
--- a/tests/test-poll.c
+++ b/tests/test-poll.c
@@ -27,10 +27,12 @@
 #include <poll.h>
 #include <fcntl.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #include <errno.h>

 #ifdef HAVE_IO_H
 #include <io.h>
+#define pipe _pipe
 #endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -39,8 +40,6 @@
 #include <sys/wait.h>
 #endif

-enum { FALSE, TRUE };
-
 #ifndef SO_REUSEPORT
 #define SO_REUSEPORT    SO_REUSEADDR
 #endif
@@ -218,7 +217,7 @@ test_connect_first (void)
   if (poll1_nowait (s, POLLIN | POLLRDNORM | POLLRDBAND) != 0)
     failed ("can read, socket not connected");

-  c1 = connect_to_socket (FALSE);
+  c1 = connect_to_socket (false);

   if (poll1_wait (s, POLLIN | POLLRDNORM | POLLRDBAND) != (POLLIN |
POLLRDNORM))
     failed ("expecting POLLIN | POLLRDNORM on passive socket");
@@ -265,7 +264,7 @@ test_accept_first (void)
   else
     {
       close (s);
-      c = connect_to_socket (TRUE);
+      c = connect_to_socket (true);
       if (poll1_nowait (c, POLLOUT | POLLWRNORM | POLLRDBAND)
          != (POLLOUT | POLLWRNORM))
         failed ("cannot write after blocking connect");
@@ -319,7 +318,7 @@ test_socket_pair (void)

   socklen_t addrlen = sizeof (ia);
   int s = open_server_socket ();
-  int c1 = connect_to_socket (FALSE);
+  int c1 = connect_to_socket (false);
   int c2 = accept (s, (struct sockaddr *) &ia, &addrlen);

   close (s);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]