Add rmdir04 test
PATCH 1/1 Add rmdir04 test
From: Andrea Cervesato <[email protected]>
This test has been extracted from symlink01 test and it verifies rmdir() syscall functionalities on symlink generated file.
Signed-off-by Andrea Cervesato <[email protected]>
--- runtest/syscalls | 2 +- testcases/kernel/syscalls/rmdir/.gitignore | 1 + testcases/kernel/syscalls/rmdir/rmdir04.c | 30 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 testcases/kernel/syscalls/rmdir/rmdir04.c
runtest/syscalls +1 -1
@@ -1187,7 +1187,7 @@ request_key05 request_key05 rmdir01 rmdir01 rmdir02 rmdir02 rmdir03 rmdir03 -rmdir03A symlink01 -T rmdir03 +rmdir04 rmdir04 rt_sigaction01 rt_sigaction01 rt_sigaction02 rt_sigaction02
testcases/kernel/syscalls/rmdir/.gitignore +1 -0
@@ -1,3 +1,4 @@ /rmdir01 /rmdir02 /rmdir03 +/rmdir04
testcases/kernel/syscalls/rmdir/rmdir04.c new file +30 -0
@@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. +* Author: David Fenner +* Copilot: Jon Hendrickson +* Copyright (C) 2024 Andrea Cervesato [email protected] +*/ + +/*\ +* [Description] +* +* This test verifies that rmdir() can't overwrite symlink() generated files. +*/ + +#include "tst_test.h" + +static void run (void ) +{ +char *symname ="my_symlink0" ; + +SAFE_SYMLINK (tst_get_tmpdir (), symname); +TST_EXP_FAIL (rmdir (symname),ENOTDIR ); + +SAFE_UNLINK (symname); +} + +static struct tst_test test = { + .test_all = run, + .needs_tmpdir =1 , +};
Signature · 5 lines
2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
testcases/kernel/syscalls/rmdir/rmdir04.c line 25
Quoted 11 lines
testcases/kernel/syscalls/rmdir/rmdir04.c new file +11
-0+#include "tst_test.h" + +static void run (void ) +{ +char *symname ="my_symlink0" ; + +SAFE_SYMLINK (tst_get_tmpdir (), symname); +TST_EXP_FAIL (rmdir (symname),ENOTDIR ); + +SAFE_UNLINK (symname); +}
Here as well, easily added to rmdir02 along with a few more different ENOTDIR cases.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
please don't consider this patch anymore.
Quoted 15 lines · Cyril Hrubis
Hi!
testcases/kernel/syscalls/rmdir/rmdir04.c line 25
Quoted 11 lines
testcases/kernel/syscalls/rmdir/rmdir04.c new file +11
-0+#include "tst_test.h" + +static void run (void ) +{ +char *symname ="my_symlink0" ; + +SAFE_SYMLINK (tst_get_tmpdir (), symname); +TST_EXP_FAIL (rmdir (symname),ENOTDIR ); + +SAFE_UNLINK (symname); +}Here as well, easily added to rmdir02 along with a few more different ENOTDIR cases.
Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp