access(2): add ELOOP, ENOTDIR, EROFS error number test
PATCH v2 1/1 access(2): add ELOOP, ENOTDIR, EROFS error number test
access/access05.c: add ELOOP, ENOTDIR error number test
new access/access06.c: add EROFS error number test
Signed-off-by Xiaoguang Wang <[email protected]>
--- runtest/ltplite | 1 + runtest/stress.part3 | 1 + runtest/syscalls | 1 + testcases/kernel/syscalls/.gitignore | 1 + testcases/kernel/syscalls/access/access05.c | 22 +++- testcases/kernel/syscalls/access/access06.c | 171 ++++++++++++++++++++++++++++ 6 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 testcases/kernel/syscalls/access/access06.c
runtest/ltplite +1 -0
@@ -66,6 +66,7 @@ access02 access02 access03 access03 access04 access04 access05 access05 +access06 access06 -D DEVICE -T DEVICE_FS_TYPE acct01 acct01 -D DEVICE -T DEVICE_FS_TYPE
runtest/stress.part3 +1 -0
@@ -8,6 +8,7 @@ access02 access02 access03 access03 access04 access04 access05 access05 +access06 access06 -D DEVICE -T DEVICE_FS_TYPE acct01 acct01 -D DEVICE -T DEVICE_FS_TYPE
runtest/syscalls +1 -0
@@ -9,6 +9,7 @@ access02 access02 access03 access03 access04 access04 access05 access05 +access06 access06 -D DEVICE -T DEVICE_FS_TYPE acct01 acct01 -D DEVICE -T DEVICE_FS_TYPE
testcases/kernel/syscalls/.gitignore +1 -0
@@ -6,6 +6,7 @@ /access/access03 /access/access04 /access/access05 +/access/access06 /acct/acct01 /add_key/add_key01 /add_key/add_key02
testcases/kernel/syscalls/access/access05.c +21 -1
@@ -32,6 +32,10 @@* if the specified file doesn't exist (or pathname is NULL). * 5. access() fails with -1 return value and sets errno to ENAMETOOLONG * if the pathname size is > PATH_MAX characters. +* 6. access() fails with -1 return value and sets errno to ENOTDIR +* if a component used as a directory in pathname is not a directory. +* 7. access() fails with -1 return value and sets errno to ELOOP +* if too many symbolic links were encountered in resolving pathname. * * 07/2001 Ported by Wayne Boyer */
@@ -56,6 +60,8 @@#define TEST_FILE2 "test_file2"#define TEST_FILE3 "test_file3"#define TEST_FILE4 "test_file4" +#define TEST_FILE5 "test_file5/test_file5" +#define TEST_FILE6 "test_file6"#if !defined(UCLINUX )
@@ -79,12 +85,15 @@ static struct test_case_t {#endif {"", W_OK, ENOENT}, {longpathname, R_OK, ENAMETOOLONG}, + {TEST_FILE5, R_OK, ENOTDIR}, + {TEST_FILE6, R_OK, ELOOP}, };char *TCID ="access05" ;int TST_TOTAL =ARRAY_SIZE (test_cases); -static int exp_enos[] = {EACCES ,EFAULT ,EINVAL ,ENOENT ,ENAMETOOLONG ,0 }; +static int exp_enos[] = {EACCES ,EFAULT ,EINVAL ,ENOENT ,ENAMETOOLONG , +ENOTDIR ,ELOOP ,0 };static const char nobody_uid[] ="nobody" ;static struct passwd *ltpuser;
@@ -172,6 +181,17 @@ static void setup(void)*the MAX length of PATH_MAX. */ memset (longpathname,'a' ,sizeof (longpathname) -1 ); + +/* create test_file5 for test ENOTDIR. */ + fd =SAFE_CREAT (cleanup,"test_file5" ,0644 ); +SAFE_CLOSE (cleanup, fd); + +/* +* create two symbolic links who point to each other for +* test ELOOP. +*/ +SAFE_SYMLINK (cleanup,"test_file6" ,"test_file7" ); +SAFE_SYMLINK (cleanup,"test_file7" ,"test_file6" ); }static void access_verify (int i)
testcases/kernel/syscalls/access/access06.c new file +171 -0
171 lines not on this page · raw message
Signature · 14 lines
1.8.2.1 ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
testcases/kernel/syscalls/access/access05.c static void setup(void) · line 187
Quoted 4 lines
testcases/kernel/syscalls/access/access05.c +4
-0+ +/* create test_file5 for test ENOTDIR. */ + fd =SAFE_CREAT (cleanup,"test_file5" ,0644 ); +SAFE_CLOSE (cleanup, fd);
Pushed after changing this to newly introduced SAFE_TOUCH(), thanks.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list