Add EINVAL error number test.

Signed-off-by: Zuo Faqi <[email protected]>
---
 testcases/kernel/syscalls/getpeername/getpeername01.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/getpeername/getpeername01.c 
b/testcases/kernel/syscalls/getpeername/getpeername01.c
index 7aa72cb..7ed90f2 100644
--- a/testcases/kernel/syscalls/getpeername/getpeername01.c
+++ b/testcases/kernel/syscalls/getpeername/getpeername01.c
@@ -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)
-- 
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

Reply via email to