io/ltp-aiodio: fix function return value
PATCH 1/1 io/ltp-aiodio: fix function return value
Function return value is determined using tst_resm (TFAIL,) and tst_exit function
Signed-off-by liubo03 <[email protected]>
--- testcases/kernel/io/ltp-aiodio/aiodio_append.c | 9 ++++----- testcases/kernel/io/ltp-aiodio/dio_append.c | 7 ++++--- testcases/kernel/io/ltp-aiodio/dio_truncate.c | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-)
testcases/kernel/io/ltp-aiodio/aiodio_append.c +4 -5
@@ -93,7 +93,7 @@ void aiodio_append(char *filename) fd =open (filename,O_DIRECT |O_WRONLY |O_CREAT ,0666 );if (fd <0 ) { -perror ("cannot create file" ); +tst_resm (TFAIL ,"cannot create file %s" , filename);return ; }
@@ -116,7 +116,7 @@ void aiodio_append(char *filename)* Start the 1st NUM_AIO requests */ if ((w =io_submit (myctx,NUM_AIO , iocbs)) <0 ) { -fprintf (stderr,"io_submit write returned %d\n" , w); +tst_resm (TFAIL ,"io_submit write returned %d" , w); }/*
@@ -135,8 +135,7 @@ void aiodio_append(char *filename) AIO_SIZE, offset); offset +=AIO_SIZE ;if ((w =io_submit (myctx,1 , &iocbp)) <0 ) { -fprintf (stderr, -"write %d returned %d\n" , i, w); +tst_resm (TFAIL ,"write %d returned %d" , i, w); } } }
@@ -176,7 +175,7 @@ int main(int argc, char **argv) kill(pid[i], SIGTERM); } -return 0 ; +tst_exit (); }#else int main (void )
testcases/kernel/io/ltp-aiodio/dio_append.c +4 -3
@@ -85,7 +85,7 @@ void dio_append(char *filename) fd =open (filename,O_DIRECT |O_WRONLY |O_CREAT ,0666 );if (fd <0 ) { -perror ("cannot create file" ); +tst_resm (TFAIL ,"cannot create file %s" , filename);return ; }
@@ -99,7 +99,7 @@ void dio_append(char *filename)memset (bufptr,0 ,64 *1024 );for (i =0 ; i <1000 ; i++) {if ((w =write (fd, bufptr,64 *1024 )) !=64 *1024 ) { -fprintf (stderr,"write %d returned %d\n" , i, w); +tst_resm (TFAIL ,"write %d returned %d" , i, w); } } }
@@ -139,5 +139,6 @@ int main(void)for (i =0 ; i < num_children; i++) {kill (pid[i],SIGTERM ); } -return 0 ; + +tst_exit (); }
testcases/kernel/io/ltp-aiodio/dio_truncate.c +3 -3
@@ -112,7 +112,7 @@ void dio_append(char *filename, int fill) fd =open (filename,O_DIRECT |O_WRONLY |O_CREAT ,0666 );if (fd <0 ) { -perror ("cannot create file" ); +tst_resm (TFAIL ,"cannot create file %s" , filename);return ; }
@@ -127,7 +127,7 @@ void dio_append(char *filename, int fill)for (i =0 ; i <1000 ; i++) {if ((w =write (fd, bufptr,64 *1024 )) !=64 *1024 ) { -fprintf (stderr,"write %d returned %d\n" , i, w); +tst_resm (TFAIL ,"write %d returned %d" , i, w); } }close (fd);
@@ -173,5 +173,5 @@ int main(void)kill (pid[i],SIGTERM ); } -return 0 ; +tst_exit (); }
Signature · 1 line
1.8.3.1
PATCH 1/1 io/ltp-aiodio: fix function return value
Hi!
This makes it slightly better but still the most imporant part, the check in the child process, is ignored.
Easiest fix would be rewriting the tests to the new test library so that we could use tst_res(TFAIL, ...) in the child processess as well.
Signature · 2 lines
Cyril Hrubis [email protected]