diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-11-24 11:37:55 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-11-24 11:37:55 +0300 |
commit | 3a7f7a97ebb9894c31edb7c7f635784256fead73 (patch) | |
tree | 32e73da67d61099a59611706c8bd16f9fa18858b | |
parent | 14e903bac93d80f48c0df252d0389c84bad77460 (diff) | |
download | libmicrohttpd-3a7f7a97ebb9894c31edb7c7f635784256fead73.tar.gz libmicrohttpd-3a7f7a97ebb9894c31edb7c7f635784256fead73.zip |
test_quiesce_stream: use curl binary, port to W32,
use tests with fork() only when fork() is available (already checked by configure)
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | src/testcurl/Makefile.am | 18 | ||||
-rw-r--r-- | src/testcurl/test_quiesce_stream.c | 20 |
3 files changed, 25 insertions, 16 deletions
diff --git a/configure.ac b/configure.ac index 4da55816..635f7886 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1302,6 +1302,7 @@ AS_VAR_IF([[mhd_cv_have_func_calloc]], [["yes"]], | |||
1302 | 1302 | ||
1303 | # Check for fork() and waitpid(). They are used for tests. | 1303 | # Check for fork() and waitpid(). They are used for tests. |
1304 | AC_MSG_CHECKING([[for fork()]]) | 1304 | AC_MSG_CHECKING([[for fork()]]) |
1305 | mhd_have_fork_waitpid='no' | ||
1305 | AC_LINK_IFELSE( | 1306 | AC_LINK_IFELSE( |
1306 | [ | 1307 | [ |
1307 | AC_LANG_PROGRAM( | 1308 | AC_LANG_PROGRAM( |
@@ -1336,6 +1337,7 @@ AC_LINK_IFELSE( | |||
1336 | ], [ | 1337 | ], [ |
1337 | AC_DEFINE([[HAVE_WAITPID]], [[1]], [Define to 1 if you have the usable `waitpid' function.]) | 1338 | AC_DEFINE([[HAVE_WAITPID]], [[1]], [Define to 1 if you have the usable `waitpid' function.]) |
1338 | AC_MSG_RESULT([[yes]]) | 1339 | AC_MSG_RESULT([[yes]]) |
1340 | mhd_have_fork_waitpid='yes' | ||
1339 | ],[ | 1341 | ],[ |
1340 | AC_MSG_RESULT([[no]]) | 1342 | AC_MSG_RESULT([[no]]) |
1341 | ]) | 1343 | ]) |
@@ -1343,6 +1345,7 @@ AC_LINK_IFELSE( | |||
1343 | AC_MSG_RESULT([[no]]) | 1345 | AC_MSG_RESULT([[no]]) |
1344 | ]) | 1346 | ]) |
1345 | 1347 | ||
1348 | AM_CONDITIONAL([HAVE_FORK_WAITPID], [test "x$mhd_have_fork_waitpid" = "xyes"]) | ||
1346 | 1349 | ||
1347 | MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS -export-dynamic -no-undefined" | 1350 | MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS -export-dynamic -no-undefined" |
1348 | 1351 | ||
diff --git a/src/testcurl/Makefile.am b/src/testcurl/Makefile.am index d0f403c6..b033fc92 100644 --- a/src/testcurl/Makefile.am +++ b/src/testcurl/Makefile.am | |||
@@ -16,12 +16,6 @@ AM_CPPFLAGS = \ | |||
16 | -I$(top_srcdir)/src/include \ | 16 | -I$(top_srcdir)/src/include \ |
17 | $(LIBCURL_CPPFLAGS) | 17 | $(LIBCURL_CPPFLAGS) |
18 | 18 | ||
19 | if !HAVE_W32 | ||
20 | if HAVE_CURL_BINARY | ||
21 | CURL_FORK_TEST = test_get_response_cleanup | ||
22 | endif | ||
23 | endif | ||
24 | |||
25 | if HAVE_CURL | 19 | if HAVE_CURL |
26 | check_PROGRAMS = \ | 20 | check_PROGRAMS = \ |
27 | test_start_stop \ | 21 | test_start_stop \ |
@@ -46,15 +40,23 @@ check_PROGRAMS = \ | |||
46 | test_termination \ | 40 | test_termination \ |
47 | test_timeout \ | 41 | test_timeout \ |
48 | test_callback \ | 42 | test_callback \ |
49 | $(CURL_FORK_TEST) \ | ||
50 | perf_get | 43 | perf_get |
51 | 44 | ||
45 | if HAVE_FORK_WAITPID | ||
46 | if HAVE_CURL_BINARY | ||
47 | check_PROGRAMS += test_get_response_cleanup | ||
48 | endif | ||
49 | endif | ||
50 | |||
52 | if HAVE_POSIX_THREADS | 51 | if HAVE_POSIX_THREADS |
53 | check_PROGRAMS += \ | 52 | check_PROGRAMS += \ |
54 | test_quiesce \ | 53 | test_quiesce \ |
55 | test_quiesce_stream \ | ||
56 | test_concurrent_stop \ | 54 | test_concurrent_stop \ |
57 | perf_get_concurrent | 55 | perf_get_concurrent |
56 | |||
57 | if HAVE_CURL_BINARY | ||
58 | check_PROGRAMS += test_quiesce_stream | ||
59 | endif | ||
58 | endif | 60 | endif |
59 | 61 | ||
60 | if HAVE_POSTPROCESSOR | 62 | if HAVE_POSTPROCESSOR |
diff --git a/src/testcurl/test_quiesce_stream.c b/src/testcurl/test_quiesce_stream.c index d658b719..7885a048 100644 --- a/src/testcurl/test_quiesce_stream.c +++ b/src/testcurl/test_quiesce_stream.c | |||
@@ -23,15 +23,19 @@ | |||
23 | * @author Markus Doppelbauer | 23 | * @author Markus Doppelbauer |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | #include "mhd_options.h" | ||
26 | #include <stdlib.h> | 27 | #include <stdlib.h> |
27 | #include <stdio.h> | 28 | #include <stdio.h> |
28 | #include <string.h> | 29 | #include <string.h> |
29 | #include <errno.h> | 30 | #include <errno.h> |
30 | #include <arpa/inet.h> | ||
31 | #include <unistd.h> | ||
32 | #include <fcntl.h> | ||
33 | #include <pthread.h> | 31 | #include <pthread.h> |
34 | #include <microhttpd.h> | 32 | #include <microhttpd.h> |
33 | #ifdef HAVE_UNISTD_H | ||
34 | #include <unistd.h> | ||
35 | #elif defined(_WIN32) | ||
36 | #include <windows.h> | ||
37 | #define sleep(s) (Sleep((s)*1000), 0) | ||
38 | #endif /* _WIN32 */ | ||
35 | 39 | ||
36 | 40 | ||
37 | static volatile unsigned int request_counter; | 41 | static volatile unsigned int request_counter; |
@@ -171,7 +175,7 @@ main() | |||
171 | /* Flags */ | 175 | /* Flags */ |
172 | unsigned int daemon_flags | 176 | unsigned int daemon_flags |
173 | = MHD_USE_INTERNAL_POLLING_THREAD | 177 | = MHD_USE_INTERNAL_POLLING_THREAD |
174 | | MHD_USE_EPOLL | 178 | | MHD_USE_AUTO |
175 | | MHD_ALLOW_SUSPEND_RESUME | 179 | | MHD_ALLOW_SUSPEND_RESUME |
176 | | MHD_USE_ITC; | 180 | | MHD_USE_ITC; |
177 | 181 | ||
@@ -184,11 +188,11 @@ main() | |||
184 | NULL, | 188 | NULL, |
185 | MHD_OPTION_END); | 189 | MHD_OPTION_END); |
186 | if (NULL == daemon) | 190 | if (NULL == daemon) |
187 | return EXIT_FAILURE; | 191 | return 1; |
188 | if (0 != system ("wget --server-response -q -O - 127.0.0.1:8000")) | 192 | if (0 != system ("curl -s http://127.0.0.1:8000")) |
189 | { | 193 | { |
190 | MHD_stop_daemon (daemon); | 194 | MHD_stop_daemon (daemon); |
191 | return 77; /* skipped */ | 195 | return 1; |
192 | } | 196 | } |
193 | /* wait for a request */ | 197 | /* wait for a request */ |
194 | while (0 == request_counter) | 198 | while (0 == request_counter) |
@@ -205,5 +209,5 @@ main() | |||
205 | "stopping daemon\n"); | 209 | "stopping daemon\n"); |
206 | MHD_stop_daemon (daemon); | 210 | MHD_stop_daemon (daemon); |
207 | 211 | ||
208 | return EXIT_SUCCESS; | 212 | return 0; |
209 | } | 213 | } |