unlink08: use TST_EXP_FAIL() and turn comment into docparse, reword
PATCH 1/1 unlink08: use TST_EXP_FAIL() and turn comment into docparse, reword
Signed-off-by Avinesh Kumar <[email protected]>
--- testcases/kernel/syscalls/unlink/unlink08.c | 35 +++++++-------------- 1 file changed, 11 insertions(+), 24 deletions(-)
testcases/kernel/syscalls/unlink/unlink08.c +11 -24
@@ -3,15 +3,14 @@* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. */ -/* -* Description: -* The testcase checks the various errnos of the unlink(2). -* 1) unlink() returns EACCES when deleting file in unwritable directory -* as an unprivileged user. -* 2) unlink() returns EACCES when deleting file in "unsearchable directory -* as an unprivileged user. -* 3) unlink() returns EISDIR when deleting directory for root -* 4) unlink() returns EISDIR when deleting directory for regular user +/*\ +* [Description] +* +* Verify that unlink(2) fails with +* - EACCES when no write access to the directory containing pathname. +* - EACCES when one of the directories in pathname did not allow search. +* - EISDIR when deleting directory as root user. +* - EISDIR when deleting directory as non-root user. */ #include <errno.h>
@@ -36,21 +35,9 @@ static struct test_case_t {static void verify_unlink (struct test_case_t *tc) { -TEST (unlink (tc->name)); -if (TST_RET !=-1 ) { -tst_res (TFAIL ,"unlink(<%s>) succeeded unexpectedly" , - tc->desc); -return ; - } - -if (TST_ERR == tc->exp_errno) { -tst_res (TPASS |TTERRNO ,"unlink(<%s>) failed as expected" , - tc->desc); - }else { -tst_res (TFAIL |TTERRNO , -"unlink(<%s>) failed, expected errno: %s" , - tc->desc,tst_strerrno (tc->exp_errno)); - } +TST_EXP_FAIL (unlink (tc->name), + tc->exp_errno, +"%s" , tc->desc); }static void do_unlink (unsigned int n)
Signature · 5 lines
2.36.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Avinesh,
most of the tips for unlink07 apply here as well
https://lore.kernel.org/ltp/YxBWRndhRQRF69Cl@pevik/
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp