diff options
author | Jeremy Allison <jra@samba.org> | 2013-03-08 10:09:01 -0800 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-03-22 16:26:20 +0100 |
commit | c3ee49a09944cec9ee1e41c32dd31bdc170f610c (patch) | |
tree | dbada97830ddd7dbb91493e8d15ef2ddf40e8e71 /lib/tevent | |
parent | 9624ca4f884444da3810c89c97942faef3360df4 (diff) | |
download | samba-c3ee49a09944cec9ee1e41c32dd31bdc170f610c.tar.gz samba-c3ee49a09944cec9ee1e41c32dd31bdc170f610c.tar.bz2 samba-c3ee49a09944cec9ee1e41c32dd31bdc170f610c.zip |
Solaris/Illumos/Nexenta creates pipes that are bi-directional by default.
Ensure the test code will pass against such a system (allow writes/reads
going both ways).
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'lib/tevent')
-rw-r--r-- | lib/tevent/testsuite.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/tevent/testsuite.c b/lib/tevent/testsuite.c index 8e3f4af51c..1fcfa1cac3 100644 --- a/lib/tevent/testsuite.c +++ b/lib/tevent/testsuite.c @@ -60,22 +60,28 @@ static void fde_handler_write(struct tevent_context *ev_ctx, struct tevent_fd *f } -/* These should never fire... */ +/* This will only fire if the fd's returned from pipe() are bi-directional. */ static void fde_handler_read_1(struct tevent_context *ev_ctx, struct tevent_fd *f, uint16_t flags, void *private_data) { - struct torture_context *test = (struct torture_context *)private_data; - torture_comment(test, "fde_handler_read_1 should never fire !\n"); - abort(); + int *fd = (int *)private_data; + char c; +#ifdef SA_SIGINFO + kill(getpid(), SIGUSR1); +#endif + kill(getpid(), SIGALRM); + + read(fd[1], &c, 1); + fde_count++; } -/* These should never fire... */ +/* This will only fire if the fd's returned from pipe() are bi-directional. */ static void fde_handler_write_1(struct tevent_context *ev_ctx, struct tevent_fd *f, uint16_t flags, void *private_data) { - struct torture_context *test = (struct torture_context *)private_data; - torture_comment(test, "fde_handler_write_1 should never fire !\n"); - abort(); + int *fd = (int *)private_data; + char c = 0; + write(fd[0], &c, 1); } static void finished_handler(struct tevent_context *ev_ctx, struct tevent_timer *te, @@ -133,12 +139,12 @@ static bool test_event_context(struct torture_context *test, fde_read = tevent_add_fd(ev_ctx, ev_ctx, fd[0], TEVENT_FD_READ, fde_handler_read, fd); fde_write_1 = tevent_add_fd(ev_ctx, ev_ctx, fd[0], TEVENT_FD_WRITE, - fde_handler_write_1, test); + fde_handler_write_1, fd); fde_write = tevent_add_fd(ev_ctx, ev_ctx, fd[1], TEVENT_FD_WRITE, fde_handler_write, fd); fde_read_1 = tevent_add_fd(ev_ctx, ev_ctx, fd[1], TEVENT_FD_READ, - fde_handler_read_1, test); + fde_handler_read_1, fd); tevent_fd_set_auto_close(fde_read); tevent_fd_set_auto_close(fde_write); |