From: Avinesh Kumar <akumar@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] unlink08: use TST_EXP_FAIL(), turn comment into docparse and reword, copyright update
Date: Fri, 2 Sep 2022 12:03:41 +0530 [thread overview]
Message-ID: <20220902063341.21705-1-akumar@suse.de> (raw)
Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
testcases/kernel/syscalls/unlink/unlink08.c | 37 ++++++---------------
1 file changed, 10 insertions(+), 27 deletions(-)
diff --git a/testcases/kernel/syscalls/unlink/unlink08.c b/testcases/kernel/syscalls/unlink/unlink08.c
index f3ce46ad8..f75ba06e0 100644
--- a/testcases/kernel/syscalls/unlink/unlink08.c
+++ b/testcases/kernel/syscalls/unlink/unlink08.c
@@ -1,22 +1,20 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
+ * Copyright (c) Linux Test Project, 2002-2022
* 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>
#include <stdlib.h>
-#include <sys/types.h>
#include <pwd.h>
#include "tst_test.h"
@@ -36,21 +34,7 @@ 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)
@@ -65,7 +49,6 @@ static void do_unlink(unsigned int n)
verify_unlink(cases);
exit(0);
}
-
SAFE_WAITPID(pid, NULL, 0);
} else {
verify_unlink(cases);
--
2.37.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2022-09-02 6:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 6:33 Avinesh Kumar [this message]
2022-09-05 14:45 ` [LTP] [PATCH v2] unlink08: use TST_EXP_FAIL(), turn comment into docparse and reword, copyright update Petr Vorel
2022-09-05 15:01 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220902063341.21705-1-akumar@suse.de \
--to=akumar@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox