diff options
-rw-r--r-- | ACE/ChangeLog | 7 | ||||
-rw-r--r-- | ACE/tests/OS_Test.cpp | 38 |
2 files changed, 44 insertions, 1 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 2661c20e272..b201fe8f013 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,10 @@ +Tue Oct 13 09:33:48 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl> + + * tests/OS_Test.cpp: + Added test for getmacaddress, thanks to Paul Daugherty + <paul at nextalk dot com> for creating this. This is related to + bugzilla 3744 + Tue Oct 13 06:34:48 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl> * include/makeinclude/platform_linux.GNU: diff --git a/ACE/tests/OS_Test.cpp b/ACE/tests/OS_Test.cpp index 3660763048c..e0028baeb4c 100644 --- a/ACE/tests/OS_Test.cpp +++ b/ACE/tests/OS_Test.cpp @@ -25,6 +25,7 @@ #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_ctype.h" +#include "ace/OS_NS_netdb.h" ACE_RCSID(tests, OS_Test, "$Id$") @@ -90,7 +91,7 @@ fileno_test (void) ACE_ERROR ((LM_ERROR, ACE_TEXT ("stderr test failed.\n"))); test_status = -1; } - + return test_status; } @@ -1137,6 +1138,38 @@ ace_ctype_test (void) } int +getmacaddress_test (void) +{ + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing getmacaddress\n"))); + +#if defined (ACE_LACKS_NETWORKING) + return 0; +#else /* ACE_LACKS_NETWORKING */ + struct ACE_OS::macaddr_node_t node; + + ACE_OS::memset (&node, 0x0, sizeof (node)); + int retval = ACE_OS::getmacaddress (&node); + if (retval == 0) + { + if (node.node[0] == 0x0 && node.node[1] == 0x0 && node.node[2] == 0x0 && + node.node[3] == 0x0 && node.node[4] == 0x0 && node.node[5] == 0x0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_OS::getmacaddress() failed to get MAC address\n"))); + ++retval; + } + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_OS::getmacaddress() returned %d, should be 0\n"), + retval)); + } + return retval; +#endif /* ACE_LACKS_NETWORKING */ +} + +int ceil_test (void) { ACE_DEBUG ((LM_DEBUG, @@ -1260,6 +1293,9 @@ run_main (int, ACE_TCHAR *[]) if ((result = ace_ctype_test ()) != 0) status = result; + if ((result = getmacaddress_test ()) != 0) + status = result; + ACE_END_TEST; return status; } |