diff options
Diffstat (limited to 'src/microhttpd/test_start_stop.c')
-rw-r--r-- | src/microhttpd/test_start_stop.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/src/microhttpd/test_start_stop.c b/src/microhttpd/test_start_stop.c index d27291b8..541cc5c5 100644 --- a/src/microhttpd/test_start_stop.c +++ b/src/microhttpd/test_start_stop.c | |||
@@ -27,10 +27,10 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include <microhttpd.h> | 28 | #include <microhttpd.h> |
29 | 29 | ||
30 | #if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 | 30 | #if defined(CPU_COUNT) && (CPU_COUNT + 0) < 2 |
31 | #undef CPU_COUNT | 31 | #undef CPU_COUNT |
32 | #endif | 32 | #endif |
33 | #if !defined(CPU_COUNT) | 33 | #if ! defined(CPU_COUNT) |
34 | #define CPU_COUNT 2 | 34 | #define CPU_COUNT 2 |
35 | #endif | 35 | #endif |
36 | 36 | ||
@@ -44,9 +44,9 @@ ahc_echo (void *cls, | |||
44 | const char *upload_data, size_t *upload_data_size, | 44 | const char *upload_data, size_t *upload_data_size, |
45 | void **unused) | 45 | void **unused) |
46 | { | 46 | { |
47 | (void)cls;(void)connection;(void)url; /* Unused. Silent compiler warning. */ | 47 | (void) cls; (void) connection; (void) url; /* Unused. Silent compiler warning. */ |
48 | (void)method;(void)version;(void)upload_data; /* Unused. Silent compiler warning. */ | 48 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
49 | (void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */ | 49 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ |
50 | 50 | ||
51 | return MHD_NO; | 51 | return MHD_NO; |
52 | } | 52 | } |
@@ -58,7 +58,8 @@ testInternalGet (int poll_flag) | |||
58 | { | 58 | { |
59 | struct MHD_Daemon *d; | 59 | struct MHD_Daemon *d; |
60 | 60 | ||
61 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, | 61 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG |
62 | | poll_flag, | ||
62 | 0, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | 63 | 0, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); |
63 | if (d == NULL) | 64 | if (d == NULL) |
64 | return 1; | 65 | return 1; |
@@ -71,7 +72,9 @@ testMultithreadedGet (int poll_flag) | |||
71 | { | 72 | { |
72 | struct MHD_Daemon *d; | 73 | struct MHD_Daemon *d; |
73 | 74 | ||
74 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, | 75 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
76 | | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | ||
77 | | poll_flag, | ||
75 | 0, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | 78 | 0, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); |
76 | if (d == NULL) | 79 | if (d == NULL) |
77 | return 2; | 80 | return 2; |
@@ -85,7 +88,8 @@ testMultithreadedPoolGet (int poll_flag) | |||
85 | { | 88 | { |
86 | struct MHD_Daemon *d; | 89 | struct MHD_Daemon *d; |
87 | 90 | ||
88 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, | 91 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG |
92 | | poll_flag, | ||
89 | 0, NULL, NULL, &ahc_echo, "GET", | 93 | 0, NULL, NULL, &ahc_echo, "GET", |
90 | MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); | 94 | MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); |
91 | if (d == NULL) | 95 | if (d == NULL) |
@@ -103,8 +107,8 @@ testExternalGet () | |||
103 | 107 | ||
104 | d = MHD_start_daemon (MHD_USE_ERROR_LOG, | 108 | d = MHD_start_daemon (MHD_USE_ERROR_LOG, |
105 | 0, NULL, NULL, | 109 | 0, NULL, NULL, |
106 | &ahc_echo, "GET", | 110 | &ahc_echo, "GET", |
107 | MHD_OPTION_END); | 111 | MHD_OPTION_END); |
108 | if (NULL == d) | 112 | if (NULL == d) |
109 | return 8; | 113 | return 8; |
110 | MHD_stop_daemon (d); | 114 | MHD_stop_daemon (d); |
@@ -127,21 +131,21 @@ main (int argc, | |||
127 | #endif | 131 | #endif |
128 | errorCount += testExternalGet (); | 132 | errorCount += testExternalGet (); |
129 | #if defined (MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) | 133 | #if defined (MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) |
130 | if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_POLL)) | 134 | if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_POLL)) |
131 | { | 135 | { |
132 | errorCount += testInternalGet(MHD_USE_POLL); | 136 | errorCount += testInternalGet (MHD_USE_POLL); |
133 | errorCount += testMultithreadedGet(MHD_USE_POLL); | 137 | errorCount += testMultithreadedGet (MHD_USE_POLL); |
134 | errorCount += testMultithreadedPoolGet(MHD_USE_POLL); | 138 | errorCount += testMultithreadedPoolGet (MHD_USE_POLL); |
135 | } | 139 | } |
136 | if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) | 140 | if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_EPOLL)) |
137 | { | 141 | { |
138 | errorCount += testInternalGet(MHD_USE_EPOLL); | 142 | errorCount += testInternalGet (MHD_USE_EPOLL); |
139 | errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL); | 143 | errorCount += testMultithreadedPoolGet (MHD_USE_EPOLL); |
140 | } | 144 | } |
141 | #endif | 145 | #endif |
142 | if (0 != errorCount) | 146 | if (0 != errorCount) |
143 | fprintf (stderr, | 147 | fprintf (stderr, |
144 | "Error (code: %u)\n", | 148 | "Error (code: %u)\n", |
145 | errorCount); | 149 | errorCount); |
146 | return errorCount != 0; /* 0 == pass */ | 150 | return errorCount != 0; /* 0 == pass */ |
147 | } | 151 | } |