[LTP] [PATCH] unlink08: use TST_EXP_FAIL() and turn comment into docparse, reword
Avinesh Kumar
akumar@suse.de
Fri Jul 15 09:12:16 CEST 2022
Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
testcases/kernel/syscalls/unlink/unlink08.c | 35 +++++++--------------
1 file changed, 11 insertions(+), 24 deletions(-)
diff --git a/testcases/kernel/syscalls/unlink/unlink08.c b/testcases/kernel/syscalls/unlink/unlink08.c
index f3ce46ad8..d16607540 100644
--- a/testcases/kernel/syscalls/unlink/unlink08.c
+++ b/testcases/kernel/syscalls/unlink/unlink08.c
@@ -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)
--
2.36.1
More information about the ltp
mailing list