From 05a3203d8274a0a0999faad128f629614b8d62c5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 26 Sep 2012 17:04:57 -0700 Subject: SH-3275 WIP Run viewer metrics for object update messages fixed various issues related to unit tests and LLThreadLocalPtr initialization and teardown --- indra/test/test.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'indra/test') diff --git a/indra/test/test.cpp b/indra/test/test.cpp index dc8580fe69..2b66c6aa26 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -512,15 +512,10 @@ int main(int argc, char **argv) ctype_workaround(); #endif - apr_initialize(); - apr_pool_t* pool = NULL; - if(APR_SUCCESS != apr_pool_create(&pool, NULL)) - { - std::cerr << "Unable to initialize pool" << std::endl; - return 1; - } + ll_init_apr(); + apr_getopt_t* os = NULL; - if(APR_SUCCESS != apr_getopt_init(&os, pool, argc, argv)) + if(APR_SUCCESS != apr_getopt_init(&os, gAPRPoolp, argc, argv)) { std::cerr << "apr_getopt_init() failed" << std::endl; return 1; @@ -602,7 +597,7 @@ int main(int argc, char **argv) if (LOGFAIL) { LLError::ELevel level = LLError::decodeLevel(LOGFAIL); - replayer.reset(new LLReplayLogReal(level, pool)); + replayer.reset(new LLReplayLogReal(level, gAPRPoolp)); } else { @@ -646,7 +641,7 @@ int main(int argc, char **argv) s.close(); } - apr_terminate(); + ll_cleanup_apr(); int retval = (success ? 0 : 1); return retval; -- cgit v1.2.3 From c136b432140f892a56d4996d5ed77e903ff0b32d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 15 Nov 2012 19:46:09 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system eliminated min and max macros from windows.h got rest of viewer to compile against llfasttimer changes --- indra/test/test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/test') diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 2b66c6aa26..8bd302ce7a 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -40,6 +40,7 @@ #include "tests/wrapllerrs.h" // RecorderProxy #include "stringize.h" #include "namedtempfile.h" +#include "lltrace.h" #include "apr_pools.h" #include "apr_getopt.h" @@ -513,7 +514,8 @@ int main(int argc, char **argv) #endif ll_init_apr(); - + LLTrace::init(); + apr_getopt_t* os = NULL; if(APR_SUCCESS != apr_getopt_init(&os, gAPRPoolp, argc, argv)) { -- cgit v1.2.3 From 68413515029f50713c70e4adec3ce6fd1022d59f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 6 Jan 2013 21:37:31 -0800 Subject: SH-3468 WIP add memory tracking base class fix for unit test failures...cleanup apr without destroying pools, allowing LLProxy to clean itself up as a singleton (and avoiding spurious dependencies associated with manually destorying singletons that rely on apr pools) --- indra/test/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/test') diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 8bd302ce7a..d75040393c 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -643,7 +643,7 @@ int main(int argc, char **argv) s.close(); } - ll_cleanup_apr(); + ll_cleanup_apr(false); int retval = (success ? 0 : 1); return retval; -- cgit v1.2.3 From 3c341a11ab7b8f3fd18afcf3f50af6dfafa632c2 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 8 Jan 2013 00:25:07 -0800 Subject: SH-3468 WIP add memory tracking base class more fixes for unit test crashes added llcommon initialization/teardown for unit tests that indirectly trigger lltrace changed access of atomic refcount to use preincrement/decrement operators to reflect desired semantics always call apr_initialize in LLCommon::initClass, even if already initialized...apr does internal reference counting to keep things straight --- indra/test/io.cpp | 11 ++++++++++- indra/test/llhttpdate_tut.cpp | 9 +++++++++ indra/test/lliohttpserver_tut.cpp | 7 +++++++ indra/test/test.cpp | 2 +- 4 files changed, 27 insertions(+), 2 deletions(-) (limited to 'indra/test') diff --git a/indra/test/io.cpp b/indra/test/io.cpp index ce747f667d..f2b4a5339c 100644 --- a/indra/test/io.cpp +++ b/indra/test/io.cpp @@ -44,6 +44,7 @@ #include "llsdrpcclient.h" #include "llsdrpcserver.h" #include "llsdserialize.h" +#include "llcommon.h" #include "lluuid.h" #include "llinstantmessage.h" @@ -830,6 +831,7 @@ namespace tut public: PumpAndChainTestData() { + LLCommon::initClass(); apr_pool_create(&mPool, NULL); mPump = new LLPumpIO(mPool); } @@ -839,6 +841,7 @@ namespace tut mChain.clear(); delete mPump; apr_pool_destroy(mPool); + LLCommon::cleanupClass(); } }; typedef test_group PumpAndChainTestGroup; @@ -909,6 +912,7 @@ namespace tut pipe_and_pump_fitness() { + LLCommon::initClass(); LLFrameTimer::updateFrameTime(); apr_pool_create(&mPool, NULL); mPump = new LLPumpIO(mPool); @@ -923,6 +927,7 @@ namespace tut mSocket.reset(); delete mPump; apr_pool_destroy(mPool); + LLCommon::cleanupClass(); } protected: @@ -1186,8 +1191,12 @@ namespace tut LLSimpleRPCResponse(LLSD* response) : mResponsePtr(response) { + LLCommon::initClass(); + } + ~LLSimpleRPCResponse() + { + LLCommon::cleanupClass(); } - ~LLSimpleRPCResponse() {} virtual bool response(LLPumpIO* pump) { *mResponsePtr = mReturnValue; diff --git a/indra/test/llhttpdate_tut.cpp b/indra/test/llhttpdate_tut.cpp index 46684bb9dc..d6f0ba5e66 100644 --- a/indra/test/llhttpdate_tut.cpp +++ b/indra/test/llhttpdate_tut.cpp @@ -29,6 +29,7 @@ #include "lltut.h" #include "lldate.h" +#include "llcommon.h" #include "llframetimer.h" #include @@ -38,6 +39,14 @@ namespace tut { struct httpdate_data { + httpdate_data() + { + LLCommon::initClass(); + } + ~httpdate_data() + { + LLCommon::cleanupClass(); + } LLDate some_date; }; typedef test_group httpdate_test; diff --git a/indra/test/lliohttpserver_tut.cpp b/indra/test/lliohttpserver_tut.cpp index 2fdc455f45..e7af09f80b 100644 --- a/indra/test/lliohttpserver_tut.cpp +++ b/indra/test/lliohttpserver_tut.cpp @@ -31,6 +31,7 @@ #include "lliohttpserver.h" #include "llsdhttpserver.h" #include "llsdserialize.h" +#include "llcommon.h" #include "llpipeutil.h" @@ -76,11 +77,17 @@ namespace tut HTTPServiceTestData() : mResponse(NULL) { + LLCommon::initClass(); LLHTTPStandardServices::useServices(); LLHTTPRegistrar::buildAllServices(mRoot); mRoot.addNode("/delayed/echo", new DelayedEcho(this)); mRoot.addNode("/wire/hello", new LLHTTPNodeForPipe); } + + ~HTTPServiceTestData() + { + LLCommon::cleanupClass(); + } LLHTTPNode mRoot; LLHTTPNode::ResponsePtr mResponse; diff --git a/indra/test/test.cpp b/indra/test/test.cpp index d75040393c..8bd302ce7a 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -643,7 +643,7 @@ int main(int argc, char **argv) s.close(); } - ll_cleanup_apr(false); + ll_cleanup_apr(); int retval = (success ? 0 : 1); return retval; -- cgit v1.2.3 From 0ba9a00c3116b69745f2d5070ce772d5d4965dbf Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 8 Jan 2013 23:50:27 -0800 Subject: SH-3468 WIP add memory tracking base class cleaned up hacks used to get unit tests working LLTrace::init now supports recursive initialization/cleanup put NOMINMAX back in win32 header wrappers --- indra/test/io.cpp | 6 ------ indra/test/llhttpdate_tut.cpp | 2 -- indra/test/lliohttpserver_tut.cpp | 2 -- indra/test/test.cpp | 2 +- 4 files changed, 1 insertion(+), 11 deletions(-) (limited to 'indra/test') diff --git a/indra/test/io.cpp b/indra/test/io.cpp index f2b4a5339c..b3eabc2e8a 100644 --- a/indra/test/io.cpp +++ b/indra/test/io.cpp @@ -831,7 +831,6 @@ namespace tut public: PumpAndChainTestData() { - LLCommon::initClass(); apr_pool_create(&mPool, NULL); mPump = new LLPumpIO(mPool); } @@ -841,7 +840,6 @@ namespace tut mChain.clear(); delete mPump; apr_pool_destroy(mPool); - LLCommon::cleanupClass(); } }; typedef test_group PumpAndChainTestGroup; @@ -912,7 +910,6 @@ namespace tut pipe_and_pump_fitness() { - LLCommon::initClass(); LLFrameTimer::updateFrameTime(); apr_pool_create(&mPool, NULL); mPump = new LLPumpIO(mPool); @@ -927,7 +924,6 @@ namespace tut mSocket.reset(); delete mPump; apr_pool_destroy(mPool); - LLCommon::cleanupClass(); } protected: @@ -1191,11 +1187,9 @@ namespace tut LLSimpleRPCResponse(LLSD* response) : mResponsePtr(response) { - LLCommon::initClass(); } ~LLSimpleRPCResponse() { - LLCommon::cleanupClass(); } virtual bool response(LLPumpIO* pump) { diff --git a/indra/test/llhttpdate_tut.cpp b/indra/test/llhttpdate_tut.cpp index d6f0ba5e66..ecf734ee90 100644 --- a/indra/test/llhttpdate_tut.cpp +++ b/indra/test/llhttpdate_tut.cpp @@ -41,11 +41,9 @@ namespace tut { httpdate_data() { - LLCommon::initClass(); } ~httpdate_data() { - LLCommon::cleanupClass(); } LLDate some_date; }; diff --git a/indra/test/lliohttpserver_tut.cpp b/indra/test/lliohttpserver_tut.cpp index e7af09f80b..3fa5c8dd42 100644 --- a/indra/test/lliohttpserver_tut.cpp +++ b/indra/test/lliohttpserver_tut.cpp @@ -77,7 +77,6 @@ namespace tut HTTPServiceTestData() : mResponse(NULL) { - LLCommon::initClass(); LLHTTPStandardServices::useServices(); LLHTTPRegistrar::buildAllServices(mRoot); mRoot.addNode("/delayed/echo", new DelayedEcho(this)); @@ -86,7 +85,6 @@ namespace tut ~HTTPServiceTestData() { - LLCommon::cleanupClass(); } LLHTTPNode mRoot; diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 8bd302ce7a..28de88201c 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -514,8 +514,8 @@ int main(int argc, char **argv) #endif ll_init_apr(); - LLTrace::init(); + LLTrace::init(); apr_getopt_t* os = NULL; if(APR_SUCCESS != apr_getopt_init(&os, gAPRPoolp, argc, argv)) { -- cgit v1.2.3