From 27b51b1f9ca70f433d91addc7effc10cd6123d33 Mon Sep 17 00:00:00 2001 From: Ben LaHaise Date: Mon, 17 Feb 2003 19:04:52 +0000 Subject: fix up 14.t to actually print errors --- harness/cases/14.t | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/harness/cases/14.t b/harness/cases/14.t index 62a80b3..514622b 100644 --- a/harness/cases/14.t +++ b/harness/cases/14.t @@ -1,3 +1,8 @@ +#include +#include +#include +#include + #include "aio_setup.h" #include @@ -5,7 +10,7 @@ //just submit an I/O -int test_main(void) +int test_child(void) { char *buf; int rwfd; @@ -16,6 +21,8 @@ int test_main(void) int loop = 10; int i; + aio_setup(1024); + size = SIZE; printf("size = %ld\n", size); @@ -38,16 +45,46 @@ NULL); res = io_submit(io_ctx, 1, iocbs); if (res != 1) { - printf("submit: io_submit res=%d [%s]\n", res, + printf("child: submit: io_submit res=%d [%s]\n", res, strerror(-res)); - return res; + _exit(1); } } res = ftruncate(rwfd, 0); assert(res == 0); - exit(0); - + _exit(0); } +/* from 12.t */ +int test_main(void) +{ + int res, status; + pid_t pid; + + if (attempt_io_submit(io_ctx, 0, NULL, 0)) + return 1; + sigblock(sigmask(SIGCHLD) | siggetmask()); + fflush(NULL); + pid = fork(); assert(pid != -1); + + if (pid == 0) + test_child(); + + res = waitpid(pid, &status, 0); + + if (WIFEXITED(status)) { + int failed = (WEXITSTATUS(status) != 0); + printf("child exited with status %d%s\n", WEXITSTATUS(status), + failed ? " -- FAILED" : ""); + return failed; + } + + /* anything else: failed */ + if (WIFSIGNALED(status)) + printf("child killed by signal %d -- FAILED.\n", + WTERMSIG(status)); + + return 1; +} -- cgit v1.2.1