debuggers.hg

view tools/libaio/harness/cases/2.t @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children
line source
1 /* 2.t
2 - io_setup (#2)
3 - with invalid context pointer
4 - with maxevents <= 0
5 - with an already initialized ctxp
6 */
8 int attempt(int n, io_context_t *ctxp, int expect)
9 {
10 int res;
12 printf("expect %3d: io_setup(%5d, %p) = ", expect, n, ctxp);
13 fflush(stdout);
14 res = io_setup(n, ctxp);
15 printf("%3d [%s]%s\n", res, strerror(-res),
16 (res != expect) ? " -- FAILED" : "");
17 if (res != expect)
18 return 1;
20 return 0;
21 }
23 int test_main(void)
24 {
25 io_context_t ctx;
26 int status = 0;
28 ctx = NULL;
29 status |= attempt(-1000, KERNEL_RW_POINTER, -EFAULT);
30 status |= attempt( 1000, KERNEL_RW_POINTER, -EFAULT);
31 status |= attempt( 0, KERNEL_RW_POINTER, -EFAULT);
32 status |= attempt(-1000, &ctx, -EINVAL);
33 status |= attempt( -1, &ctx, -EINVAL);
34 status |= attempt( 0, &ctx, -EINVAL);
35 assert(ctx == NULL);
36 status |= attempt( 1, &ctx, 0);
37 status |= attempt( 1, &ctx, -EINVAL);
39 return status;
40 }