summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>1999-06-08 21:55:50 +0000
committerSteve Huston <shuston@riverace.com>1999-06-08 21:55:50 +0000
commit5a677b788cad9b860baf37e8f87aa14314af689b (patch)
treefb9b705d72cc13456ebfd7a9252b62bea92e19bb /tests
parentbfd57231c1705363c66ca6d99edf9f16dea9e847 (diff)
downloadATCD-5a677b788cad9b860baf37e8f87aa14314af689b.tar.gz
If host lookups fail, note it and don't try to connect. Workaround AIX 4.3 bug.
Diffstat (limited to 'tests')
-rw-r--r--tests/SOCK_Connector_Test.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/SOCK_Connector_Test.cpp b/tests/SOCK_Connector_Test.cpp
index 4def4a3ad1d..9605321d521 100644
--- a/tests/SOCK_Connector_Test.cpp
+++ b/tests/SOCK_Connector_Test.cpp
@@ -83,7 +83,14 @@ find_another_host (ASYS_TCHAR other_host[])
ACE_OS::strcpy (other_host, ASYS_WIDE_STRING (h->h_name));
// @@ We really need to add wrappers for these hostent methods.
+
+ // AIX 4.3 has problems with DNS usage when sethostent(1) is called -
+ // further DNS lookups don't work at all.
+#if defined (ACE_AIX_MINOR_VERS) && (ACE_AIX_MINOR_VERS == 3)
+ sethostent (0);
+#else
sethostent (1);
+#endif
while ((h = gethostent ()) != NULL)
{
@@ -128,7 +135,13 @@ fail_no_listener_nonblocking (void)
find_another_host (test_host);
ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("Testing to host \"%s\"\n"), test_host));
- nobody_home.set ((u_short) 42000, test_host);
+ if (nobody_home.set ((u_short) 42000, test_host) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("Host lookup for %s %p\n"),
+ test_host, ASYS_TEXT ("failed")));
+ return -1;
+ }
+
status = con.connect (sock, nobody_home, &nonblock);
// Need a port that will fail.
@@ -159,7 +172,8 @@ fail_no_listener_nonblocking (void)
else
{
ACE_DEBUG ((LM_DEBUG,
- ASYS_TEXT ("Test not executed fully; expected EWOULDBLOCK, %p (%d)\n"),
+ ASYS_TEXT ("Test not executed fully; "
+ "expected EWOULDBLOCK, %p (%d)\n"),
ASYS_TEXT ("not"), errno));
status = -1;
}
@@ -189,7 +203,12 @@ succeed_nonblocking (void)
find_another_host (test_host);
ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("Testing to host \"%s\"\n"), test_host));
- echo_server.set ((u_short) 7, test_host);
+ if (echo_server.set ((u_short) 7, test_host) == -1)
+ {
+ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("Host lookup for %s %p\n"),
+ test_host, ASYS_TEXT ("failed")));
+ return -1;
+ }
status = con.connect (sock, echo_server, &nonblock);
// Need to test the call to 'complete' really.