Related to ticket #149: added test in pjlib-test to capture host resolution crash

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1029 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/src/pjlib-test/sock.c b/pjlib/src/pjlib-test/sock.c
index 2eee2c5..a3df9b6 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 @@
     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 @@
     if (rc != 0)
 	return rc;
 
+    rc = gethostbyname_test();
+    if (rc != 0)
+	return rc;
+
     rc = simple_sock_test();
     if (rc != 0)
 	return rc;