io_submit01/io_submit02: Bugfix for running with the option "-i"
Hi,
I am so sorry, the patch is submitted by mistake, please ignore it.
Best regards!
GONGYI
Quoted 94 lines
For
io_submit01, addio_destroybefore test return, or the test would fail and report EAGAIN.
Forio_submit02, move theio_destroyto the suitable location, or the test would fail and report EAGAIN.Signed-off-by Zhao Gongyi <[email protected]>--- .../kernel/syscalls/io_submit/io_submit01.c | 18 ++++++++++++------ .../kernel/syscalls/io_submit/io_submit02.c | 9 ++++++--- 2 files changed, 18 insertions(+), 9 deletions(-)testcases/kernel/syscalls/io_submit/io_submit01.c +0
-6@@ -77,12 +77,6 @@ static struct tcase {static void setup (void ) { -TEST (io_setup (1 , &ctx)); -if (TST_RET == -ENOSYS ) -tst_brk (TCONF |TRERRNO ,"io_setup(): AIO not supported by kernel"); -else if (TST_RET ) -tst_brk (TBROK |TRERRNO ,"io_setup() failed" ); - io_prep_pread(&inv_fd_iocb,-1 , buf,sizeof (buf),0 );testcases/kernel/syscalls/io_submit/io_submit01.c +12
-0rdonly_fd =SAFE_OPEN ("rdonly_file" ,O_RDONLY |O_CREAT ,0777 );@@ -116,8 +110,20 @@ static void verify_io_submit(unsigned int n)struct tcase *t = &tcases[n];int ret; +memset (&ctx,0 ,sizeof (ctx)); +TEST (io_setup (1 , &ctx)); +if (TST_RET == -ENOSYS ) +tst_brk (TCONF |TRERRNO ,"io_setup(): AIO not supported by kernel"); +else if (TST_RET ) +tst_brk (TBROK |TRERRNO ,"io_setup() failed" ); + ret =io_submit (*t->ctx, t->nr, t->iocbs); +TEST (io_destroy (ctx)); +if (TST_RET ) { +tst_brk (TBROK |TRERRNO ,"io_destroy() failed" ); + } +if (ret == t->exp_errno) { tst_res(TPASS, "io_submit() with %s failed with %s",testcases/kernel/syscalls/io_submit/io_submit01.c +0
-0t->desc, errno_name(t->exp_errno));testcases/kernel/syscalls/io_submit/io_submit02.c +3
-4@@ -54,7 +54,6 @@ static inline void io_prep_option(struct iocb *cb, int fd, void *buf, static void setup(void) { -TST_EXP_PASS_SILENT (tst_syscall (__NR_io_setup,1 , &ctx)); fd =SAFE_OPEN (TEST_FILE ,O_RDONLY |O_CREAT ,MODE ); io_prep_option(&iocb, fd, buf, 0, 0, IOCB_CMD_PREAD); } @@ -64,18 +63,22 @@ static void cleanup(void)if (fd >0 )SAFE_CLOSE (fd); -if (tst_syscall (__NR_io_destroy, ctx)) -tst_brk (TBROK |TERRNO ,"io_destroy() failed" ); }static void run (unsigned int i) { +memset (tc[i].ctx,0 ,sizeof (aio_context_t)); +TST_EXP_PASS_SILENT (tst_syscall (__NR_io_setup,1 , &ctx)); +TEST (tst_syscall (__NR_io_submit, *tc[i].ctx, tc[i].nr, tc[i].iocbs));if (TST_RET == tc[i].nr)tst_res (TPASS ,"io_submit() %s" , tc[i].desc);else tst_res(TFAIL, "io_submit() returns %ld, expected %ld", TST_RET,tc[i].nr);
testcases/kernel/syscalls/io_submit/io_submit02.c +3
-1+ +if (tst_syscall (__NR_io_destroy, ctx)) +tst_brk (TBROK |TERRNO ,"io_destroy() failed" ); }static struct tst_test test = { --2.17.1
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp