diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/t_event.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/t_event.c b/tests/t_event.c index ad3948f..706a285 100644 --- a/tests/t_event.c +++ b/tests/t_event.c | |||
| @@ -241,6 +241,28 @@ static void case_close_takes_it_out(void) { | |||
| 241 | pair_close(); | 241 | pair_close(); |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | /* A descriptor can be taken on before anybody waits for anything on it: the | ||
| 245 | full scrape parks a connection while a worker thread builds the reply. The | ||
| 246 | mechanisms disagree about what registering nothing means, so what is | ||
| 247 | checked is that asking for a filter afterwards still works. */ | ||
| 248 | static void case_add_nothing_then_ask(void) { | ||
| 249 | test_case("a descriptor added with no interest can be given some later"); | ||
| 250 | pair_open(); | ||
| 251 | CHECK(sv[0] != -1); | ||
| 252 | CHECK_INT(event_add(sv[0], 0, 7), 0); | ||
| 253 | CHECK_INT((int)write(sv[1], "x", 1), 1); | ||
| 254 | CHECK_INT(wait_for(sv[0], EVENT_IN, 200, NULL), 0); | ||
| 255 | |||
| 256 | CHECK_INT(event_modify(sv[0], EVENT_IN, 7), 0); | ||
| 257 | { | ||
| 258 | uint32_t generation = 0; | ||
| 259 | CHECK_INT(wait_for(sv[0], EVENT_IN, 500, &generation), 1); | ||
| 260 | CHECK_INT((int)generation, 7); | ||
| 261 | } | ||
| 262 | event_del(sv[0]); | ||
| 263 | pair_close(); | ||
| 264 | } | ||
| 265 | |||
| 244 | void test_event(void) { | 266 | void test_event(void) { |
| 245 | CHECK_INT(event_init(), 0); | 267 | CHECK_INT(event_init(), 0); |
| 246 | CHECK(event_mechanism() != NULL); | 268 | CHECK(event_mechanism() != NULL); |
| @@ -254,6 +276,7 @@ void test_event(void) { | |||
| 254 | case_timeout(); | 276 | case_timeout(); |
| 255 | case_unknown_descriptor(); | 277 | case_unknown_descriptor(); |
| 256 | case_close_takes_it_out(); | 278 | case_close_takes_it_out(); |
| 279 | case_add_nothing_then_ask(); | ||
| 257 | 280 | ||
| 258 | event_deinit(); | 281 | event_deinit(); |
| 259 | } | 282 | } |
