diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2009-10-09 18:17:02 +0000 |
---|---|---|
committer | <> | 2013-09-20 15:53:04 +0000 |
commit | e6a27c468cae77ce26f6aa924b22bd39055892fe (patch) | |
tree | 5799c05ec62d99e582db411ed0fe5ffd2ba519db /libaio-0.3.109/harness/cases/2.t | |
download | libaio-tarball-e6a27c468cae77ce26f6aa924b22bd39055892fe.tar.gz |
Imported from /home/lorry/working-area/delta_libaio-tarball/libaio_0.3.109.orig.tar.gz.HEADlibaio_0.3.109.origmaster
Diffstat (limited to 'libaio-0.3.109/harness/cases/2.t')
-rw-r--r-- | libaio-0.3.109/harness/cases/2.t | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libaio-0.3.109/harness/cases/2.t b/libaio-0.3.109/harness/cases/2.t new file mode 100644 index 0000000..3a0212d --- /dev/null +++ b/libaio-0.3.109/harness/cases/2.t @@ -0,0 +1,41 @@ +/* 2.t +- io_setup (#2) + - with invalid context pointer + - with maxevents <= 0 + - with an already initialized ctxp +*/ + +int attempt(int n, io_context_t *ctxp, int expect) +{ + int res; + + printf("expect %3d: io_setup(%5d, %p) = ", expect, n, ctxp); + fflush(stdout); + res = io_setup(n, ctxp); + printf("%3d [%s]%s\n", res, strerror(-res), + (res != expect) ? " -- FAILED" : ""); + if (res != expect) + return 1; + + return 0; +} + +int test_main(void) +{ + io_context_t ctx; + int status = 0; + + ctx = NULL; + status |= attempt(-1000, KERNEL_RW_POINTER, -EFAULT); + status |= attempt( 1000, KERNEL_RW_POINTER, -EFAULT); + status |= attempt( 0, KERNEL_RW_POINTER, -EFAULT); + status |= attempt(-1000, &ctx, -EINVAL); + status |= attempt( -1, &ctx, -EINVAL); + status |= attempt( 0, &ctx, -EINVAL); + assert(ctx == NULL); + status |= attempt( 1, &ctx, 0); + status |= attempt( 1, &ctx, -EINVAL); + + return status; +} + |