* [LTP] [PATCH v2] Add more testcases in mkdir03
@ 2024-02-22 15:00 Andrea Cervesato
2024-02-22 15:10 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Andrea Cervesato @ 2024-02-22 15:00 UTC (permalink / raw)
To: ltp
From: Andrea Cervesato <andrea.cervesato@suse.com>
We add more test cases in mkdir03 in order to check that mkdir()
can't overwrite certain types of files, such as simlinks, directories,
pipes, devices, etc.
These test cases come from symlink01 refactoring.
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
Removed mkdir10
free() tmpdir
runtest/syscalls | 1 -
testcases/kernel/syscalls/mkdir/mkdir03.c | 13 +++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/runtest/syscalls b/runtest/syscalls
index ef90076e4..e913eeecd 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -757,7 +757,6 @@ mkdir02 mkdir02
mkdir03 mkdir03
mkdir04 mkdir04
mkdir05 mkdir05
-mkdir05A symlink01 -T mkdir05
mkdir09 mkdir09
#mkdirat test cases
diff --git a/testcases/kernel/syscalls/mkdir/mkdir03.c b/testcases/kernel/syscalls/mkdir/mkdir03.c
index d5141bb64..fe847bdca 100644
--- a/testcases/kernel/syscalls/mkdir/mkdir03.c
+++ b/testcases/kernel/syscalls/mkdir/mkdir03.c
@@ -9,6 +9,7 @@
* EFAULT, ENAMETOOLONG, EEXIST, ENOENT, ENOTDIR, ELOOP and EROFS
*/
+#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -19,6 +20,9 @@
#include "tst_test.h"
#define TST_EEXIST "tst_eexist"
+#define TST_PIPE "tst_pipe"
+#define TST_FOLDER "tst_folder"
+#define TST_SYMLINK "tst_symlink"
#define TST_ENOENT "tst_enoent/tst"
#define TST_ENOTDIR_FILE "tst_enotdir"
#define TST_ENOTDIR_DIR "tst_enotdir/tst"
@@ -41,6 +45,9 @@ static struct tcase {
{NULL, EFAULT},
{long_dir, ENAMETOOLONG},
{TST_EEXIST, EEXIST},
+ {TST_FOLDER, EEXIST},
+ {TST_PIPE, EEXIST},
+ {TST_SYMLINK, EEXIST},
{TST_ENOENT, ENOENT},
{TST_ENOTDIR_DIR, ENOTDIR},
{loop_dir, ELOOP},
@@ -70,7 +77,13 @@ static void verify_mkdir(unsigned int n)
static void setup(void)
{
unsigned int i;
+ char *tmpdir = tst_get_tmpdir();
+ SAFE_SYMLINK(tmpdir, TST_SYMLINK);
+ free(tmpdir);
+
+ SAFE_MKFIFO(TST_PIPE, 0777);
+ SAFE_MKDIR(TST_FOLDER, 0777);
SAFE_TOUCH(TST_EEXIST, MODE, NULL);
SAFE_TOUCH(TST_ENOTDIR_FILE, MODE, NULL);
--
2.35.3
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [LTP] [PATCH v2] Add more testcases in mkdir03
2024-02-22 15:00 [LTP] [PATCH v2] Add more testcases in mkdir03 Andrea Cervesato
@ 2024-02-22 15:10 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2024-02-22 15:10 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi!
> #define TST_ENOTDIR_DIR "tst_enotdir/tst"
> @@ -41,6 +45,9 @@ static struct tcase {
> {NULL, EFAULT},
> {long_dir, ENAMETOOLONG},
> {TST_EEXIST, EEXIST},
> + {TST_FOLDER, EEXIST},
> + {TST_PIPE, EEXIST},
> + {TST_SYMLINK, EEXIST},
This stil misses:
{"/dev/zero", EEXISTS},
> {TST_ENOENT, ENOENT},
> {TST_ENOTDIR_DIR, ENOTDIR},
> {loop_dir, ELOOP},
Other than that:
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-22 15:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-22 15:00 [LTP] [PATCH v2] Add more testcases in mkdir03 Andrea Cervesato
2024-02-22 15:10 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox