diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-03-01 18:56:02 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-03-01 18:56:02 +0000 |
commit | 33a38e34d35d880a552a250927dc7430e31f8816 (patch) | |
tree | b5fccb21fd6e3fef79b2b10ab30b364cf331b406 /pjlib/src/pjlib-test | |
parent | 341422c2ad4f7b1d9a784bf473485043b9674753 (diff) |
Related to ticket #149: added test in pjlib-test to capture host resolution crash
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1029 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pjlib-test')
-rw-r--r-- | pjlib/src/pjlib-test/sock.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pjlib/src/pjlib-test/sock.c b/pjlib/src/pjlib-test/sock.c index 2eee2c5e..a3df9b63 100644 --- a/pjlib/src/pjlib-test/sock.c +++ b/pjlib/src/pjlib-test/sock.c @@ -51,6 +51,7 @@ * - pj_sock_connect() * - pj_sock_listen() * - pj_sock_accept() + * - pj_gethostbyname() * * * This file is <b>pjlib-test/sock.c</b> @@ -441,6 +442,23 @@ static int ioctl_test(void) return 0; } +static int gethostbyname_test(void) +{ + pj_str_t host; + pj_hostent he; + pj_status_t status; + + /* Testing pj_gethostbyname() with invalid host */ + host = pj_str("an-invalid-host-name"); + status = pj_gethostbyname(&host, &he); + + /* Must return failure! */ + if (status == PJ_SUCCESS) + return -20100; + else + return 0; +} + int sock_test() { int rc; @@ -451,6 +469,10 @@ int sock_test() if (rc != 0) return rc; + rc = gethostbyname_test(); + if (rc != 0) + return rc; + rc = simple_sock_test(); if (rc != 0) return rc; |