diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2009-10-13 09:33:46 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2009-10-13 09:33:46 +0000 |
commit | 563d26297ee4383072be89877c00455b0e48aa99 (patch) | |
tree | 3ec36dc9c26676476bfd44509273acb82151f684 /ACE/tests/OS_Test.cpp | |
parent | 9db4f0cb3faca3ec7fd531a62fe5a6d1480071e2 (diff) | |
download | ATCD-563d26297ee4383072be89877c00455b0e48aa99.tar.gz |
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
Diffstat (limited to 'ACE/tests/OS_Test.cpp')
-rw-r--r-- | ACE/tests/OS_Test.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
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; } |