open08.c: Make use of TST_EXP_FAIL() and SAFE_CLOSE()
PATCH 1/1 open08.c: Make use of TST_EXP_FAIL() and SAFE_CLOSE()
Signed-off-by Avinesh Kumar <[email protected]>
--- testcases/kernel/syscalls/open/open08.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-)
testcases/kernel/syscalls/open/open08.c +4 -19
@@ -68,25 +68,10 @@ static struct test_case_t { {&unmapped_fname, O_CREAT, EFAULT} }; -void verify_open (unsigned int i) +static void verify_open (unsigned int i) { -TEST (open (*tcases[i].fname, tcases[i].flags, -S_IRUSR |S_IWUSR |S_IRGRP |S_IROTH )); - -if (TST_RET !=-1 ) { -tst_res (TFAIL ,"call succeeded unexpectedly" ); -return ; - } - -if (TST_ERR == tcases[i].error) { -tst_res (TPASS ,"expected failure - " -"errno = %d : %s" ,TST_ERR , -strerror (TST_ERR )); - }else { -tst_res (TFAIL ,"unexpected error - %d : %s - " -"expected %d" ,TST_ERR , -strerror (TST_ERR ), tcases[i].error); - } +TST_EXP_FAIL (open (*tcases[i].fname, tcases[i].flags,0644 ), + tcases[i].error); }static void setup (void )
@@ -105,7 +90,7 @@ static void setup(void)SAFE_SETUID (ltpuser->pw_uid); fildes =SAFE_CREAT (existing_fname,0600 ); -close (fildes); +SAFE_CLOSE (fildes); unmapped_fname =tst_get_bad_addr (NULL ); }
Signature · 5 lines
2.36.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Posted a v2 for this as I realized I should use TST_EXP_FAIL2() here.
--
Avinesh
Quoted 50 lines · Avinesh Kumar
Signed-off-by Avinesh Kumar <[email protected]>--- testcases/kernel/syscalls/open/open08.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-)testcases/kernel/syscalls/open/open08.c +4
-20@@ -68,25 +68,10 @@ static struct test_case_t { {&unmapped_fname, O_CREAT, EFAULT} }; -void verify_open (unsigned int i) +static void verify_open (unsigned int i) { -TEST (open (*tcases[i].fname, tcases[i].flags, -S_IRUSR |S_IWUSR |S_IRGRP |S_IROTH )); - -if (TST_RET !=-1 ) { -tst_res (TFAIL ,"call succeeded unexpectedly" ); -return ; - } - -if (TST_ERR == tcases[i].error) { -tst_res (TPASS ,"expected failure - " -"errno = %d : %s" ,TST_ERR , -strerror (TST_ERR )); - }else { -tst_res (TFAIL ,"unexpected error - %d : %s - " -"expected %d" ,TST_ERR , -strerror (TST_ERR ), tcases[i].error); - } +TST_EXP_FAIL (open (*tcases[i].fname, tcases[i].flags,0644 ), + tcases[i].error); }static void setup (void )@@ -105,7 +90,7 @@ static void setup(void)SAFE_SETUID (ltpuser->pw_uid); fildes =SAFE_CREAT (existing_fname,0600 ); -close (fildes); +SAFE_CLOSE (fildes); unmapped_fname =tst_get_bad_addr (NULL ); } --2.36.1
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp