All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] unlink08: use TST_EXP_FAIL(), turn comment into docparse and reword, copyright update
@ 2022-09-02  6:33 Avinesh Kumar
  2022-09-05 14:45 ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Avinesh Kumar @ 2022-09-02  6:33 UTC (permalink / raw)
  To: ltp

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH v2] unlink08: use TST_EXP_FAIL(), turn comment into docparse and reword, copyright update
  2022-09-02  6:33 [LTP] [PATCH v2] unlink08: use TST_EXP_FAIL(), turn comment into docparse and reword, copyright update Avinesh Kumar
@ 2022-09-05 14:45 ` Petr Vorel
  2022-09-05 15:01   ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2022-09-05 14:45 UTC (permalink / raw)
  To: Avinesh Kumar; +Cc: ltp

Hi Avinesh,

I merged with following diff:

* kept relevant headers (It might be a good practise to keep *relevant headers -
library can be rewritten and headers removed, the build would fail).
* fixed docparse formatting (blank line before list is needed

Thanks!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH v2] unlink08: use TST_EXP_FAIL(), turn comment into docparse and reword, copyright update
  2022-09-05 14:45 ` Petr Vorel
@ 2022-09-05 15:01   ` Petr Vorel
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2022-09-05 15:01 UTC (permalink / raw)
  To: Avinesh Kumar, ltp

Hi Avinesh,

FYI I also make subject shorter (it should be ~50 characters, the rest should go
to the blank separated log body.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-05 15:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-02  6:33 [LTP] [PATCH v2] unlink08: use TST_EXP_FAIL(), turn comment into docparse and reword, copyright update Avinesh Kumar
2022-09-05 14:45 ` Petr Vorel
2022-09-05 15:01   ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.