diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2010-08-20 13:32:02 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2010-08-20 13:32:02 +0000 |
commit | c99310b44d8ce60ae5a7648a1450d936e4bafc2b (patch) | |
tree | eb2a585ce88ddd2fa1e96b3b10a2df91be7c5586 | |
parent | 6984260a18b41e6b5e49d99caef66d6243c20eda (diff) | |
download | ATCD-c99310b44d8ce60ae5a7648a1450d936e4bafc2b.tar.gz |
Fri Aug 20 13:29:22 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com>
* ace/Service_Gestalt.cpp:
One more shot at fixing the behavior of the service configurator
in the face of missing defaulted svc.conf file.
* tests/Missing_Svc_Conf_Test.cpp:
* tests/run_test.lst:
* tests/tests.mpc:
Added a proper test to ensure changes to this behavior are caught
in the future.
-rw-r--r-- | ACE/ChangeLog | 14 | ||||
-rw-r--r-- | ACE/ace/Service_Gestalt.cpp | 2 | ||||
-rw-r--r-- | ACE/tests/Missing_Svc_Conf_Test.cpp | 62 | ||||
-rw-r--r-- | ACE/tests/run_test.lst | 1 | ||||
-rw-r--r-- | ACE/tests/tests.mpc | 7 |
5 files changed, 85 insertions, 1 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 6651512ae03..0ffcdcb9e05 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,17 @@ +Fri Aug 20 13:29:22 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com> + + * ace/Service_Gestalt.cpp: + + One more shot at fixing the behavior of the service configurator + in the face of missing defaulted svc.conf file. + + * tests/Missing_Svc_Conf_Test.cpp: + * tests/run_test.lst: + * tests/tests.mpc: + + Added a proper test to ensure changes to this behavior are caught + in the future. + Fri Aug 20 11:58:20 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> * ace/TSS_T.cpp: diff --git a/ACE/ace/Service_Gestalt.cpp b/ACE/ace/Service_Gestalt.cpp index 52b76139274..899a55330b4 100644 --- a/ACE/ace/Service_Gestalt.cpp +++ b/ACE/ace/Service_Gestalt.cpp @@ -1108,7 +1108,7 @@ ACE_Service_Gestalt::open_i (const ACE_TCHAR program_name[], else { result = this->process_directives (); - if (result != -1 || errno == ENOENT) + if (result != -1) result = this->process_commandline_directives (); } diff --git a/ACE/tests/Missing_Svc_Conf_Test.cpp b/ACE/tests/Missing_Svc_Conf_Test.cpp new file mode 100644 index 00000000000..11b7594d759 --- /dev/null +++ b/ACE/tests/Missing_Svc_Conf_Test.cpp @@ -0,0 +1,62 @@ +#include "test_config.h" +#include "ace/Service_Config.h" +#include "ace/OS_NS_fcntl.h" +#include "ace/Logging_Strategy.h" + +//ACE_STATIC_SVC_REQUIRE (ACE_Logging_Strategy); + +int +run_main (int , ACE_TCHAR ** ) +{ + ACE_START_TEST (ACE_TEXT ("Missing_Svc_Conf_Test")); + + ACE_HANDLE h = ACE_OS::open (ACE_DEFAULT_SVC_CONF,O_RDONLY); + if (h != ACE_INVALID_HANDLE) + { + ACE_ERROR ((LM_ERROR,ACE_TEXT("svc.conf exists, test unable to run\n"))); + ACE_OS::close(h); + return -1; + } + + int argc = 1; + ACE_TCHAR *argv[] = {const_cast<ACE_TCHAR *>(ACE_TEXT("nosvc")),0,0,0 }; + int failcount = 0; + int result = ACE_Service_Config::open(argc, argv); + if (result != -1 || errno != ENOENT) + { + ++failcount; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("ERROR: did not get expected ENOENT, %p\n"), + ACE_TEXT("ACE_Service_Config::open"))); + } + else + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Success: defaulted Service_Config::open ") + ACE_TEXT("with missing file got expected ENOENT\n"))); + + result = ACE_Service_Config::close(); + if (result != 0) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%p\n"), + ACE_TEXT("Service_Config::close"))); + + argc = 3; + argv[1] = const_cast<ACE_TCHAR *>(ACE_TEXT("-S")); + argv[2] = const_cast<ACE_TCHAR *>(ACE_TEXT("dynamic Logger Service_Object *ACE:_make_ACE_Logging_Strategy() \"\"")); + + result = ACE_Service_Config::open(argc, argv); + if (result != 0) + { + ++failcount; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("ERROR: missing svc.conf with ") + ACE_TEXT("command line directive, %p\n"), + ACE_TEXT("ACE_Service_Config::open"))); + } + else + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Success: Service_Config::open with command line ") + ACE_TEXT("directive ignored missing svc.conf\n"))); + + ACE_END_TEST; + return failcount; +} diff --git a/ACE/tests/run_test.lst b/ACE/tests/run_test.lst index 096e1906917..6b755055c95 100644 --- a/ACE/tests/run_test.lst +++ b/ACE/tests/run_test.lst @@ -193,6 +193,7 @@ Stack_Trace_Test: SV_Shared_Memory_Test: !MSVC !Unicos !VxWorks !RH_7.1 !nsk !ACE_FOR_TAO Semaphore_Test: !ACE_FOR_TAO Service_Config_Test: !STATIC +Missing_Svc_Conf_Test: !STATIC Service_Config_Stream_Test: !STATIC !FIXED_BUGS_ONLY Sigset_Ops_Test Simple_Message_Block_Test diff --git a/ACE/tests/tests.mpc b/ACE/tests/tests.mpc index 83b88815ebe..d5403d3654b 100644 --- a/ACE/tests/tests.mpc +++ b/ACE/tests/tests.mpc @@ -1906,3 +1906,10 @@ project(Bug_3334_Regression_Test) : acetest { Bug_3334_Regression_Test.cpp } } + +project(Missing_Svc_Conf_Test) : acetest { + exename = Missing_Svc_Conf_Test + Source_Files { + Missing_Svc_Conf_Test.cpp + } +} |