aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/test_upgrade.c
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-10-19 18:46:16 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-10-22 15:41:38 +0300
commitbaa2d30d1cb938e03eb1e84a30bb5436797af8d8 (patch)
treec21b2426157be3c57465dd636ae843ca17283c24 /src/microhttpd/test_upgrade.c
parent334468c467472230b25b2640ba42639d6052c654 (diff)
downloadlibmicrohttpd-baa2d30d1cb938e03eb1e84a30bb5436797af8d8.tar.gz
libmicrohttpd-baa2d30d1cb938e03eb1e84a30bb5436797af8d8.zip
test_upgrade: be more verbose, fixed build without poll()
Diffstat (limited to 'src/microhttpd/test_upgrade.c')
-rw-r--r--src/microhttpd/test_upgrade.c96
1 files changed, 76 insertions, 20 deletions
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index 68f5c2be..b369fd70 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -39,6 +39,9 @@
39#ifdef HAVE_NETINET_IP_H 39#ifdef HAVE_NETINET_IP_H
40#include <netinet/ip.h> 40#include <netinet/ip.h>
41#endif /* HAVE_NETINET_IP_H */ 41#endif /* HAVE_NETINET_IP_H */
42
43static int verbose = 0;
44#include "test_helpers.h"
42#include "test_upgrade_common.c" 45#include "test_upgrade_common.c"
43 46
44 47
@@ -102,37 +105,90 @@ main (int argc,
102 char *const *argv) 105 char *const *argv)
103{ 106{
104 int error_count = 0; 107 int error_count = 0;
108 int res;
109
110 if (has_param(argc, argv, "-v") || has_param(argc, argv, "--verbose"))
111 verbose = 1;
105 112
106 /* try external select */ 113 /* try external select */
107 error_count += test_upgrade (0, 114 res = test_upgrade (0,
108 0); 115 0);
116 error_count += res;
117 if (res)
118 fprintf (stderr, "FAILED: Upgrade with external select, return code %d.\n", res);
119 else if (verbose)
120 printf ("PASSED: Upgrade with external select.\n");
109#ifdef EPOLL_SUPPORT 121#ifdef EPOLL_SUPPORT
110 error_count += test_upgrade (MHD_USE_EPOLL, 122 res = test_upgrade (MHD_USE_EPOLL,
111 0); 123 0);
124 error_count += res;
125 if (res)
126 fprintf (stderr, "FAILED: Upgrade with external select with EPOLL, return code %d.\n", res);
127 else if (verbose)
128 printf ("PASSED: Upgrade with external select with EPOLL.\n");
112#endif 129#endif
113 130
114 /* Test thread-per-connection */ 131 /* Test thread-per-connection */
115 error_count += test_upgrade (MHD_USE_THREAD_PER_CONNECTION, 132 res = test_upgrade (MHD_USE_THREAD_PER_CONNECTION,
116 0); 133 0);
117 error_count += test_upgrade (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL, 134 error_count += res;
118 0); 135 if (res)
136 fprintf (stderr, "FAILED: Upgrade with thread per connection, return code %d.\n", res);
137 else if (verbose)
138 printf ("PASSED: Upgrade with thread per connection.\n");
139#ifdef HAVE_POLL
140 res = test_upgrade (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL,
141 0);
142 error_count += res;
143 if (res)
144 fprintf (stderr, "FAILED: Upgrade with thread per connection and poll, return code %d.\n", res);
145 else if (verbose)
146 printf ("PASSED: Upgrade with thread per connection and poll.\n");
147#endif /* HAVE_POLL */
119 148
120 /* Test different event loops, with and without thread pool */ 149 /* Test different event loops, with and without thread pool */
121 error_count += test_upgrade (MHD_USE_SELECT_INTERNALLY, 150 res = test_upgrade (MHD_USE_SELECT_INTERNALLY,
122 0); 151 0);
123 error_count += test_upgrade (MHD_USE_SELECT_INTERNALLY, 152 error_count += res;
124 2); 153 if (res)
154 fprintf (stderr, "FAILED: Upgrade with internal select, return code %d.\n", res);
155 else if (verbose)
156 printf ("PASSED: Upgrade with internal select.\n");
157 res = test_upgrade (MHD_USE_SELECT_INTERNALLY,
158 2);
159 error_count += res;
160 if (res)
161 fprintf (stderr, "FAILED: Upgrade with internal select, return code %d.\n", res);
162 else if (verbose)
163 printf ("PASSED: Upgrade with internal select.\n");
125#ifdef HAVE_POLL 164#ifdef HAVE_POLL
126 error_count += test_upgrade (MHD_USE_POLL_INTERNALLY, 165 res = test_upgrade (MHD_USE_POLL_INTERNALLY,
127 0); 166 0);
128 error_count += test_upgrade (MHD_USE_POLL_INTERNALLY, 167 error_count += res;
129 2); 168 if (res)
169 fprintf (stderr, "FAILED: Upgrade with internal poll, return code %d.\n", res);
170 else if (verbose)
171 printf ("PASSED: Upgrade with internal poll.\n");
172 res = test_upgrade (MHD_USE_POLL_INTERNALLY,
173 2);
174 if (res)
175 fprintf (stderr, "FAILED: Upgrade with internal poll with thread pool, return code %d.\n", res);
176 else if (verbose)
177 printf ("PASSED: Upgrade with internal poll with thread pool.\n");
130#endif 178#endif
131#ifdef EPOLL_SUPPORT 179#ifdef EPOLL_SUPPORT
132 error_count += test_upgrade (MHD_USE_EPOLL_INTERNALLY, 180 res = test_upgrade (MHD_USE_EPOLL_INTERNALLY,
133 0); 181 0);
134 error_count += test_upgrade (MHD_USE_EPOLL_INTERNALLY, 182 if (res)
135 2); 183 fprintf (stderr, "FAILED: Upgrade with internal epoll, return code %d.\n", res);
184 else if (verbose)
185 printf ("PASSED: Upgrade with internal epoll.\n");
186 res = test_upgrade (MHD_USE_EPOLL_INTERNALLY,
187 2);
188 if (res)
189 fprintf (stderr, "FAILED: Upgrade with internal epoll, return code %d.\n", res);
190 else if (verbose)
191 printf ("PASSED: Upgrade with internal epoll.\n");
136#endif 192#endif
137 /* report result */ 193 /* report result */
138 if (0 != error_count) 194 if (0 != error_count)