aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/libtest/first.c15
-rw-r--r--tests/libtest/lib503.c2
-rw-r--r--tests/libtest/lib504.c2
-rw-r--r--tests/libtest/lib507.c2
-rw-r--r--tests/libtest/lib509.c2
-rw-r--r--tests/libtest/lib525.c2
-rw-r--r--tests/libtest/lib526.c2
-rw-r--r--tests/libtest/lib530.c2
-rw-r--r--tests/libtest/test.h4
9 files changed, 26 insertions, 7 deletions
diff --git a/tests/libtest/first.c b/tests/libtest/first.c
index a7f317355..fda1a7fb5 100644
--- a/tests/libtest/first.c
+++ b/tests/libtest/first.c
@@ -9,6 +9,21 @@ extern void curl_memlimit(int);
/* test is provided in the test code file */
int test(char *url);
+int select_test (int num_fds, fd_set *rd, fd_set *wr, fd_set *exc,
+ struct timeval *tv)
+{
+#ifdef WIN32
+ /* Winsock doesn't like no socket set in 'rd', 'wr' or 'exc'. This is
+ * case when 'num_fds <= 0. So sleep.
+ */
+ if (num_fds <= 0) {
+ Sleep(1000*tv->tv_sec + tv->tv_usec/1000);
+ return 0;
+ }
+#endif
+ return select(num_fds, rd, wr, exc, tv);
+}
+
char *arg2=NULL;
int main(int argc, char **argv)
diff --git a/tests/libtest/lib503.c b/tests/libtest/lib503.c
index aeb85db36..4e7ac82db 100644
--- a/tests/libtest/lib503.c
+++ b/tests/libtest/lib503.c
@@ -67,7 +67,7 @@ int test(char *URL)
return 89;
}
- if (select(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
+ if (select_test(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
fprintf(stderr, "bad select??\n");
return 95;
}
diff --git a/tests/libtest/lib504.c b/tests/libtest/lib504.c
index 5ba9362bb..843e9ebd0 100644
--- a/tests/libtest/lib504.c
+++ b/tests/libtest/lib504.c
@@ -77,7 +77,7 @@ int test(char *URL)
ret = 3;
break;
}
- rc = select(max_fd+1, &rd, &wr, &exc, &interval);
+ rc = select_test(max_fd+1, &rd, &wr, &exc, &interval);
fprintf(stderr, "select returned %d\n", rc);
/* we only allow a certain number of loops to avoid hanging here
diff --git a/tests/libtest/lib507.c b/tests/libtest/lib507.c
index 4e776ec4a..8fc4ca3ce 100644
--- a/tests/libtest/lib507.c
+++ b/tests/libtest/lib507.c
@@ -28,7 +28,7 @@ int test(char *URL)
timeout.tv_sec = 1;
timeout.tv_usec = 0;
curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd);
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
switch(rc) {
case -1:
break;
diff --git a/tests/libtest/lib509.c b/tests/libtest/lib509.c
index d20c31524..415208ac7 100644
--- a/tests/libtest/lib509.c
+++ b/tests/libtest/lib509.c
@@ -241,7 +241,7 @@ int test(char *URL)
break;
}
- if (select(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
+ if (select_test(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
fprintf(stderr, "bad select??\n");
i =95;
break;
diff --git a/tests/libtest/lib525.c b/tests/libtest/lib525.c
index 9946ce354..77e5c203a 100644
--- a/tests/libtest/lib525.c
+++ b/tests/libtest/lib525.c
@@ -114,7 +114,7 @@ int test(char *URL)
break;
}
- if (select(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
+ if (select_test(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
fprintf(stderr, "bad select??\n");
res = 195;
break;
diff --git a/tests/libtest/lib526.c b/tests/libtest/lib526.c
index 5050b27f2..de3a36d02 100644
--- a/tests/libtest/lib526.c
+++ b/tests/libtest/lib526.c
@@ -106,7 +106,7 @@ int test(char *URL)
break;
}
- if (select(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
+ if (select_test(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
fprintf(stderr, "bad select??\n");
res = 195;
break;
diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c
index 85b2e74ad..3e6cd3fac 100644
--- a/tests/libtest/lib530.c
+++ b/tests/libtest/lib530.c
@@ -83,7 +83,7 @@ int test(char *URL)
break;
}
- if (select(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
+ if (select_test(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
fprintf(stderr, "bad select??\n");
res = 195;
break;
diff --git a/tests/libtest/test.h b/tests/libtest/test.h
index a442ba4bd..83ec94b65 100644
--- a/tests/libtest/test.h
+++ b/tests/libtest/test.h
@@ -32,5 +32,9 @@
#endif
extern char *arg2; /* set by first.c to the argv[2] or NULL */
+
+int select_test (int num_fds, fd_set *rd, fd_set *wr, fd_set *exc,
+ struct timeval *tv);
+
int test(char *URL); /* the actual test function provided by each individual
libXXX.c file */