From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/4] syscalls/chmod01: Convert to new API and add directory tests
Date: Wed, 11 Aug 2021 14:11:41 +0200 [thread overview]
Message-ID: <YRO+fX/4VUxyCc9J@yuki> (raw)
In-Reply-To: <20210810151518.27618-1-zhanglianjie@uniontech.com>
Hi!
Pushed with a minor changes, thanks.
full diff:
diff --git a/testcases/kernel/syscalls/chmod/chmod01.c b/testcases/kernel/syscalls/chmod/chmod01.c
index 4dd39efca..9f5ec4c67 100644
--- a/testcases/kernel/syscalls/chmod/chmod01.c
+++ b/testcases/kernel/syscalls/chmod/chmod01.c
@@ -1,22 +1,14 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- *
- * Copyright (c) International Business Machines Corp., 2001
- * 07/2001 Ported by Wayne Boyer
- *
+ * Copyright (c) International Business Machines Corp., 2001
+ * 07/2001 Ported by Wayne Boyer
*/
/*\
* [Description]
*
- * Test Description:
- * Verify that, chmod(2) succeeds when used to change the mode permissions
- * of a file or directory.
- *
- * Expected Result:
- * chmod(2) should return 0 and the mode permissions set on file should match
- * the specified mode.
- *
+ * Verify that chmod(2) succeeds when used to change the mode permissions
+ * of a file or directory.
*/
#include "tst_test.h"
@@ -25,7 +17,7 @@
#define TESTFILE "testfile"
#define TESTDIR "testdir_1"
-static int modes[] = { 0, 07, 070, 0700, 0777, 02777, 04777, 06777 };
+static int modes[] = {0, 07, 070, 0700, 0777, 02777, 04777, 06777};
static struct variant {
char *name;
@@ -43,24 +35,27 @@ static void verify_chmod(unsigned int n)
struct variant *tc = &variants[tst_variant];
TST_EXP_PASS(chmod(tc->name, mode), "chmod(%s, %04o)",
- tc->name, mode);
+ tc->name, mode);
+
if (!TST_PASS)
return;
SAFE_STAT(tc->name, &stat_buf);
stat_buf.st_mode &= ~tc->mode_mask;
- if (stat_buf.st_mode == (unsigned int)mode)
+ if (stat_buf.st_mode == (unsigned int)mode) {
tst_res(TPASS, "stat(%s) mode=%04o",
tc->name, stat_buf.st_mode);
- else
+ } else {
tst_res(TFAIL, "stat(%s) mode=%04o",
tc->name, stat_buf.st_mode);
+ }
}
static void setup(void)
{
tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
+
if (tst_variant)
SAFE_MKDIR(variants[tst_variant].name, MODE);
else
@@ -74,4 +69,3 @@ static struct tst_test test = {
.test = verify_chmod,
.needs_tmpdir = 1,
};
-
--
Cyril Hrubis
chrubis@suse.cz
prev parent reply other threads:[~2021-08-11 12:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-10 15:15 [LTP] [PATCH v2 1/4] syscalls/chmod01: Convert to new API and add directory tests zhanglianjie
2021-08-11 12:11 ` Cyril Hrubis [this message]
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=YRO+fX/4VUxyCc9J@yuki \
--to=chrubis@suse.cz \
--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