diff options
author | oci <oci@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-01-22 20:09:28 +0000 |
---|---|---|
committer | oci <oci@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-01-22 20:09:28 +0000 |
commit | 5d8174fc18419d38eef9f48c83f1fae887ed3ac8 (patch) | |
tree | 74932988a02d12a25d09015fddf8fe5dd1494404 /tests | |
parent | 07cb0158f370d07c7ae044dfd4f335da85fcd1be (diff) | |
download | ATCD-5d8174fc18419d38eef9f48c83f1fae887ed3ac8.tar.gz |
ChangeLog tag Mon Jan 22 13:51:11 2001 Phil Mesnier <mesnier_p@ociweb.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Dirent_Test.cpp | 65 | ||||
-rw-r--r-- | tests/Makefile | 1 | ||||
-rw-r--r-- | tests/run_tests.lst | 1 |
3 files changed, 67 insertions, 0 deletions
diff --git a/tests/Dirent_Test.cpp b/tests/Dirent_Test.cpp new file mode 100644 index 00000000000..6bbc387dae5 --- /dev/null +++ b/tests/Dirent_Test.cpp @@ -0,0 +1,65 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// Dirent_Test.cpp +// +// = DESCRIPTION +// This is a test of the opendir and readdir emulation provided by the +// class ACE_OS_Dirent. It is used to ensure that the emulation code +// works properly on win32. As the emulation code is not compiled in other +// platforms, this test also ensures that there is no impact to platforms +// that natively support directory scanning operations. +// +// = AUTHOR +// Phil Mesnier <mesnier_p@ociweb.com> +// +// ============================================================================ + +#include "test_config.h" +#include "ace/OS.h" + +ACE_RCSID(tests, Dirent_Test, "$Id$") + +int +main (int argc, ACE_TCHAR *argv[]) +{ + ACE_START_TEST (ACE_TEXT ("Dirent_Test")); + int status = 0; + char * testdir = "/tests"; + char * ace_wrappers = ACE_OS::getenv ("ACE_ROOT"); + + char * dirname = new char [ACE_OS::strlen(ace_wrappers) + + ACE_OS::strlen(testdir) + 1]; + ACE_OS::strcat (ACE_OS::strcpy (dirname,ace_wrappers),testdir); + DIR *directory = ACE_OS::opendir (dirname); + + int entrycount = 0; + for (; ACE_OS::readdir(directory) != 0; entrycount++); + + switch (entrycount) { + case 0 : + { + ACE_ERROR ((LM_ERROR, "readdir failed to read anything\n")); + status = -1; + break; + } + case 1 : + { + ACE_ERROR ((LM_ERROR, "readdir failed, only matched directory name\n")); + status = -1; + break; + } + default : + { + ACE_DEBUG ((LM_DEBUG, "readdir succeeded, read %d entries\n",entrycount)); + } + } + + ACE_END_TEST; + return status; +} diff --git a/tests/Makefile b/tests/Makefile index 97be1016103..22a93a82f5a 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -25,6 +25,7 @@ BIN = Aio_Platform_Test \ Collection_Test \ Config_Test \ Conn_Test \ + Dirent_Test \ DLList_Test \ DLL_Test\ Enum_Interfaces_Test \ diff --git a/tests/run_tests.lst b/tests/run_tests.lst index 59364626093..e409b82b845 100644 --- a/tests/run_tests.lst +++ b/tests/run_tests.lst @@ -9,6 +9,7 @@ Object_Manager_Test CDR_Array_Test CDR_File_Test CDR_Test +Dirent_Test Semaphore_Test TSS_Test Log_Msg_Test |