* [LTP] [PATCH v1] Add rmdir04 test
@ 2024-01-19 8:56 Andrea Cervesato
2024-02-02 17:14 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Andrea Cervesato @ 2024-01-19 8:56 UTC (permalink / raw)
To: ltp
From: Andrea Cervesato <andrea.cervesato@suse.com>
This test has been extracted from symlink01 test and it verifies
rmdir() syscall functionalities on symlink generated file.
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
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
diff --git a/runtest/syscalls b/runtest/syscalls
index 6e2407879..2c82a7f98 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -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
diff --git a/testcases/kernel/syscalls/rmdir/.gitignore b/testcases/kernel/syscalls/rmdir/.gitignore
index 1a1e18066..c68c174dc 100644
--- a/testcases/kernel/syscalls/rmdir/.gitignore
+++ b/testcases/kernel/syscalls/rmdir/.gitignore
@@ -1,3 +1,4 @@
/rmdir01
/rmdir02
/rmdir03
+/rmdir04
diff --git a/testcases/kernel/syscalls/rmdir/rmdir04.c b/testcases/kernel/syscalls/rmdir/rmdir04.c
new file mode 100644
index 000000000..4c8f11d50
--- /dev/null
+++ b/testcases/kernel/syscalls/rmdir/rmdir04.c
@@ -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 andrea.cervesato@suse.com
+ */
+
+/*\
+ * [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,
+};
--
2.35.3
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH v1] Add rmdir04 test
2024-01-19 8:56 [LTP] [PATCH v1] Add rmdir04 test Andrea Cervesato
@ 2024-02-02 17:14 ` Cyril Hrubis
2024-02-19 15:57 ` Andrea Cervesato via ltp
0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2024-02-02 17:14 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi!
> +#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.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH v1] Add rmdir04 test
2024-02-02 17:14 ` Cyril Hrubis
@ 2024-02-19 15:57 ` Andrea Cervesato via ltp
0 siblings, 0 replies; 3+ messages in thread
From: Andrea Cervesato via ltp @ 2024-02-19 15:57 UTC (permalink / raw)
To: Cyril Hrubis, Andrea Cervesato; +Cc: ltp
Hi,
please don't consider this patch anymore.
On 2/2/24 18:14, Cyril Hrubis wrote:
> Hi!
>> +#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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-19 15:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-19 8:56 [LTP] [PATCH v1] Add rmdir04 test Andrea Cervesato
2024-02-02 17:14 ` Cyril Hrubis
2024-02-19 15:57 ` Andrea Cervesato via ltp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox