aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/test_start_stop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/test_start_stop.c')
-rw-r--r--src/microhttpd/test_start_stop.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/microhttpd/test_start_stop.c b/src/microhttpd/test_start_stop.c
index d2e160b0..d27291b8 100644
--- a/src/microhttpd/test_start_stop.c
+++ b/src/microhttpd/test_start_stop.c
@@ -52,6 +52,7 @@ ahc_echo (void *cls,
52} 52}
53 53
54 54
55#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
55static int 56static int
56testInternalGet (int poll_flag) 57testInternalGet (int poll_flag)
57{ 58{
@@ -78,6 +79,7 @@ testMultithreadedGet (int poll_flag)
78 return 0; 79 return 0;
79} 80}
80 81
82
81static int 83static int
82testMultithreadedPoolGet (int poll_flag) 84testMultithreadedPoolGet (int poll_flag)
83{ 85{
@@ -91,6 +93,8 @@ testMultithreadedPoolGet (int poll_flag)
91 MHD_stop_daemon (d); 93 MHD_stop_daemon (d);
92 return 0; 94 return 0;
93} 95}
96#endif
97
94 98
95static int 99static int
96testExternalGet () 100testExternalGet ()
@@ -98,8 +102,10 @@ testExternalGet ()
98 struct MHD_Daemon *d; 102 struct MHD_Daemon *d;
99 103
100 d = MHD_start_daemon (MHD_USE_ERROR_LOG, 104 d = MHD_start_daemon (MHD_USE_ERROR_LOG,
101 0, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); 105 0, NULL, NULL,
102 if (d == NULL) 106 &ahc_echo, "GET",
107 MHD_OPTION_END);
108 if (NULL == d)
103 return 8; 109 return 8;
104 MHD_stop_daemon (d); 110 MHD_stop_daemon (d);
105 return 0; 111 return 0;
@@ -107,15 +113,20 @@ testExternalGet ()
107 113
108 114
109int 115int
110main (int argc, char *const *argv) 116main (int argc,
117 char *const *argv)
111{ 118{
112 unsigned int errorCount = 0; 119 unsigned int errorCount = 0;
113 (void)argc; (void)argv; /* Unused. Silent compiler warning. */ 120 (void) argc;
121 (void) argv; /* Unused. Silence compiler warning. */
114 122
123#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
115 errorCount += testInternalGet (0); 124 errorCount += testInternalGet (0);
116 errorCount += testMultithreadedGet (0); 125 errorCount += testMultithreadedGet (0);
117 errorCount += testMultithreadedPoolGet (0); 126 errorCount += testMultithreadedPoolGet (0);
127#endif
118 errorCount += testExternalGet (); 128 errorCount += testExternalGet ();
129#if defined (MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
119 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_POLL)) 130 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_POLL))
120 { 131 {
121 errorCount += testInternalGet(MHD_USE_POLL); 132 errorCount += testInternalGet(MHD_USE_POLL);
@@ -127,7 +138,10 @@ main (int argc, char *const *argv)
127 errorCount += testInternalGet(MHD_USE_EPOLL); 138 errorCount += testInternalGet(MHD_USE_EPOLL);
128 errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL); 139 errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL);
129 } 140 }
130 if (errorCount != 0) 141#endif
131 fprintf (stderr, "Error (code: %u)\n", errorCount); 142 if (0 != errorCount)
143 fprintf (stderr,
144 "Error (code: %u)\n",
145 errorCount);
132 return errorCount != 0; /* 0 == pass */ 146 return errorCount != 0; /* 0 == pass */
133} 147}