| 210 | } |
| 211 | |
| 212 | void sockets_test ( |
| 213 | ) |
| 214 | /*! |
| 215 | requires |
| 216 | - sockets is an implementation of sockets/sockets_kernel_abstract.h |
| 217 | is instantiated with int |
| 218 | ensures |
| 219 | - runs tests on sockets for compliance with the specs |
| 220 | !*/ |
| 221 | { |
| 222 | |
| 223 | dlog << LTRACE << "starting test"; |
| 224 | serv srv; |
| 225 | |
| 226 | assigned_port = 0; |
| 227 | |
| 228 | |
| 229 | dlog << LTRACE << "spawning threads"; |
| 230 | thread_container stuff(srv); |
| 231 | |
| 232 | |
| 233 | |
| 234 | thread_function thread2(run_server, &srv); |
| 235 | |
| 236 | // wait until all the sending threads have ended |
| 237 | stuff.wait(); |
| 238 | srv.wait_for_all_connections_to_close(); |
| 239 | srv.clear(); |
| 240 | |
| 241 | if (srv.error_occurred) |
| 242 | { |
| 243 | dlog << LDEBUG << "tag: " << srv.tag; |
| 244 | cout << "srv.error_occurred, tag: " << srv.tag << endl; |
| 245 | } |
| 246 | |
| 247 | dlog << LTRACE << "ending successful test"; |
| 248 | DLIB_TEST( !srv.error_occurred); |
| 249 | DLIB_TEST( srv.got_connections); |
| 250 | } |
| 251 | |
| 252 | // ---------------------------------------------------------------------------------------- |
| 253 |
no test coverage detected