io_submit: fix broken testcase

io_submit01 contains 4 negative testing: EINVAL, EFAULT, EINVAL+EFAULT
and EBADF. The first 3 testcases didn't initialize the content of 'ctx'
so that they contained invalid argument in the cases. This may cause
incorrect result on some architectures, like:

io_submit01    1  TPASS  :  expected failure - returned value = 22 : Invalid argument
io_submit01    2  TFAIL  :  unexpected returned value - -22 - expected -14
io_submit01    3  TPASS  :  expected failure - returned value = 22 : Invalid argument
io_submit01    4  TPASS  :  expected failure - returned value = 9 : Bad file descriptor

I fixed this issue by moving the initialization of ctx before the cases,
also added some additional negative + positive cases. Now tested on x86
and s390x system, the results seem good:

io_submit01    1  TPASS  :  expected failure - returned value = -22 : Invalid argument
io_submit01    2  TPASS  :  expected failure - returned value = -22 : Invalid argument
io_submit01    3  TPASS  :  expected failure - returned value = -22 : Invalid argument
io_submit01    4  TPASS  :  expected failure - returned value = -14 : Bad address
io_submit01    5  TPASS  :  expected failure - returned value = -22 : Invalid argument
io_submit01    6  TPASS  :  expected failure - returned value = -9 : Bad file descriptor
io_submit01    7  TPASS  :  expected success - returned value = 0
io_submit01    8  TPASS  :  expected success - returned value = 1

Reviewed-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Caspar Zhang <czhang@redhat.com>
1 file changed