summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen LaHaise <bcrl@kvack.org>2003-02-17 19:04:52 +0000
committerBen LaHaise <bcrl@kvack.org>2003-02-17 19:04:52 +0000
commit27b51b1f9ca70f433d91addc7effc10cd6123d33 (patch)
treedc93870b1f8ba34edb86e15dbd595bbe30c3a082
parentdd98c37b2d20d26c0d01c4ffc63382b899954e0b (diff)
downloadlibaio-27b51b1f9ca70f433d91addc7effc10cd6123d33.tar.gz
fix up 14.t to actually print errorslibaio.0-3-93.4
-rw-r--r--harness/cases/14.t47
1 files 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 <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <signal.h>
+
#include "aio_setup.h"
#include <sys/mman.h>
@@ -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;
+}