changeset 14043:a184cac42a35

select tests: Use existing modules. * modules/select-tests (Depends-on): Add pipe-posix, unistd. (configure.ac): Don't test for unistd.h. * tests/test-select.c: Include <unistd.h> always. Use pipe() as declared in <unistd.h>.
author Bruno Haible <bruno@clisp.org>
date Mon, 27 Dec 2010 18:51:03 +0100
parents 1a75c9206d28
children cf58f3c67722
files ChangeLog modules/select-tests tests/test-select.c
diffstat 3 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 27 14:28:11 2010 +0100
+++ b/ChangeLog	Mon Dec 27 18:51:03 2010 +0100
@@ -1,3 +1,11 @@
+2010-12-27  Bruno Haible  <bruno@clisp.org>
+
+	select tests: Use existing modules.
+	* modules/select-tests (Depends-on): Add pipe-posix, unistd.
+	(configure.ac): Don't test for unistd.h.
+	* tests/test-select.c: Include <unistd.h> always. Use pipe() as
+	declared in <unistd.h>.
+
 2010-12-27  Bruno Haible  <bruno@clisp.org>
 
 	mbrtowc: Work around a Solaris 7 bug.
--- a/modules/select-tests	Mon Dec 27 14:28:11 2010 +0100
+++ b/modules/select-tests	Mon Dec 27 18:51:03 2010 +0100
@@ -11,11 +11,13 @@
 stdbool
 netinet_in
 arpa_inet
+unistd
 sys_ioctl
 extensions
 inet_pton
 errno
 perror
+pipe-posix
 socket
 bind
 setsockopt
@@ -27,7 +29,7 @@
 gettimeofday
 
 configure.ac:
-AC_CHECK_HEADERS_ONCE([unistd.h sys/wait.h])
+AC_CHECK_HEADERS_ONCE([sys/wait.h])
 
 Makefile.am:
 TESTS += test-select test-select-in.sh test-select-out.sh
--- a/tests/test-select.c	Mon Dec 27 14:28:11 2010 +0100
+++ b/tests/test-select.c	Mon Dec 27 18:51:03 2010 +0100
@@ -42,6 +42,7 @@
 #include <string.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <unistd.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <stdbool.h>
@@ -56,19 +57,12 @@
 # define WIN32_NATIVE
 #endif
 
-#ifdef WIN32_NATIVE
-#include <io.h>
-#define pipe(x) _pipe(x, 256, O_BINARY)
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
+# include <sys/wait.h>
 #endif
 
 #ifndef SO_REUSEPORT
-#define SO_REUSEPORT    SO_REUSEADDR
+# define SO_REUSEPORT    SO_REUSEADDR
 #endif
 
 #define TEST_PORT       12345