X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Foserver%2Ftest%2Frun.c;h=e553f3d6a75494ba1ceb882899190c17e1ecc11f;hb=a3f893b6ac5fd0040a0610711a7eded786681d2b;hp=b093a560c56fa273745134d4e360799328c57ec6;hpb=a88d58b2667c6fbd20c7fea563eed0d92654ea39;p=ccan-lca-2011.git diff --git a/ccan/oserver/test/run.c b/ccan/oserver/test/run.c index b093a56..e553f3d 100644 --- a/ccan/oserver/test/run.c +++ b/ccan/oserver/test/run.c @@ -22,10 +22,10 @@ static void run_server(int readyfd, int exitfd) if (oserver_setup(ev, OSERVER_PORT) == NULL) exit(1); + tevent_add_fd(ev, ev, exitfd, TEVENT_FD_READ, exit_quietly, NULL); /* Tell parent we are ready to go. */ write(readyfd, "", 1); - tevent_add_fd(ev, ev, exitfd, TEVENT_FD_READ, exit_quietly, NULL); while (tevent_loop_wait(ev) == 0); } @@ -113,10 +113,12 @@ int main(int argc, char *argv[]) ok1(no_input(sfd2)); ok1(write_sall(sfd1, " 1\n")); + /* Make sure that arrives first! */ + sleep(1); ok1(write_sall(sfd2, " 2\n")); - ok1(input_is(sfd1, "Our answer is:\nQUESTION 1\n")); - ok1(input_is(sfd2, "Our answer is:\nQUESTION 2\n")); + ok1(input_is(sfd1, "I believe a better question is how many manly men mendaciously mention mending mansions?\n")); + ok1(input_is(sfd2, "I believe a better question is question 1\n")); /* Sockets should be dead now. */ ok1(read(sfd1, &c, 1) == 0);