new testcases to test setxattr(2)/getxattr(2)
v3 cover new testcases to test setxattr(2)/getxattr(2)
Basic tests for setxattr(2)/getxattr(2) and make sure they handle error conditions correctly.
v2 -> v3:
1. Remove unnecessary variables
2. Add setxattr02 and getxattr02 testcases
v1 -> v2:
1. Statically initialize test case array
2. Use TTERRNO with TPASS and TFAIL to print TEST_ERRNO message
Eryu Guan (4):
syscalls/setxattr01: new testcase to test setxattr(2) basic function syscalls/getxattr01: new testcase to test getxattr(2) basic function syscalls/setxattr02: new testcase to test setxattr(2) syscalls/getxattr02: new testcase to test getxattr(2)
runtest/syscalls | 6 + testcases/kernel/syscalls/getxattr/Makefile | 23 +++ testcases/kernel/syscalls/getxattr/getxattr01.c | 173 +++++++++++++++++ testcases/kernel/syscalls/getxattr/getxattr02.c | 152 +++++++++++++++ testcases/kernel/syscalls/setxattr/Makefile | 23 +++ testcases/kernel/syscalls/setxattr/setxattr01.c | 223 +++++++++++++++++++++ testcases/kernel/syscalls/setxattr/setxattr02.c | 235 +++++++++++++++++++++++ 7 files changed, 835 insertions(+), 0 deletions(-) create mode 100644 testcases/kernel/syscalls/getxattr/Makefile create mode 100644 testcases/kernel/syscalls/getxattr/getxattr01.c create mode 100644 testcases/kernel/syscalls/getxattr/getxattr02.c create mode 100644 testcases/kernel/syscalls/setxattr/Makefile create mode 100644 testcases/kernel/syscalls/setxattr/setxattr01.c create mode 100644 testcases/kernel/syscalls/setxattr/setxattr02.c
Signature · 1 line
1.7.7.5
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v3 1/4 syscalls/setxattr01: new testcase to test setxattr(2) basic function
Basic tests for setxattr(2) and make sure setxattr(2) handles error conditions correctly.
There are 7 test cases:
1. Any other flags being set except XATTR_CREATE and XATTR_REPLACE, setxattr(2) should return -1 and set errno to EINVAL
2. With XATTR_REPLACE flag set but the attribute does not exist, setxattr(2) should return -1 and set errno to ENOATTR
3. Create new attr with name length greater than XATTR_NAME_MAX(255) setxattr(2) should return -1 and set errno to ERANGE
4. Create new attr whose value length is greater than XATTR_SIZE_MAX(65536) setxattr(2) should return -1 and set errno to E2BIG
5. Create new attr whose value length is zero,
setxattr(2) should succeed
6. Replace the attr value without XATTR_REPLACE flag being set, setxattr(2) should return -1 and set errno to EEXIST
7. Replace attr value with XATTR_REPLACE flag being set, setxattr(2) should succeed
--- runtest/syscalls | 2 + testcases/kernel/syscalls/setxattr/Makefile | 23 +++ testcases/kernel/syscalls/setxattr/setxattr01.c | 223 +++++++++++++++++++++++ 3 files changed, 248 insertions(+), 0 deletions(-) create mode 100644 testcases/kernel/syscalls/setxattr/Makefile create mode 100644 testcases/kernel/syscalls/setxattr/setxattr01.c
runtest/syscalls +2 -0
@@ -1018,6 +1018,8 @@ setuid03_16 setuid03_16 setuid04 setuid04 setuid04_16 setuid04_16 +setxattr01 setxattr01 + shmat01 shmat01 shmat02 shmat02 shmat03 shmat03
testcases/kernel/syscalls/setxattr/Makefile new file +23 -0
@@ -0,0 +1,23 @@ +# +# Copyright (c) Red Hat Inc., 2011 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk + +include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/setxattr/setxattr01.c new file +223 -0
223 lines not on this page · raw message
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v3 2/4 syscalls/getxattr01: new testcase to test getxattr(2) basic function
In reply to Eryu GuanBasic tests for getxattr(2) and make sure getxattr(2) handles error conditions correctly.
There are 4 test cases:
1. Get an non-existing attribute,
getxattr(2) should return -1 and set errno to ENOATTR
2. Buffer size is smaller than attribute value size, getxattr(2) should return -1 and set errno to ERANGE
3. Get attribute, getxattr(2) should succeed
4. Verify the attribute got by getxattr(2) is same as the value we set
--- runtest/syscalls | 2 + testcases/kernel/syscalls/getxattr/Makefile | 23 +++ testcases/kernel/syscalls/getxattr/getxattr01.c | 173 +++++++++++++++++++++++ 3 files changed, 198 insertions(+), 0 deletions(-) create mode 100644 testcases/kernel/syscalls/getxattr/Makefile create mode 100644 testcases/kernel/syscalls/getxattr/getxattr01.c
runtest/syscalls +2 -0
@@ -420,6 +420,8 @@ getuid02_16 getuid02_16 getuid03 getuid03 getuid03_16 getuid03_16 +getxattr01 getxattr01 + #Needs tty device. #ioctl01 ioctl01 -D /dev/tty0 #ioctl02 ioctl02 -D /dev/tty0
testcases/kernel/syscalls/getxattr/Makefile new file +23 -0
@@ -0,0 +1,23 @@ +# +# Copyright (c) Red Hat Inc., 2011 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk + +include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/getxattr/getxattr01.c new file +173 -0
173 lines not on this page · raw message
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v3 3/4 syscalls/setxattr02: new testcase to test setxattr(2)
In reply to Eryu GuanIn the user.* namespace, only regular files and directories can have extended attributes. Otherwise setxattr(2) should return -1 and set errno to EPERM.
There are 7 test cases:
1. Set attribute to a regular file, setxattr(2) should succeed
2. Set attribute to a directory, setxattr(2) should succeed
3. Set attribute to a symlink which points to the regular file, setxattr(2) should return -1 and set errno to EEXIST
4. Set attribute to a FIFO, setxattr(2) should return -1 and set errno to EPERM
5. Set attribute to a char special file, setxattr(2) should return -1 and set errno to EPERM
6. Set attribute to a block special file, setxattr(2) should return -1 and set errno to EPERM
7. Set attribute to a UNIX domain socket, setxattr(2) should return -1 and set errno to EPERM
--- runtest/syscalls | 1 + testcases/kernel/syscalls/setxattr/setxattr02.c | 235 +++++++++++++++++++++++ 2 files changed, 236 insertions(+), 0 deletions(-) create mode 100644 testcases/kernel/syscalls/setxattr/setxattr02.c
runtest/syscalls +1 -0
@@ -1021,6 +1021,7 @@ setuid04 setuid04 setuid04_16 setuid04_16 setxattr01 setxattr01 +setxattr02 setxattr02 shmat01 shmat01 shmat02 shmat02
testcases/kernel/syscalls/setxattr/setxattr02.c new file +235 -0
235 lines not on this page · raw message
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v3 3/4] syscalls/setxattr02: new testcase to test setxattr(2)
Hi!
Quoted 9 lines
testcases/kernel/syscalls/setxattr/setxattr02.c new file +9
-0+#include "test.h" +#include "usctest.h" + +#define XATTR_TEST_KEY "user.testkey" +#define XATTR_TEST_VALUE "this is a test value" +#define XATTR_TEST_VALUE_SIZE 20 + +static void setup (void ); +static void cleanup (void );
testcases/kernel/syscalls/setxattr/setxattr02.c line 75
Quoted 10 lines
testcases/kernel/syscalls/setxattr/setxattr02.c new file +10
-0+ +char *TCID ="setxattr02" ; + +char file[] ="setxattr02testfile" ; +char dir[] ="setxattr02testdir" ; +char sym[] ="setxattr02symlink" ; +char fifo[] ="setxattr02fifo" ; +char chr[] ="setxattr02chr" ; +char blk[] ="setxattr02blk" ; +char sock[] ="setxattr02sock" ;
Just to be extra correct here, there is a difference between
char *var = "foo";
and
char var[] = "foo";
The first one is const and thus not modifiable while the second is an array and as a such it may be modified at the runtime.
I think we should rather use *var = "foo" here.
Also I tend to declare global variables static as that way compiler prints warning when they became unused.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
A message that is not in the archive (sent off-list or not yet received): 20120106035408.GI30803@eguan-t400
Re: [LTP] [PATCH v3 3/4] syscalls/setxattr02: new testcase to test setxattr(2)
Hi!
Quoted 8 lines
Yes, I know the difference, but 'char *file = "foo"' will generate a compiling error like:
setxattr02.c:88:3: error: initializer element is not constant setxattr02.c:88:3: error: (near initialization for ???tc[0].fname???)
So I used 'char file[] = "foo"'.
Quoted 9 lines
That turns out to be a limitation of the C language. Quote the spec
"All the expressions in an initializer for an object that has static storage duration shall be constant expressions or string literals."
Will macro be a better way? Like:
#define FILENAME "setxattr02testfile"
#define DIRNAME "setxattr02testdir"
Ah, I see.
I think macros are better option here.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v3 4/4 syscalls/getxattr02: new testcase to test getxattr(2)
In reply to Eryu GuanIn the user.* namespace, only regular files and directories can have extended attributes. Otherwise getxattr(2) will return -1 and set errno to ENODATA.
There are 4 test cases:
1. Get attribute from a FIFO, setxattr(2) should return -1 and set errno to ENODATA
2. Get attribute from a char special file, setxattr(2) should return -1 and set errno to ENODATA
3. Get attribute from a block special file, setxattr(2) should return -1 and set errno to ENODATA
4. Get attribute from a UNIX domain socket, setxattr(2) should return -1 and set errno to ENODATA
--- runtest/syscalls | 1 + testcases/kernel/syscalls/getxattr/getxattr02.c | 152 +++++++++++++++++++++++ 2 files changed, 153 insertions(+), 0 deletions(-) create mode 100644 testcases/kernel/syscalls/getxattr/getxattr02.c
runtest/syscalls +1 -0
@@ -421,6 +421,7 @@ getuid03 getuid03 getuid03_16 getuid03_16 getxattr01 getxattr01 +getxattr02 getxattr02 #Needs tty device. #ioctl01 ioctl01 -D /dev/tty0
testcases/kernel/syscalls/getxattr/getxattr02.c new file +152 -0
152 lines not on this page · raw message
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v3 4/4] syscalls/getxattr02: new testcase to test getxattr(2)
Hi!
testcases/kernel/syscalls/getxattr/getxattr02.c line 66
Quoted 4 lines
testcases/kernel/syscalls/getxattr/getxattr02.c new file +4
-0+char fifo[] ="getxattr02fifo" ; +char chr[] ="getxattr02chr" ; +char blk[] ="getxattr02blk" ; +char sock[] ="getxattr02sock" ;
Same here.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Quoted 6 lines
v2 -> v3:
1. Remove unnecessary variables
2. Add setxattr02 and getxattr02 testcases
v1 -> v2:
1. Statically initialize test case array
2. Use TTERRNO with TPASS and TFAIL to printTEST_ERRNOmessage
First two patches commited, thanks.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list