Skip to contentSkip to conversation

getpeername/getpeername01.c: add EINVAL error number test

PATCH In review zenglg.jy 2 participants 2 messages Dec 13, 2013 – Feb 5, 2014

lore
Share & tools
lore

zenglg.jy

author
#0 lore raw

PATCH 2/2 getpeername/getpeername01.c: add EINVAL error number test

Add EINVAL error number test.

---
 testcases/kernel/syscalls/getpeername/getpeername01.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/getpeername/getpeername01.c +5 -1
index 7aa72cb..7ed90f2 100644
@@ -39,6 +39,7 @@
 static struct sockaddr_in server_addr;
 static struct sockaddr_in fsin1;
 static socklen_t sinlen;
+static socklen_t invalid_sinlen;
 static int sv[2];
 
 static void setup(void);
@@ -72,12 +73,14 @@ struct test_case_t {
 	 cleanup4, "EFAULT"},
 	{-1, (struct sockaddr *)&fsin1, (socklen_t *)1, -1, EFAULT, setup4,
 	 cleanup4, "EFAULT"},
+	{-1, (struct sockaddr *)&fsin1, &invalid_sinlen, -1, EINVAL, setup4,
+	 cleanup4, "EINVAL"},
 #endif
 };
 
 char *TCID = "getpeername01";
 int TST_TOTAL = ARRAY_SIZE(test_cases);
-static int exp_enos[] = { EBADF, ENOTSOCK, ENOTCONN, EFAULT, 0 };
+static int exp_enos[] = { EBADF, ENOTSOCK, ENOTCONN, EFAULT, EINVAL, 0 };
 
 int main(int argc, char *argv[])
 {
@@ -141,6 +144,7 @@ static void setup(void)
 	server_addr.sin_addr.s_addr = INADDR_ANY;
 
 	sinlen = sizeof(fsin1);
+	invalid_sinlen = -1;
 }
 
 static void cleanup(void)
Signature · 15 lines
1.8.2.1




------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

Hi!

Quoted 20 lines

Add EINVAL error number test.

---
 testcases/kernel/syscalls/getpeername/getpeername01.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/getpeername/getpeername01.c +1 -0
index 7aa72cb..7ed90f2 100644
@@ -39,6 +39,7 @@
 static struct sockaddr_in server_addr;
 static struct sockaddr_in fsin1;
 static socklen_t sinlen;
+static socklen_t invalid_sinlen;
 static int sv[2];
 
 static void setup(void);

testcases/kernel/syscalls/getpeername/getpeername01.c struct test_case_t { · line 79

Quoted 7 lines
testcases/kernel/syscalls/getpeername/getpeername01.c +2 -0
@@ -72,12 +73,14 @@ struct test_case_t {
 	 cleanup4, "EFAULT"},
 	{-1, (struct sockaddr *)&fsin1, (socklen_t *)1, -1, EFAULT, setup4,
 	 cleanup4, "EFAULT"},
+	{-1, (struct sockaddr *)&fsin1, &invalid_sinlen, -1, EINVAL, setup4,
+	 cleanup4, "EINVAL"},
 #endif
 };

I've moved the new test before the UCLINUX ifdef because the test should work on uClinux.

Pushed both patches, thanks.

Signature · 12 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list