summaryrefslogtreecommitdiff
path: root/indra/llcorehttp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcorehttp')
-rw-r--r--indra/llcorehttp/CMakeLists.txt16
-rw-r--r--indra/llcorehttp/_httpoprequest.cpp33
-rw-r--r--indra/llcorehttp/_httpreplyqueue.cpp1
-rw-r--r--indra/llcorehttp/_httpreplyqueue.h2
-rw-r--r--indra/llcorehttp/_httprequestqueue.cpp12
-rw-r--r--indra/llcorehttp/_httprequestqueue.h2
-rw-r--r--indra/llcorehttp/_httpservice.cpp8
-rw-r--r--indra/llcorehttp/bufferarray.cpp2
-rw-r--r--indra/llcorehttp/examples/http_texture_load.cpp10
-rw-r--r--indra/llcorehttp/httpcommon.cpp56
-rw-r--r--indra/llcorehttp/httpcommon.h1
-rw-r--r--indra/llcorehttp/httpoptions.cpp11
-rw-r--r--indra/llcorehttp/httpoptions.h11
-rwxr-xr-xindra/llcorehttp/tests/llcorehttp_test.cpp17
-rw-r--r--indra/llcorehttp/tests/test_allocator.cpp18
-rw-r--r--indra/llcorehttp/tests/test_allocator.h13
-rw-r--r--indra/llcorehttp/tests/test_bufferarray.hpp52
-rw-r--r--indra/llcorehttp/tests/test_bufferstream.hpp52
-rw-r--r--indra/llcorehttp/tests/test_httpheaders.hpp40
-rw-r--r--indra/llcorehttp/tests/test_httpoperation.hpp26
-rw-r--r--indra/llcorehttp/tests/test_httprequest.hpp215
-rw-r--r--indra/llcorehttp/tests/test_httprequestqueue.hpp31
-rw-r--r--indra/llcorehttp/tests/test_refcounted.hpp37
23 files changed, 99 insertions, 567 deletions
diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt
index 9dbc6f447e..6a301ad50d 100644
--- a/indra/llcorehttp/CMakeLists.txt
+++ b/indra/llcorehttp/CMakeLists.txt
@@ -13,6 +13,7 @@ include(LLAddBuildTest)
include(LLMessage)
include(LLCommon)
include(Tut)
+include(bugsplat)
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
@@ -101,12 +102,13 @@ target_link_libraries(
)
# tests
-if (LL_TESTS)
+set(LLCOREHTTP_TESTS ON CACHE BOOL
+ "Build and run llcorehttp integration tests specifically")
+if (LL_TESTS AND LLCOREHTTP_TESTS)
SET(llcorehttp_TEST_SOURCE_FILES
- tests/test_allocator.cpp
)
- set(llcorehttp_TEST_HEADER_FILS
+ set(llcorehttp_TEST_HEADER_FILES
tests/test_httpstatus.hpp
tests/test_refcounted.hpp
tests/test_httpoperation.hpp
@@ -149,7 +151,7 @@ if (LL_TESTS)
${PYTHON_EXECUTABLE}
"${CMAKE_CURRENT_SOURCE_DIR}/tests/test_llcorehttp_peer.py"
)
-
+
if (DARWIN)
# Path inside the app bundle where we'll need to copy libraries
set(LL_TEST_DESTINATION_DIR
@@ -175,8 +177,8 @@ if (DARWIN)
set(copy_dylibs
libapr-1.0.dylib
libaprutil-1.0.dylib
- libexception_handler.dylib
libnghttp2*.dylib
+ liburiparser*.dylib
${EXPAT_COPY}
)
@@ -198,6 +200,7 @@ endif (DARWIN)
)
set(example_libs
+ ${LEGACY_STDIO_LIBS}
${LLCOREHTTP_LIBRARIES}
${WINDOWS_LIBRARIES}
${LLMESSAGE_LIBRARIES}
@@ -231,5 +234,4 @@ endif (DARWIN)
target_link_libraries(http_texture_load ${example_libs})
-endif (LL_TESTS)
-
+endif (LL_TESTS AND LLCOREHTTP_TESTS)
diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp
index 0f76ff23ea..ba31290c24 100644
--- a/indra/llcorehttp/_httpoprequest.cpp
+++ b/indra/llcorehttp/_httpoprequest.cpp
@@ -567,16 +567,9 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
// Use the viewer-based thread-safe API which has a
// fast/safe check for proxy enable. Would like to
// encapsulate this someway...
- if (LLProxy::instanceExists())
- {
- // Make sure proxy won't be initialized from here,
- // it might conflict with LLStartUp::startLLProxy()
- LLProxy::getInstance()->applyProxySettings(mCurlHandle);
- }
- else
- {
- LL_WARNS() << "Proxy is not initialized!" << LL_ENDL;
- }
+ // Make sure proxy won't be getInstance() from here,
+ // it is not thread safe
+ LLProxy::applyProxySettings(mCurlHandle);
}
else if (gpolicy.mHttpProxy.size())
@@ -817,6 +810,7 @@ size_t HttpOpRequest::readCallback(void * data, size_t size, size_t nmemb, void
const size_t do_size((std::min)(req_size, body_size - op->mCurlBodyPos));
const size_t read_size(op->mReqBody->read(op->mCurlBodyPos, static_cast<char *>(data), do_size));
+ // FIXME: singleton's instance() is Thread unsafe! Even if stats accumulators inside are.
HTTPStats::instance().recordDataUp(read_size);
op->mCurlBodyPos += read_size;
return read_size;
@@ -1007,11 +1001,20 @@ CURLcode HttpOpRequest::curlSslCtxCallback(CURL *curl, void *sslctx, void *userd
{
HttpOpRequest::ptr_t op(HttpOpRequest::fromHandle<HttpOpRequest>(userdata));
- if (op->mCallbackSSLVerify)
- {
- SSL_CTX * ctx = (SSL_CTX *)sslctx;
- // disable any default verification for server certs
- SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
+ if (op->mCallbackSSLVerify)
+ {
+ SSL_CTX * ctx = (SSL_CTX *)sslctx;
+ if (op->mReqOptions && op->mReqOptions->getSSLVerifyPeer())
+ {
+ // verification for ssl certs
+ SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL);
+ }
+ else
+ {
+ // disable any default verification for server certs
+ // Ex: setting urls (assume non-SL) for parcel media in LLFloaterURLEntry
+ SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
+ }
// set the verification callback.
SSL_CTX_set_cert_verify_callback(ctx, sslCertVerifyCallback, userdata);
// the calls are void
diff --git a/indra/llcorehttp/_httpreplyqueue.cpp b/indra/llcorehttp/_httpreplyqueue.cpp
index 2b138f3ad5..229bfdbe07 100644
--- a/indra/llcorehttp/_httpreplyqueue.cpp
+++ b/indra/llcorehttp/_httpreplyqueue.cpp
@@ -56,7 +56,6 @@ void HttpReplyQueue::addOp(const HttpReplyQueue::opPtr_t &op)
mQueue.push_back(op);
}
- mQueueCV.notify_all();
}
diff --git a/indra/llcorehttp/_httpreplyqueue.h b/indra/llcorehttp/_httpreplyqueue.h
index 0e39e22dde..33e205c1c9 100644
--- a/indra/llcorehttp/_httpreplyqueue.h
+++ b/indra/llcorehttp/_httpreplyqueue.h
@@ -30,6 +30,7 @@
#include "_refcounted.h"
#include "_mutex.h"
+#include "boost/noncopyable.hpp"
namespace LLCore
@@ -97,7 +98,6 @@ protected:
OpContainer mQueue;
LLCoreInt::HttpMutex mQueueMutex;
- LLCoreInt::HttpConditionVariable mQueueCV;
}; // end class HttpReplyQueue
diff --git a/indra/llcorehttp/_httprequestqueue.cpp b/indra/llcorehttp/_httprequestqueue.cpp
index c6f4ad789f..ad72bdcce6 100644
--- a/indra/llcorehttp/_httprequestqueue.cpp
+++ b/indra/llcorehttp/_httprequestqueue.cpp
@@ -142,13 +142,19 @@ void HttpRequestQueue::wakeAll()
}
-void HttpRequestQueue::stopQueue()
+bool HttpRequestQueue::stopQueue()
{
{
HttpScopedLock lock(mQueueMutex);
- mQueueStopped = true;
- wakeAll();
+ if (!mQueueStopped)
+ {
+ mQueueStopped = true;
+ wakeAll();
+ return true;
+ }
+ wakeAll();
+ return false;
}
}
diff --git a/indra/llcorehttp/_httprequestqueue.h b/indra/llcorehttp/_httprequestqueue.h
index 3c3d134b07..f0296f30e3 100644
--- a/indra/llcorehttp/_httprequestqueue.h
+++ b/indra/llcorehttp/_httprequestqueue.h
@@ -124,7 +124,7 @@ public:
/// them on their way.
///
/// Threading: callable by any thread.
- void stopQueue();
+ bool stopQueue();
protected:
static HttpRequestQueue * sInstance;
diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp
index 0b72b53186..56f52f1b09 100644
--- a/indra/llcorehttp/_httpservice.cpp
+++ b/indra/llcorehttp/_httpservice.cpp
@@ -87,7 +87,11 @@ HttpService::~HttpService()
// is a bit tricky.
if (mRequestQueue)
{
- mRequestQueue->stopQueue();
+ if (mRequestQueue->stopQueue())
+ {
+ // Give mRequestQueue a chance to finish
+ ms_sleep(10);
+ }
}
if (mThread)
@@ -318,7 +322,7 @@ void HttpService::threadRun(LLCoreInt::HttpThread * thread)
{
LOG_UNHANDLED_EXCEPTION("");
}
- catch (std::bad_alloc)
+ catch (std::bad_alloc&)
{
LLMemory::logMemoryInfo(TRUE);
diff --git a/indra/llcorehttp/bufferarray.cpp b/indra/llcorehttp/bufferarray.cpp
index be534b3ce4..e0b2876a00 100644
--- a/indra/llcorehttp/bufferarray.cpp
+++ b/indra/llcorehttp/bufferarray.cpp
@@ -147,7 +147,7 @@ size_t BufferArray::append(const void * src, size_t len)
{
block = Block::alloc(BLOCK_ALLOC_SIZE);
}
- catch (std::bad_alloc)
+ catch (std::bad_alloc&)
{
LLMemory::logMemoryInfo(TRUE);
diff --git a/indra/llcorehttp/examples/http_texture_load.cpp b/indra/llcorehttp/examples/http_texture_load.cpp
index b91aaf0593..c7376042b3 100644
--- a/indra/llcorehttp/examples/http_texture_load.cpp
+++ b/indra/llcorehttp/examples/http_texture_load.cpp
@@ -52,7 +52,7 @@
void init_curl();
void term_curl();
-unsigned long ssl_thread_id_callback(void);
+void ssl_thread_id_callback(CRYPTO_THREADID*);
void ssl_locking_callback(int mode, int type, const char * file, int line);
void usage(std::ostream & out);
@@ -624,7 +624,7 @@ void init_curl()
}
CRYPTO_set_locking_callback(ssl_locking_callback);
- CRYPTO_set_id_callback(ssl_thread_id_callback);
+ CRYPTO_THREADID_set_callback(ssl_thread_id_callback);
}
}
@@ -640,12 +640,12 @@ void term_curl()
}
-unsigned long ssl_thread_id_callback(void)
+void ssl_thread_id_callback(CRYPTO_THREADID* pthreadid)
{
#if defined(WIN32)
- return (unsigned long) GetCurrentThread();
+ CRYPTO_THREADID_set_pointer(pthreadid, GetCurrentThread());
#else
- return (unsigned long) pthread_self();
+ CRYPTO_THREADID_set_pointer(pthreadid, pthread_self());
#endif
}
diff --git a/indra/llcorehttp/httpcommon.cpp b/indra/llcorehttp/httpcommon.cpp
index 7c93c54cdf..61ba83594e 100644
--- a/indra/llcorehttp/httpcommon.cpp
+++ b/indra/llcorehttp/httpcommon.cpp
@@ -23,13 +23,6 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-#if LL_WINDOWS
-#define SAFE_SSL 1
-#elif LL_DARWIN
-#define SAFE_SSL 1
-#else
-#define SAFE_SSL 1
-#endif
#include "linden_common.h" // Modifies curl/curl.h interfaces
#include "httpcommon.h"
@@ -38,9 +31,6 @@
#include <curl/curl.h>
#include <string>
#include <sstream>
-#if SAFE_SSL
-#include <openssl/crypto.h>
-#endif
namespace LLCore
@@ -280,9 +270,6 @@ namespace LLHttp
{
namespace
{
-typedef boost::shared_ptr<LLMutex> LLMutex_ptr;
-std::vector<LLMutex_ptr> sSSLMutex;
-
CURL *getCurlTemplateHandle()
{
static CURL *curlpTemplateHandle = NULL;
@@ -347,33 +334,6 @@ void deallocateEasyCurl(CURL *curlp)
}
-#if SAFE_SSL
-//static
-void ssl_locking_callback(int mode, int type, const char *file, int line)
-{
- if (type >= sSSLMutex.size())
- {
- LL_WARNS() << "Attempt to get unknown MUTEX in SSL Lock." << LL_ENDL;
- }
-
- if (mode & CRYPTO_LOCK)
- {
- sSSLMutex[type]->lock();
- }
- else
- {
- sSSLMutex[type]->unlock();
- }
-}
-
-//static
-unsigned long ssl_thread_id(void)
-{
- return LLThread::currentID();
-}
-#endif
-
-
}
void initialize()
@@ -385,27 +345,11 @@ void initialize()
check_curl_code(code, CURL_GLOBAL_ALL);
-#if SAFE_SSL
- S32 mutex_count = CRYPTO_num_locks();
- for (S32 i = 0; i < mutex_count; i++)
- {
- sSSLMutex.push_back(LLMutex_ptr(new LLMutex()));
- }
- CRYPTO_set_id_callback(&ssl_thread_id);
- CRYPTO_set_locking_callback(&ssl_locking_callback);
-#endif
-
}
void cleanup()
{
-#if SAFE_SSL
- CRYPTO_set_id_callback(NULL);
- CRYPTO_set_locking_callback(NULL);
- sSSLMutex.clear();
-#endif
-
curl_global_cleanup();
}
diff --git a/indra/llcorehttp/httpcommon.h b/indra/llcorehttp/httpcommon.h
index e4bd4957f8..18505e0aad 100644
--- a/indra/llcorehttp/httpcommon.h
+++ b/indra/llcorehttp/httpcommon.h
@@ -193,6 +193,7 @@
#include "boost/shared_ptr.hpp"
#include "boost/weak_ptr.hpp"
#include "boost/function.hpp"
+#include "boost/noncopyable.hpp"
#include <string>
#include <curl/curl.h>
diff --git a/indra/llcorehttp/httpoptions.cpp b/indra/llcorehttp/httpoptions.cpp
index df5aa52fa9..c6365e5091 100644
--- a/indra/llcorehttp/httpoptions.cpp
+++ b/indra/llcorehttp/httpoptions.cpp
@@ -32,6 +32,7 @@
namespace LLCore
{
+ bool HttpOptions::sDefaultVerifyPeer = false;
HttpOptions::HttpOptions() :
mWantHeaders(false),
@@ -43,7 +44,7 @@ HttpOptions::HttpOptions() :
mMaxRetryBackoff(HTTP_RETRY_BACKOFF_MAX_DEFAULT),
mUseRetryAfter(HTTP_USE_RETRY_AFTER_DEFAULT),
mFollowRedirects(true),
- mVerifyPeer(false),
+ mVerifyPeer(sDefaultVerifyPeer),
mVerifyHost(false),
mDNSCacheTimeout(-1L),
mNoBody(false)
@@ -122,7 +123,15 @@ void HttpOptions::setHeadersOnly(bool nobody)
{
mNoBody = nobody;
if (mNoBody)
+ {
setWantHeaders(true);
+ setSSLVerifyPeer(false);
+ }
+}
+
+void HttpOptions::setDefaultSSLVerifyPeer(bool verify)
+{
+ sDefaultVerifyPeer = verify;
}
} // end namespace LLCore
diff --git a/indra/llcorehttp/httpoptions.h b/indra/llcorehttp/httpoptions.h
index 8a6de61b04..41f71896b0 100644
--- a/indra/llcorehttp/httpoptions.h
+++ b/indra/llcorehttp/httpoptions.h
@@ -143,7 +143,7 @@ public:
/// Instructs the LLCore::HTTPRequest to verify that the exchanged security
/// certificate is authentic.
- /// Default: false
+ /// Default: sDefaultVerifyPeer
void setSSLVerifyPeer(bool verify);
bool getSSLVerifyPeer() const
{
@@ -177,6 +177,13 @@ public:
{
return mNoBody;
}
+
+ /// Sets default behavior for verifying that the name in the
+ /// security certificate matches the name of the host contacted.
+ /// Defaults false if not set, but should be set according to
+ /// viewer's initialization options and command argunments, see
+ /// NoVerifySSLCert
+ static void setDefaultSSLVerifyPeer(bool verify);
protected:
bool mWantHeaders;
@@ -192,6 +199,8 @@ protected:
bool mVerifyHost;
int mDNSCacheTimeout;
bool mNoBody;
+
+ static bool sDefaultVerifyPeer;
}; // end class HttpOptions
diff --git a/indra/llcorehttp/tests/llcorehttp_test.cpp b/indra/llcorehttp/tests/llcorehttp_test.cpp
index a310fc0508..362b2309ee 100755
--- a/indra/llcorehttp/tests/llcorehttp_test.cpp
+++ b/indra/llcorehttp/tests/llcorehttp_test.cpp
@@ -41,14 +41,19 @@
#include "test_httpstatus.hpp"
#include "test_refcounted.hpp"
#include "test_httpoperation.hpp"
+// As of 2019-06-28, test_httprequest.hpp consistently crashes on Mac Release
+// builds for reasons not yet diagnosed.
+#if ! (LL_DARWIN && LL_RELEASE)
#include "test_httprequest.hpp"
+#endif
#include "test_httpheaders.hpp"
#include "test_httprequestqueue.hpp"
+#include "_httpservice.h"
#include "llproxy.h"
#include "llcleanup.h"
-unsigned long ssl_thread_id_callback(void);
+void ssl_thread_id_callback(CRYPTO_THREADID*);
void ssl_locking_callback(int mode, int type, const char * file, int line);
#if 0 // lltut provides main and runner
@@ -93,7 +98,7 @@ void init_curl()
}
CRYPTO_set_locking_callback(ssl_locking_callback);
- CRYPTO_set_id_callback(ssl_thread_id_callback);
+ CRYPTO_THREADID_set_callback(ssl_thread_id_callback);
}
LLProxy::getInstance();
@@ -113,12 +118,12 @@ void term_curl()
}
-unsigned long ssl_thread_id_callback(void)
+void ssl_thread_id_callback(CRYPTO_THREADID* pthreadid)
{
#if defined(WIN32)
- return (unsigned long) GetCurrentThread();
+ CRYPTO_THREADID_set_pointer(pthreadid, GetCurrentThread());
#else
- return (unsigned long) pthread_self();
+ CRYPTO_THREADID_set_pointer(pthreadid, pthread_self());
#endif
}
@@ -172,5 +177,3 @@ void stop_thread(LLCore::HttpRequest * req)
}
}
}
-
-
diff --git a/indra/llcorehttp/tests/test_allocator.cpp b/indra/llcorehttp/tests/test_allocator.cpp
index ea12dc58eb..597e0d2fc9 100644
--- a/indra/llcorehttp/tests/test_allocator.cpp
+++ b/indra/llcorehttp/tests/test_allocator.cpp
@@ -43,16 +43,6 @@
#include <boost/thread.hpp>
-
-#if defined(WIN32)
-#define THROW_BAD_ALLOC() _THROW1(std::bad_alloc)
-#define THROW_NOTHING() _THROW0()
-#else
-#define THROW_BAD_ALLOC() throw(std::bad_alloc)
-#define THROW_NOTHING() throw()
-#endif
-
-
struct BlockHeader
{
struct Block * next;
@@ -152,19 +142,19 @@ std::size_t GetMemTotal()
}
-void * operator new(std::size_t size) THROW_BAD_ALLOC()
+void * operator new(std::size_t size) //throw(std::bad_alloc)
{
return GetMem( size );
}
-void * operator new[](std::size_t size) THROW_BAD_ALLOC()
+void * operator new[](std::size_t size) //throw(std::bad_alloc)
{
return GetMem( size );
}
-void operator delete(void * p) THROW_NOTHING()
+void operator delete(void * p) throw()
{
if (p)
{
@@ -173,7 +163,7 @@ void operator delete(void * p) THROW_NOTHING()
}
-void operator delete[](void * p) THROW_NOTHING()
+void operator delete[](void * p) throw()
{
if (p)
{
diff --git a/indra/llcorehttp/tests/test_allocator.h b/indra/llcorehttp/tests/test_allocator.h
index 3572bbc5c5..abd88f4c98 100644
--- a/indra/llcorehttp/tests/test_allocator.h
+++ b/indra/llcorehttp/tests/test_allocator.h
@@ -30,18 +30,13 @@
#include <cstdlib>
#include <new>
+#error 2019-06-27 Do not use test_allocator.h -- does not respect alignment.
+
size_t GetMemTotal();
-#if defined(WIN32)
-void * operator new(std::size_t size) _THROW1(std::bad_alloc);
-void * operator new[](std::size_t size) _THROW1(std::bad_alloc);
-void operator delete(void * p) _THROW0();
-void operator delete[](void * p) _THROW0();
-#else
-void * operator new(std::size_t size) throw (std::bad_alloc);
-void * operator new[](std::size_t size) throw (std::bad_alloc);
+void * operator new(std::size_t size); //throw (std::bad_alloc);
+void * operator new[](std::size_t size); //throw (std::bad_alloc);
void operator delete(void * p) throw ();
void operator delete[](void * p) throw ();
-#endif
#endif // TEST_ALLOCATOR_H
diff --git a/indra/llcorehttp/tests/test_bufferarray.hpp b/indra/llcorehttp/tests/test_bufferarray.hpp
index 8a2a64d970..cc4ad2a906 100644
--- a/indra/llcorehttp/tests/test_bufferarray.hpp
+++ b/indra/llcorehttp/tests/test_bufferarray.hpp
@@ -30,8 +30,6 @@
#include <iostream>
-#include "test_allocator.h"
-
using namespace LLCore;
@@ -44,7 +42,6 @@ struct BufferArrayTestData
{
// the test objects inherit from this so the member functions and variables
// can be referenced directly inside of the test functions.
- size_t mMemTotal;
};
typedef test_group<BufferArrayTestData> BufferArrayTestGroupType;
@@ -56,13 +53,9 @@ void BufferArrayTestObjectType::test<1>()
{
set_test_name("BufferArray construction");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
BufferArray * ba = new BufferArray();
ensure("One ref on construction of BufferArray", ba->getRefCount() == 1);
- ensure("Memory being used", mMemTotal < GetMemTotal());
ensure("Nothing in BA", 0 == ba->size());
// Try to read
@@ -72,9 +65,6 @@ void BufferArrayTestObjectType::test<1>()
// release the implicit reference, causing the object to be released
ba->release();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -82,9 +72,6 @@ void BufferArrayTestObjectType::test<2>()
{
set_test_name("BufferArray single write");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
BufferArray * ba = new BufferArray();
@@ -105,9 +92,6 @@ void BufferArrayTestObjectType::test<2>()
// release the implicit reference, causing the object to be released
ba->release();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
@@ -116,9 +100,6 @@ void BufferArrayTestObjectType::test<3>()
{
set_test_name("BufferArray multiple writes");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
BufferArray * ba = new BufferArray();
@@ -154,9 +135,6 @@ void BufferArrayTestObjectType::test<3>()
// release the implicit reference, causing the object to be released
ba->release();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -164,9 +142,6 @@ void BufferArrayTestObjectType::test<4>()
{
set_test_name("BufferArray overwriting");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
BufferArray * ba = new BufferArray();
@@ -208,9 +183,6 @@ void BufferArrayTestObjectType::test<4>()
// release the implicit reference, causing the object to be released
ba->release();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -218,9 +190,6 @@ void BufferArrayTestObjectType::test<5>()
{
set_test_name("BufferArray multiple writes - sequential reads");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
BufferArray * ba = new BufferArray();
@@ -255,9 +224,6 @@ void BufferArrayTestObjectType::test<5>()
// release the implicit reference, causing the object to be released
ba->release();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -265,9 +231,6 @@ void BufferArrayTestObjectType::test<6>()
{
set_test_name("BufferArray overwrite spanning blocks and appending");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
BufferArray * ba = new BufferArray();
@@ -306,9 +269,6 @@ void BufferArrayTestObjectType::test<6>()
// release the implicit reference, causing the object to be released
ba->release();
-
- // make sure we didn't leak any memory
- ensure("All memory released", mMemTotal == GetMemTotal());
}
template <> template <>
@@ -316,9 +276,6 @@ void BufferArrayTestObjectType::test<7>()
{
set_test_name("BufferArray overwrite spanning blocks and sequential writes");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
BufferArray * ba = new BufferArray();
@@ -371,9 +328,6 @@ void BufferArrayTestObjectType::test<7>()
// release the implicit reference, causing the object to be released
ba->release();
-
- // make sure we didn't leak any memory
- ensure("All memory released", mMemTotal == GetMemTotal());
}
template <> template <>
@@ -381,9 +335,6 @@ void BufferArrayTestObjectType::test<8>()
{
set_test_name("BufferArray zero-length appendBufferAlloc");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
BufferArray * ba = new BufferArray();
@@ -421,9 +372,6 @@ void BufferArrayTestObjectType::test<8>()
// release the implicit reference, causing the object to be released
ba->release();
-
- // make sure we didn't leak any memory
- ensure("All memory released", mMemTotal == GetMemTotal());
}
} // end namespace tut
diff --git a/indra/llcorehttp/tests/test_bufferstream.hpp b/indra/llcorehttp/tests/test_bufferstream.hpp
index 831c901b9d..2739a6e38e 100644
--- a/indra/llcorehttp/tests/test_bufferstream.hpp
+++ b/indra/llcorehttp/tests/test_bufferstream.hpp
@@ -30,7 +30,6 @@
#include <iostream>
-#include "test_allocator.h"
#include "llsd.h"
#include "llsdserialize.h"
@@ -45,7 +44,6 @@ struct BufferStreamTestData
{
// the test objects inherit from this so the member functions and variables
// can be referenced directly inside of the test functions.
- size_t mMemTotal;
};
typedef test_group<BufferStreamTestData> BufferStreamTestGroupType;
@@ -59,12 +57,8 @@ void BufferStreamTestObjectType::test<1>()
{
set_test_name("BufferArrayStreamBuf construction with NULL BufferArray");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(NULL);
- ensure("Memory being used", mMemTotal < GetMemTotal());
// Not much will work with a NULL
ensure("underflow() on NULL fails", tst_traits_t::eof() == bsb->underflow());
@@ -78,9 +72,6 @@ void BufferStreamTestObjectType::test<1>()
// release the implicit reference, causing the object to be released
delete bsb;
bsb = NULL;
-
- // make sure we didn't leak any memory
- ensure("Allocated memory returned", mMemTotal == GetMemTotal());
}
@@ -89,12 +80,8 @@ void BufferStreamTestObjectType::test<2>()
{
set_test_name("BufferArrayStream construction with NULL BufferArray");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
BufferArrayStream * bas = new BufferArrayStream(NULL);
- ensure("Memory being used", mMemTotal < GetMemTotal());
// Not much will work with a NULL here
ensure("eof() is false on NULL", ! bas->eof());
@@ -104,9 +91,6 @@ void BufferStreamTestObjectType::test<2>()
// release the implicit reference, causing the object to be released
delete bas;
bas = NULL;
-
- // make sure we didn't leak any memory
- ensure("Allocated memory returned", mMemTotal == GetMemTotal());
}
@@ -115,13 +99,9 @@ void BufferStreamTestObjectType::test<3>()
{
set_test_name("BufferArrayStreamBuf construction with empty BufferArray");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted BufferArray with implicit reference
BufferArray * ba = new BufferArray;
BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(ba);
- ensure("Memory being used", mMemTotal < GetMemTotal());
// I can release my ref on the BA
ba->release();
@@ -130,9 +110,6 @@ void BufferStreamTestObjectType::test<3>()
// release the implicit reference, causing the object to be released
delete bsb;
bsb = NULL;
-
- // make sure we didn't leak any memory
- ensure("Allocated memory returned", mMemTotal == GetMemTotal());
}
@@ -141,24 +118,17 @@ void BufferStreamTestObjectType::test<4>()
{
set_test_name("BufferArrayStream construction with empty BufferArray");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted BufferArray with implicit reference
BufferArray * ba = new BufferArray;
{
// create a new ref counted object with an implicit reference
BufferArrayStream bas(ba);
- ensure("Memory being used", mMemTotal < GetMemTotal());
}
// release the implicit reference, causing the object to be released
ba->release();
ba = NULL;
-
- // make sure we didn't leak any memory
- ensure("Allocated memory returned", mMemTotal == GetMemTotal());
}
@@ -167,9 +137,6 @@ void BufferStreamTestObjectType::test<5>()
{
set_test_name("BufferArrayStreamBuf construction with real BufferArray");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted BufferArray with implicit reference
BufferArray * ba = new BufferArray;
const char * content("This is a string. A fragment.");
@@ -178,7 +145,6 @@ void BufferStreamTestObjectType::test<5>()
// Creat an adapter for the BufferArray
BufferArrayStreamBuf * bsb = new BufferArrayStreamBuf(ba);
- ensure("Memory being used", mMemTotal < GetMemTotal());
// I can release my ref on the BA
ba->release();
@@ -206,9 +172,6 @@ void BufferStreamTestObjectType::test<5>()
// release the implicit reference, causing the object to be released
delete bsb;
bsb = NULL;
-
- // make sure we didn't leak any memory
- ensure("Allocated memory returned", mMemTotal == GetMemTotal());
}
@@ -217,9 +180,6 @@ void BufferStreamTestObjectType::test<6>()
{
set_test_name("BufferArrayStream construction with real BufferArray");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted BufferArray with implicit reference
BufferArray * ba = new BufferArray;
//const char * content("This is a string. A fragment.");
@@ -229,7 +189,6 @@ void BufferStreamTestObjectType::test<6>()
{
// Creat an adapter for the BufferArray
BufferArrayStream bas(ba);
- ensure("Memory being used", mMemTotal < GetMemTotal());
// Basic operations
bas << "Hello" << 27 << ".";
@@ -243,10 +202,6 @@ void BufferStreamTestObjectType::test<6>()
// release the implicit reference, causing the object to be released
ba->release();
ba = NULL;
-
- // make sure we didn't leak any memory
- // ensure("Allocated memory returned", mMemTotal == GetMemTotal());
- // static U64 mem = GetMemTotal();
}
@@ -255,16 +210,12 @@ void BufferStreamTestObjectType::test<7>()
{
set_test_name("BufferArrayStream with LLSD serialization");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted BufferArray with implicit reference
BufferArray * ba = new BufferArray;
{
// Creat an adapter for the BufferArray
BufferArrayStream bas(ba);
- ensure("Memory being used", mMemTotal < GetMemTotal());
// LLSD
LLSD llsd = LLSD::emptyMap();
@@ -292,9 +243,6 @@ void BufferStreamTestObjectType::test<7>()
// release the implicit reference, causing the object to be released
ba->release();
ba = NULL;
-
- // make sure we didn't leak any memory
- // ensure("Allocated memory returned", mMemTotal == GetMemTotal());
}
diff --git a/indra/llcorehttp/tests/test_httpheaders.hpp b/indra/llcorehttp/tests/test_httpheaders.hpp
index c05f1d9429..6aefb5054b 100644
--- a/indra/llcorehttp/tests/test_httpheaders.hpp
+++ b/indra/llcorehttp/tests/test_httpheaders.hpp
@@ -30,8 +30,6 @@
#include <iostream>
-#include "test_allocator.h"
-
using namespace LLCoreInt;
@@ -43,7 +41,6 @@ struct HttpHeadersTestData
{
// the test objects inherit from this so the member functions and variables
// can be referenced directly inside of the test functions.
- size_t mMemTotal;
};
typedef test_group<HttpHeadersTestData> HttpHeadersTestGroupType;
@@ -55,19 +52,12 @@ void HttpHeadersTestObjectType::test<1>()
{
set_test_name("HttpHeaders construction");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders());
- ensure("Memory being used", mMemTotal < GetMemTotal());
ensure("Nothing in headers", 0 == headers->size());
// release the implicit reference, causing the object to be released
headers.reset();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -75,9 +65,6 @@ void HttpHeadersTestObjectType::test<2>()
{
set_test_name("HttpHeaders construction");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders());
@@ -101,9 +88,6 @@ void HttpHeadersTestObjectType::test<2>()
// release the implicit reference, causing the object to be released
headers.reset();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -111,9 +95,6 @@ void HttpHeadersTestObjectType::test<3>()
{
set_test_name("HttpHeaders basic find");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders());
@@ -151,9 +132,6 @@ void HttpHeadersTestObjectType::test<3>()
// release the implicit reference, causing the object to be released
headers.reset();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -161,9 +139,6 @@ void HttpHeadersTestObjectType::test<4>()
{
set_test_name("HttpHeaders normalized header entry");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders());
@@ -251,9 +226,6 @@ void HttpHeadersTestObjectType::test<4>()
// release the implicit reference, causing the object to be released
headers.reset();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
// Verify forward iterator finds everything as expected
@@ -262,9 +234,6 @@ void HttpHeadersTestObjectType::test<5>()
{
set_test_name("HttpHeaders iterator tests");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders());
@@ -337,9 +306,6 @@ void HttpHeadersTestObjectType::test<5>()
// release the implicit reference, causing the object to be released
headers.reset();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
// Reverse iterators find everything as expected
@@ -348,9 +314,6 @@ void HttpHeadersTestObjectType::test<6>()
{
set_test_name("HttpHeaders reverse iterator tests");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
HttpHeaders::ptr_t headers = HttpHeaders::ptr_t(new HttpHeaders());
@@ -421,9 +384,6 @@ void HttpHeadersTestObjectType::test<6>()
// release the implicit reference, causing the object to be released
headers.reset();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
} // end namespace tut
diff --git a/indra/llcorehttp/tests/test_httpoperation.hpp b/indra/llcorehttp/tests/test_httpoperation.hpp
index e7df2337de..c6407e8d04 100644
--- a/indra/llcorehttp/tests/test_httpoperation.hpp
+++ b/indra/llcorehttp/tests/test_httpoperation.hpp
@@ -31,8 +31,6 @@
#include <iostream>
-#include "test_allocator.h"
-
using namespace LLCoreInt;
@@ -60,7 +58,6 @@ namespace tut
{
// the test objects inherit from this so the member functions and variables
// can be referenced directly inside of the test functions.
- size_t mMemTotal;
};
typedef test_group<HttpOperationTestData> HttpOperationTestGroupType;
@@ -72,19 +69,12 @@ namespace tut
{
set_test_name("HttpOpNull construction");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
HttpOperation::ptr_t op (new HttpOpNull());
ensure(op.use_count() == 1);
- ensure(mMemTotal < GetMemTotal());
-
- // release the implicit reference, causing the object to be released
- op.reset();
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
+ // release the implicit reference, causing the object to be released
+ op.reset();
}
template <> template <>
@@ -92,9 +82,6 @@ namespace tut
{
set_test_name("HttpOpNull construction with handlers");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// Get some handlers
LLCore::HttpHandler::ptr_t h1 (new TestHandler());
@@ -109,13 +96,10 @@ namespace tut
// release the reference, releasing the operation but
// not the handlers.
- op.reset();
- ensure(mMemTotal != GetMemTotal());
-
- // release the handlers
- h1.reset();
+ op.reset();
- ensure(mMemTotal == GetMemTotal());
+ // release the handlers
+ h1.reset();
}
}
diff --git a/indra/llcorehttp/tests/test_httprequest.hpp b/indra/llcorehttp/tests/test_httprequest.hpp
index e65588e48f..3cdd17919d 100644
--- a/indra/llcorehttp/tests/test_httprequest.hpp
+++ b/indra/llcorehttp/tests/test_httprequest.hpp
@@ -39,7 +39,6 @@
#include <boost/regex.hpp>
#include <sstream>
-#include "test_allocator.h"
#include "llcorehttp_test.h"
@@ -75,7 +74,6 @@ struct HttpRequestTestData
{
// the test objects inherit from this so the member functions and variables
// can be referenced directly inside of the test functions.
- size_t mMemTotal;
int mHandlerCalls;
HttpStatus mStatus;
};
@@ -196,27 +194,19 @@ void HttpRequestTestObjectType::test<1>()
HttpRequest * req = NULL;
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
try
{
// Get singletons created
HttpRequest::createService();
-
+
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory being used", mMemTotal < GetMemTotal());
-
+
// release the request object
delete req;
req = NULL;
HttpRequest::destroyService();
-
- // make sure we didn't leak any memory
- // nat 2017-08-15 don't: requires total stasis in every other subsystem
-// ensure("Memory returned", mMemTotal == GetMemTotal());
}
catch (...)
{
@@ -235,9 +225,6 @@ void HttpRequestTestObjectType::test<2>()
HttpRequest * req = NULL;
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
try
{
// Get singletons created
@@ -245,7 +232,6 @@ void HttpRequestTestObjectType::test<2>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory being used", mMemTotal < GetMemTotal());
// Issue a NoOp
HttpHandle handle = req->requestNoOp(LLCore::HttpHandler::ptr_t());
@@ -255,17 +241,11 @@ void HttpRequestTestObjectType::test<2>()
delete req;
req = NULL;
- // We're still holding onto the operation which is
- // sitting, unserviced, on the request queue so...
- ensure("Memory being used 2", mMemTotal < GetMemTotal());
-
// Request queue should have two references: global singleton & service object
ensure("Two references to request queue", 2 == HttpRequestQueue::instanceOf()->getRefCount());
// Okay, tear it down
HttpRequest::destroyService();
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory returned", mMemTotal == GetMemTotal());
}
catch (...)
{
@@ -293,9 +273,6 @@ void HttpRequestTestObjectType::test<3>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -311,7 +288,6 @@ void HttpRequestTestObjectType::test<3>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
// Issue a NoOp
HttpHandle handle = req->requestNoOp(handlerp);
@@ -360,8 +336,6 @@ void HttpRequestTestObjectType::test<3>()
HttpRequest::destroyService();
ensure("Two handler calls on the way out", 2 == mHandlerCalls);
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
}
catch (...)
{
@@ -386,9 +360,6 @@ void HttpRequestTestObjectType::test<4>()
LLCore::HttpHandler::ptr_t handler1p(&handler1, NoOpDeletor);
LLCore::HttpHandler::ptr_t handler2p(&handler2, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req1 = NULL;
@@ -407,7 +378,6 @@ void HttpRequestTestObjectType::test<4>()
// create a new ref counted object with an implicit reference
req1 = new HttpRequest();
req2 = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
// Issue some NoOps
HttpHandle handle = req1->requestNoOp(handler1p);
@@ -466,8 +436,6 @@ void HttpRequestTestObjectType::test<4>()
HttpRequest::destroyService();
ensure("Two handler calls on the way out", 3 == mHandlerCalls);
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
}
catch (...)
{
@@ -491,9 +459,6 @@ void HttpRequestTestObjectType::test<5>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -509,7 +474,6 @@ void HttpRequestTestObjectType::test<5>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
// Issue a Spin
HttpHandle handle = req->requestSpin(1);
@@ -535,15 +499,6 @@ void HttpRequestTestObjectType::test<5>()
// Shut down service
HttpRequest::destroyService();
-
- // Check memory usage
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
- // This memory test should work but could give problems as it
- // relies on the worker thread picking up a friendly request
- // to shutdown. Doing so, it drops references to things and
- // we should go back to where we started. If it gives you
- // problems, look into the code before commenting things out.
}
catch (...)
{
@@ -566,9 +521,6 @@ void HttpRequestTestObjectType::test<6>()
// references to it after completion of this method.
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -586,7 +538,6 @@ void HttpRequestTestObjectType::test<6>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
// Issue a Spin
HttpHandle handle = req->requestSpin(0); // Hard spin
@@ -612,13 +563,6 @@ void HttpRequestTestObjectType::test<6>()
// Shut down service
HttpRequest::destroyService();
-
- // Check memory usage
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- // ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
- // This memory test won't work because we're killing the thread
- // hard with the hard spinner. There's no opportunity to join
- // nicely so many things leak or get destroyed unilaterally.
}
catch (...)
{
@@ -643,9 +587,6 @@ void HttpRequestTestObjectType::test<7>()
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -662,7 +603,6 @@ void HttpRequestTestObjectType::test<7>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
opts = HttpOptions::ptr_t(new HttpOptions());
opts->setRetries(1); // Don't try for too long - default retries take about 18S
@@ -726,14 +666,6 @@ void HttpRequestTestObjectType::test<7>()
HttpRequest::destroyService();
ensure("Two handler calls on the way out", 2 == mHandlerCalls);
-
-#if 0 // defined(WIN32)
- // Can't do this on any platform anymore, the LL logging system holds
- // on to memory and produces what looks like memory leaks...
-
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
-#endif
}
catch (...)
{
@@ -761,9 +693,6 @@ void HttpRequestTestObjectType::test<8>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -779,7 +708,6 @@ void HttpRequestTestObjectType::test<8>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
// Issue a GET that *can* connect
mStatus = HttpStatus(200);
@@ -835,15 +763,6 @@ void HttpRequestTestObjectType::test<8>()
HttpRequest::destroyService();
ensure("Two handler calls on the way out", 2 == mHandlerCalls);
-
-#if 0 // defined(WIN32)
- // Can only do this memory test on Windows. On other platforms,
- // the LL logging system holds on to memory and produces what looks
- // like memory leaks...
-
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
-#endif
}
catch (...)
{
@@ -870,9 +789,6 @@ void HttpRequestTestObjectType::test<9>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -888,7 +804,6 @@ void HttpRequestTestObjectType::test<9>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
// Issue a GET that *can* connect
mStatus = HttpStatus(200);
@@ -946,15 +861,6 @@ void HttpRequestTestObjectType::test<9>()
HttpRequest::destroyService();
ensure("Two handler calls on the way out", 2 == mHandlerCalls);
-
-#if 0 // defined(WIN32)
- // Can only do this memory test on Windows. On other platforms,
- // the LL logging system holds on to memory and produces what looks
- // like memory leaks...
-
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
-#endif
}
catch (...)
{
@@ -981,9 +887,6 @@ void HttpRequestTestObjectType::test<10>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -1000,7 +903,6 @@ void HttpRequestTestObjectType::test<10>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
// Issue a GET that *can* connect
static const char * body_text("Now is the time for all good men...");
@@ -1063,14 +965,6 @@ void HttpRequestTestObjectType::test<10>()
HttpRequest::destroyService();
ensure("Two handler calls on the way out", 2 == mHandlerCalls);
-
-#if 0 // defined(WIN32)
- // Can't do this on any platform anymore, the LL logging system holds
- // on to memory and produces what looks like memory leaks...
-
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
-#endif
}
catch (...)
{
@@ -1100,9 +994,6 @@ void HttpRequestTestObjectType::test<11>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -1119,7 +1010,6 @@ void HttpRequestTestObjectType::test<11>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
// Issue a GET that *can* connect
static const char * body_text("Now is the time for all good men...");
@@ -1182,15 +1072,6 @@ void HttpRequestTestObjectType::test<11>()
HttpRequest::destroyService();
ensure("Two handler calls on the way out", 2 == mHandlerCalls);
-
-#if 0 // defined(WIN32)
- // Can only do this memory test on Windows. On other platforms,
- // the LL logging system holds on to memory and produces what looks
- // like memory leaks...
-
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
-#endif
}
catch (...)
{
@@ -1220,9 +1101,6 @@ void HttpRequestTestObjectType::test<12>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -1241,7 +1119,6 @@ void HttpRequestTestObjectType::test<12>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
// Issue a GET that *can* connect
mStatus = HttpStatus(200);
@@ -1299,14 +1176,6 @@ void HttpRequestTestObjectType::test<12>()
HttpRequest::destroyService();
ensure("Two handler calls on the way out", 2 == mHandlerCalls);
-
-#if 0 // defined(WIN32)
- // Can't do this on any platform anymore, the LL logging system holds
- // on to memory and produces what looks like memory leaks...
-
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
-#endif
}
catch (...)
{
@@ -1338,9 +1207,6 @@ void HttpRequestTestObjectType::test<13>()
TestHandler2 handler(this, "handler");
handler.mHeadersRequired.reserve(20); // Avoid memory leak test failure
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -1360,7 +1226,6 @@ void HttpRequestTestObjectType::test<13>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
opts = HttpOptions::ptr_t(new HttpOptions());
opts->setWantHeaders(true);
@@ -1428,15 +1293,6 @@ void HttpRequestTestObjectType::test<13>()
HttpRequest::destroyService();
ensure("Two handler calls on the way out", 2 == mHandlerCalls);
-
-#if 0 // defined(WIN32)
- // Can only do this memory test on Windows. On other platforms,
- // the LL logging system holds on to memory and produces what looks
- // like memory leaks...
-
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
-#endif
}
catch (...)
{
@@ -1462,9 +1318,6 @@ void HttpRequestTestObjectType::test<14>()
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
std::string url_base(get_base_url() + "/sleep/"); // path to a 30-second sleep
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -1481,7 +1334,6 @@ void HttpRequestTestObjectType::test<14>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
opts = HttpOptions::ptr_t(new HttpOptions);
opts->setRetries(0); // Don't retry
@@ -1546,14 +1398,6 @@ void HttpRequestTestObjectType::test<14>()
HttpRequest::destroyService();
ensure("Two handler calls on the way out", 2 == mHandlerCalls);
-
-#if 0 // defined(WIN32)
- // Can't do this on any platform anymore, the LL logging system holds
- // on to memory and produces what looks like memory leaks...
-
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
-#endif
}
catch (...)
{
@@ -1586,9 +1430,6 @@ void HttpRequestTestObjectType::test<15>()
// for memory return tests.
handler.mCheckContentType = "application/llsd+xml";
handler.mCheckContentType.clear();
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -1604,7 +1445,6 @@ void HttpRequestTestObjectType::test<15>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
// Issue a GET that *can* connect
mStatus = HttpStatus(200);
@@ -1662,15 +1502,6 @@ void HttpRequestTestObjectType::test<15>()
HttpRequest::destroyService();
ensure("Two handler calls on the way out", 2 == mHandlerCalls);
-
-#if 0 // defined(WIN32)
- // Can only do this memory test on Windows. On other platforms,
- // the LL logging system holds on to memory and produces what looks
- // like memory leaks...
-
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
-#endif
}
catch (...)
{
@@ -1701,9 +1532,6 @@ void HttpRequestTestObjectType::test<16>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -1943,9 +1771,6 @@ void HttpRequestTestObjectType::test<17>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -2131,9 +1956,6 @@ void HttpRequestTestObjectType::test<18>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -2320,9 +2142,6 @@ void HttpRequestTestObjectType::test<19>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -2503,9 +2322,6 @@ void HttpRequestTestObjectType::test<20>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -2711,9 +2527,6 @@ void HttpRequestTestObjectType::test<21>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -2915,9 +2728,6 @@ void HttpRequestTestObjectType::test<22>()
// Create before memory record as the string copy will bump numbers.
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpOptions::ptr_t options;
@@ -2939,7 +2749,6 @@ void HttpRequestTestObjectType::test<22>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
// ======================================
// Issue bug2295 GETs that will get a 206
@@ -3073,14 +2882,6 @@ void HttpRequestTestObjectType::test<22>()
// Shut down service
HttpRequest::destroyService();
-
-#if 0 // defined(WIN32)
- // Can't do this on any platform anymore, the LL logging system holds
- // on to memory and produces what looks like memory leaks...
-
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
-#endif
}
catch (...)
{
@@ -3117,9 +2918,6 @@ void HttpRequestTestObjectType::test<23>()
TestHandler2 handler(this, "handler");
LLCore::HttpHandler::ptr_t handlerp(&handler, NoOpDeletor);
std::string url_base(get_base_url() + "/503/"); // path to 503 generators
-
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
mHandlerCalls = 0;
HttpRequest * req = NULL;
@@ -3136,7 +2934,6 @@ void HttpRequestTestObjectType::test<23>()
// create a new ref counted object with an implicit reference
req = new HttpRequest();
- ensure("Memory allocated on construction", mMemTotal < GetMemTotal());
opts = HttpOptions::ptr_t(new HttpOptions());
opts->setRetries(1); // Retry once only
@@ -3210,14 +3007,6 @@ void HttpRequestTestObjectType::test<23>()
// Shut down service
HttpRequest::destroyService();
-
-#if 0 // defined(WIN32)
- // Can't do this on any platform anymore, the LL logging system holds
- // on to memory and produces what looks like memory leaks...
-
- // printf("Old mem: %d, New mem: %d\n", mMemTotal, GetMemTotal());
- ensure("Memory usage back to that at entry", mMemTotal == GetMemTotal());
-#endif
}
catch (...)
{
diff --git a/indra/llcorehttp/tests/test_httprequestqueue.hpp b/indra/llcorehttp/tests/test_httprequestqueue.hpp
index ef4ce0479b..dba9e0b250 100644
--- a/indra/llcorehttp/tests/test_httprequestqueue.hpp
+++ b/indra/llcorehttp/tests/test_httprequestqueue.hpp
@@ -30,7 +30,6 @@
#include <iostream>
-#include "test_allocator.h"
#include "_httpoperation.h"
@@ -45,7 +44,6 @@ struct HttpRequestqueueTestData
{
// the test objects inherit from this so the member functions and variables
// can be referenced directly inside of the test functions.
- size_t mMemTotal;
};
typedef test_group<HttpRequestqueueTestData> HttpRequestqueueTestGroupType;
@@ -57,20 +55,13 @@ void HttpRequestqueueTestObjectType::test<1>()
{
set_test_name("HttpRequestQueue construction");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
HttpRequestQueue::init();
ensure("One ref on construction of HttpRequestQueue", HttpRequestQueue::instanceOf()->getRefCount() == 1);
- ensure("Memory being used", mMemTotal < GetMemTotal());
// release the implicit reference, causing the object to be released
HttpRequestQueue::term();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -78,9 +69,6 @@ void HttpRequestqueueTestObjectType::test<2>()
{
set_test_name("HttpRequestQueue refcount works");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
HttpRequestQueue::init();
@@ -91,13 +79,9 @@ void HttpRequestqueueTestObjectType::test<2>()
HttpRequestQueue::term();
ensure("One ref after term() called", rq->getRefCount() == 1);
- ensure("Memory being used", mMemTotal < GetMemTotal());
// Drop ref
rq->release();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -105,9 +89,6 @@ void HttpRequestqueueTestObjectType::test<3>()
{
set_test_name("HttpRequestQueue addOp/fetchOp work");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
HttpRequestQueue::init();
@@ -126,9 +107,6 @@ void HttpRequestqueueTestObjectType::test<3>()
// release the singleton, hold on to the object
HttpRequestQueue::term();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -136,9 +114,6 @@ void HttpRequestqueueTestObjectType::test<4>()
{
set_test_name("HttpRequestQueue addOp/fetchAll work");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
HttpRequestQueue::init();
@@ -164,9 +139,6 @@ void HttpRequestqueueTestObjectType::test<4>()
// release the singleton, hold on to the object
HttpRequestQueue::term();
-
- // We're still holding onto the ops.
- ensure(mMemTotal < GetMemTotal());
// Release them
ops.clear();
@@ -177,9 +149,6 @@ void HttpRequestqueueTestObjectType::test<4>()
// op->release();
// }
}
-
- // Should be clean
- ensure("All memory returned", mMemTotal == GetMemTotal());
}
} // end namespace tut
diff --git a/indra/llcorehttp/tests/test_refcounted.hpp b/indra/llcorehttp/tests/test_refcounted.hpp
index 5dff143e5d..2310812d5a 100644
--- a/indra/llcorehttp/tests/test_refcounted.hpp
+++ b/indra/llcorehttp/tests/test_refcounted.hpp
@@ -28,9 +28,8 @@
#include "_refcounted.h"
-#include "test_allocator.h"
-
-#if 0 // disable all of this because it's hanging win64 builds?
+// disable all of this because it's hanging win64 builds?
+#if ! (LL_WINDOWS && ADDRESS_SIZE == 64)
using namespace LLCoreInt;
namespace tut
@@ -39,7 +38,6 @@ namespace tut
{
// the test objects inherit from this so the member functions and variables
// can be referenced directly inside of the test functions.
- size_t mMemTotal;
};
typedef test_group<RefCountedTestData> RefCountedTestGroupType;
@@ -51,18 +49,12 @@ namespace tut
{
set_test_name("RefCounted construction with implicit count");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
RefCounted * rc = new RefCounted(true);
ensure(rc->getRefCount() == 1);
// release the implicit reference, causing the object to be released
rc->release();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -70,9 +62,6 @@ namespace tut
{
set_test_name("RefCounted construction without implicit count");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
// create a new ref counted object with an implicit reference
RefCounted * rc = new RefCounted(false);
ensure(rc->getRefCount() == 0);
@@ -83,8 +72,6 @@ namespace tut
// release the implicit reference, causing the object to be released
rc->release();
-
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -92,9 +79,6 @@ namespace tut
{
set_test_name("RefCounted addRef and release");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
RefCounted * rc = new RefCounted(false);
for (int i = 0; i < 1024; ++i)
@@ -108,9 +92,6 @@ namespace tut
{
rc->release();
}
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -118,9 +99,6 @@ namespace tut
{
set_test_name("RefCounted isLastRef check");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
RefCounted * rc = new RefCounted(true);
// with only one reference, isLastRef should be true
@@ -128,9 +106,6 @@ namespace tut
// release it to clean up memory
rc->release();
-
- // make sure we didn't leak any memory
- ensure(mMemTotal == GetMemTotal());
}
template <> template <>
@@ -138,9 +113,6 @@ namespace tut
{
set_test_name("RefCounted noRef check");
- // record the total amount of dynamically allocated memory
- mMemTotal = GetMemTotal();
-
RefCounted * rc = new RefCounted(false);
// set the noRef
@@ -148,10 +120,7 @@ namespace tut
// with only one reference, isLastRef should be true
ensure(rc->getRefCount() == RefCounted::NOT_REF_COUNTED);
-
- // allow this memory leak, but check that we're leaking a known amount
- ensure(mMemTotal == (GetMemTotal() - sizeof(RefCounted)));
}
}
-#endif // if 0
+#endif // disabling on Win64
#endif // TEST_LLCOREINT_REF_COUNTED_H_