Skip to contentSkip to conversation

syscalls/getxattr03: new testcase to test getxattr(2)

PATCH In review Eryu Guan 2 participants 3 messages Jan 20, 2012

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH v2 1/2 syscalls/getxattr03: new testcase to test getxattr(2)

An empty buffer of size zero can be passed into getxattr(2) to return the current size of the named extended attribute.

---
v1->v2:
1. Use sizeof() instead of strlen to compute length of string at compile time
2. Use better described log message

 runtest/syscalls                                |    1 +
 testcases/kernel/syscalls/getxattr/getxattr03.c |  123 +++++++++++++++++++++++
 2 files changed, 124 insertions(+), 0 deletions(-)
 create mode 100644 testcases/kernel/syscalls/getxattr/getxattr03.c
runtest/syscalls +1 -0
index 4aac38c..d786746 100644
@@ -423,6 +423,7 @@ getuid03_16 getuid03_16
 
 getxattr01 getxattr01
 getxattr02 getxattr02
+getxattr03 getxattr03
 
 #Needs tty device.
 #ioctl01 ioctl01 -D /dev/tty0
testcases/kernel/syscalls/getxattr/getxattr03.c new file +123 -0

123 lines not on this page · raw message

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#1 lore raw

PATCH v2 2/2 syscalls/setxattr03: new testcase to test setxattr(2)

setxattr(2) to immutable and append-only files should get EPERM

There are 2 test cases:
1. Set attribute to a immutable file, setxattr(2) should return -1 and set errno to EPERM
2. Set attribute to a append-only file, setxattr(2) should return -1 and set errno to EPERM

---
v1->v2:
1. Use sizeof() instead of strlen to compute length of string at compile time
2. Use better described log message

 runtest/syscalls                                |    1 +
 testcases/kernel/syscalls/setxattr/setxattr03.c |  222 +++++++++++++++++++++++
 2 files changed, 223 insertions(+), 0 deletions(-)
 create mode 100644 testcases/kernel/syscalls/setxattr/setxattr03.c
runtest/syscalls +1 -0
index d786746..37dfc7e 100644
@@ -1027,6 +1027,7 @@ setuid04_16 setuid04_16
 
 setxattr01 setxattr01
 setxattr02 setxattr02
+setxattr03 setxattr03
 
 shmat01 shmat01
 shmat02 shmat02
testcases/kernel/syscalls/setxattr/setxattr03.c new file +222 -0

222 lines not on this page · raw message

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw

Re: [LTP] [PATCH v2 2/2] syscalls/setxattr03: new testcase to test setxattr(2)

Hi!
Both commited.

testcases/kernel/syscalls/setxattr/setxattr03.c line 128

Quoted 9 lines
testcases/kernel/syscalls/setxattr/setxattr03.c new file +9 -0
+	for (lc = 0; TEST_LOOPING(lc); lc++) {
+		Tst_count = 0;
+
+		for (i = 0; i < TST_TOTAL; i++)	{
+			TEST(setxattr(tc[i].fname, tc[i].key, tc[i].value,
+			    tc[i].size, tc[i].flags));
+
+			if (TEST_ERRNO == tc[i].exp_err) {
+				tst_resm(TPASS | TTERRNO, tc[i].desc);

And note that I've added format string "%s" to this line otherwise it generates "format not a string literal" warning.

Quoted 7 lines
testcases/kernel/syscalls/setxattr/setxattr03.c new file +7 -0
+			} else {
+				tst_resm(TFAIL | TTERRNO, "%s - expected errno"
+				    " %d - Got", tc[i].desc, tc[i].exp_err);
+			}
+		}
+	}
+
Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list