Skip to content

Commit 23ea0f0

Browse files
JawsKimwangli5665
authored andcommitted
open: clean up make check findings
Fix various issues reported by `make check` in open syscall tests: - Replace space indentation with tabs - Remove extra blank lines - Mark setup/cleanup helpers as static - Add missing SPDX-License-Identifier - Fix typo in error message - Fix documentation comments Signed-off-by: Jinseok Kim <always.starving0@gmail.com> Reviewed-by: Li Wang <liwang@redhat.com>
1 parent bcca82b commit 23ea0f0

File tree

6 files changed

+9
-10
lines changed

6 files changed

+9
-10
lines changed

testcases/kernel/syscalls/open/open01.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 06/2017 Modified by Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
66
*/
77

8-
/*
8+
/*\
99
* DESCRIPTION
1010
* Open a file with oflag = O_CREAT set, does it set the sticky bit off?
1111
* Open a dir with O_DIRECTORY, does it set the S_IFDIR bit on?
@@ -46,7 +46,7 @@ static void verify_open(unsigned int n)
4646
struct stat buf;
4747

4848
TST_EXP_FD_SILENT(open(tc->filename, tc->flag, tc->mode),
49-
"open() with %s", tc->desc);
49+
"open() with %s", tc->desc);
5050
if (!TST_PASS)
5151
return;
5252

testcases/kernel/syscalls/open/open02.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static struct tcase {
2929
{TEST_FILE2, O_RDONLY | O_NOATIME, EPERM, "unprivileged O_RDONLY | O_NOATIME"},
3030
};
3131

32-
void setup(void)
32+
static void setup(void)
3333
{
3434
struct passwd *ltpuser;
3535

@@ -45,10 +45,10 @@ static void verify_open(unsigned int n)
4545
struct tcase *tc = &tcases[n];
4646

4747
TST_EXP_FAIL2(open(tc->filename, tc->flag, 0444),
48-
tc->exp_errno, "open() %s", tc->desc);
48+
tc->exp_errno, "open() %s", tc->desc);
4949
}
5050

51-
void cleanup(void)
51+
static void cleanup(void)
5252
{
5353
SAFE_SETEUID(0);
5454
}

testcases/kernel/syscalls/open/open03.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ static void verify_open(void)
1919
SAFE_UNLINK(TEST_FILE);
2020
}
2121

22-
23-
2422
static struct tst_test test = {
2523
.needs_tmpdir = 1,
2624
.test_all = verify_open,

testcases/kernel/syscalls/open/open11.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ static void verify_open(unsigned int n)
269269
{
270270
if (tc[n].err > 0) {
271271
TST_EXP_FAIL2(open(tc[n].path, tc[n].flags, tc[n].mode),
272-
tc[n].err, "%s", tc[n].desc);
272+
tc[n].err, "%s", tc[n].desc);
273273
} else if (tc[n].err == 0) {
274274
TST_EXP_FD(open(tc[n].path, tc[n].flags, tc[n].mode),
275-
"%s", tc[n].desc);
275+
"%s", tc[n].desc);
276276
} else {
277277
TEST(open(tc[n].path, tc[n].flags, tc[n].mode));
278278
tst_res(TPASS, "%s", tc[n].desc);

testcases/kernel/syscalls/open/open12_child.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
12
/*
23
* Copyright (c) 2014 Fujitsu Ltd.
34
* Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>

testcases/kernel/syscalls/open/open14.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static int read_file(int fd)
108108
SAFE_READ(0, fd, tmp, size);
109109

110110
if (memcmp(buf, tmp, size)) {
111-
tst_res(TFAIL, "got unexepected data");
111+
tst_res(TFAIL, "got unexpected data");
112112
return 1;
113113
}
114114
}

0 commit comments

Comments
 (0)