syscalls/fstat{03,05}: rewrote testcases
PATCH v3 1/1 syscalls/fstat{03,05}: rewrote testcases
Merged fstat03 and fstat05:
Both testcases had lots of duplicated code which could be removed by creating a single testcase for both scenarios.
Rewrote testcase:
Cleaned up and ported to new library.
--- runtest/syscalls | 2 - testcases/kernel/syscalls/fstat/.gitignore | 2 - testcases/kernel/syscalls/fstat/fstat03.c | 204 +++++++++--------------- testcases/kernel/syscalls/fstat/fstat05.c | 244 ----------------------------- 4 files changed, 70 insertions(+), 382 deletions(-) delete mode 100644 testcases/kernel/syscalls/fstat/fstat05.c
runtest/syscalls +0 -2
@@ -336,8 +336,6 @@ fstat02 fstat02 fstat02_64 fstat02_64 fstat03 fstat03 fstat03_64 fstat03_64 -fstat05 fstat05 -fstat05_64 fstat05_64 #fstatat64/newfstatat test cases fstatat01 fstatat01
testcases/kernel/syscalls/fstat/.gitignore +0 -2
@@ -2,5 +2,3 @@ /fstat02_64 /fstat03 /fstat03_64 -/fstat05 -/fstat05_64
testcases/kernel/syscalls/fstat/fstat03.c +70 -134
230 lines not on this page · raw message
testcases/kernel/syscalls/fstat/fstat05.c deleted +0 -244
244 lines not on this page · raw message
Signature · 1 line
2.16.4
PATCH v3 1/1 syscalls/fstat{03,05}: rewrote testcases
Hi!
Pushed with a few changes, thanks.
* Made the check for return value more strict
* Changed the code so that we do not rely on test number but on expected errno in the segfault check, this makes the test more robust in a case we would add tests to the tcase structure. Also this makes the code more clear to the reader.
* Added code to make sure the child has exitted with 0 in normal case
testcases/kernel/syscalls/fstat/fstat03.c +9 -2
@@ -42,7 +42,7 @@ static void check_fstat(unsigned int tc_num)struct tcase *tc = &tcases[tc_num];TEST (fstat (*tc->fd, tc->stat_buf)); -if (TST_RET !=0 ) { +if (TST_RET ==-1 ) {if (tc->exp_err ==TST_ERR ) { tst_res(TPASS, "fstat() fails with expected error %s",
@@ -70,8 +70,15 @@ static void run(unsigned int tc_num) }SAFE_WAITPID (pid, &status,0 ); -if (tc_num ==1 &&WTERMSIG (status) ==SIGSEGV ) +if (tcases[tc_num].exp_err ==EFAULT &&WTERMSIG (status) ==SIGSEGV ) {tst_res (TPASS ,"fstat() failed as expected with SIGSEGV" ); +return ; + } + +if (WIFEXITED (status) &&WEXITSTATUS (status) ==0 ) +return ; + +tst_res (TBROK ,"child %s" ,tst_strstatus (status)); }static void setup (void )
Signature · 2 lines
Cyril Hrubis [email protected]