diff options
Diffstat (limited to 'indra/llmessage/tests')
23 files changed, 164 insertions, 309 deletions
| diff --git a/indra/llmessage/tests/commtest.h b/indra/llmessage/tests/commtest.h index 0d149b5258..0d149b5258 100644..100755 --- a/indra/llmessage/tests/commtest.h +++ b/indra/llmessage/tests/commtest.h diff --git a/indra/llmessage/tests/llareslistener_test.cpp b/indra/llmessage/tests/llareslistener_test.cpp index 60c91e12cf..60c91e12cf 100644..100755 --- a/indra/llmessage/tests/llareslistener_test.cpp +++ b/indra/llmessage/tests/llareslistener_test.cpp diff --git a/indra/llmessage/tests/llavatarnamecache_test.cpp b/indra/llmessage/tests/llavatarnamecache_test.cpp index ec6b65d483..ec6b65d483 100644..100755 --- a/indra/llmessage/tests/llavatarnamecache_test.cpp +++ b/indra/llmessage/tests/llavatarnamecache_test.cpp diff --git a/indra/llmessage/tests/llcurl_stub.cpp b/indra/llmessage/tests/llcurl_stub.cpp index d84fe0a49f..9b298d0c04 100644..100755 --- a/indra/llmessage/tests/llcurl_stub.cpp +++ b/indra/llmessage/tests/llcurl_stub.cpp @@ -28,7 +28,6 @@  #include "llcurl.h"  LLCurl::Responder::Responder() -	: mReferenceCount(0)  {  } @@ -77,19 +76,3 @@ void LLCurl::Responder::result(LLSD const&)  {  } -namespace boost -{ -	void intrusive_ptr_add_ref(LLCurl::Responder* p) -	{ -		++p->mReferenceCount; -	} - -	void intrusive_ptr_release(LLCurl::Responder* p) -	{ -		if(p && 0 == --p->mReferenceCount) -		{ -			delete p; -		} -	} -}; - diff --git a/indra/llmessage/tests/llhost_test.cpp b/indra/llmessage/tests/llhost_test.cpp index eadf83c428..eadf83c428 100644..100755 --- a/indra/llmessage/tests/llhost_test.cpp +++ b/indra/llmessage/tests/llhost_test.cpp diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp index 843c3bcc4b..559001d079 100644..100755 --- a/indra/llmessage/tests/llhttpclient_test.cpp +++ b/indra/llmessage/tests/llhttpclient_test.cpp @@ -47,67 +47,31 @@  namespace tut  { -	LLSD storage; -	 -	class LLSDStorageNode : public LLHTTPNode -	{ -	public: -		LLSD simpleGet() const					{ return storage; } -		LLSD simplePut(const LLSD& value) const	{ storage = value; return LLSD(); } -	}; - -	class ErrorNode : public LLHTTPNode -	{ -	public: -		void get(ResponsePtr r, const LLSD& context) const -			{ r->status(599, "Intentional error"); } -		void post(ResponsePtr r, const LLSD& context, const LLSD& input) const -			{ r->status(input["status"], input["reason"]); } -	}; - -	class TimeOutNode : public LLHTTPNode -	{ -	public: -		void get(ResponsePtr r, const LLSD& context) const -		{ -            /* do nothing, the request will eventually time out */  -		} -	}; - -	LLHTTPRegistration<LLSDStorageNode> gStorageNode("/test/storage"); -	LLHTTPRegistration<ErrorNode>		gErrorNode("/test/error"); -	LLHTTPRegistration<TimeOutNode>		gTimeOutNode("/test/timeout"); -  	struct HTTPClientTestData  	{  	public:  		HTTPClientTestData(): -			local_server(STRINGIZE("http://127.0.0.1:" << getenv("PORT") << "/")) +			PORT(getenv("PORT")), +			// Turning NULL PORT into empty string doesn't make things work; +			// that's just to keep this initializer from blowing up. We test +			// PORT separately in the constructor body. +			local_server(STRINGIZE("http://127.0.0.1:" << (PORT? PORT : "") << "/"))  		{ +			ensure("Set environment variable PORT to local test server port", PORT);  			apr_pool_create(&mPool, NULL);  			LLCurl::initClass(false); -			mServerPump = new LLPumpIO(mPool);  			mClientPump = new LLPumpIO(mPool);  			LLHTTPClient::setPump(*mClientPump);  		} -		 +  		~HTTPClientTestData()  		{ -			delete mServerPump;  			delete mClientPump;  			LLProxy::cleanupClass();  			apr_pool_destroy(mPool);  		} -		void setupTheServer() -		{ -			LLHTTPNode& root = LLIOHTTPServer::create(mPool, *mServerPump, 8888); - -			LLHTTPStandardServices::useServices(); -			LLHTTPRegistrar::buildAllServices(root); -		} -		  		void runThePump(float timeout = 100.0f)  		{  			LLTimer timer; @@ -115,11 +79,7 @@ namespace tut  			while(!mSawCompleted && !mSawCompletedHeader && !timer.hasExpired())  			{ -				if (mServerPump) -				{ -					mServerPump->pump(); -					mServerPump->callback(); -				} +				LLFrameTimer::updateFrameTime();  				if (mClientPump)  				{  					mClientPump->pump(); @@ -128,17 +88,11 @@ namespace tut  			}  		} -		void killServer() -		{ -			delete mServerPump; -			mServerPump = NULL; -		} - +		const char* const PORT;  		const std::string local_server;  	private:  		apr_pool_t* mPool; -		LLPumpIO* mServerPump;  		LLPumpIO* mClientPump;  	protected: @@ -148,11 +102,11 @@ namespace tut  			{  				std::string msg =  					llformat("error() called when not expected, status %d", -						mStatus);  +						mStatus);  				fail(msg);  			}  		} -	 +  		void ensureStatusError()  		{  			if (!mSawError) @@ -160,7 +114,7 @@ namespace tut  				fail("error() wasn't called");  			}  		} -		 +  		LLSD getResult()  		{  			return mResult; @@ -169,7 +123,7 @@ namespace tut  		{  			return mHeader;  		} -	 +  	protected:  		bool mSawError;  		U32 mStatus; @@ -187,18 +141,18 @@ namespace tut  				: mClient(client)  			{  			} -		 +  		public: -			static boost::intrusive_ptr<Result> build(HTTPClientTestData& client) +			static Result* build(HTTPClientTestData& client)  			{ -				return boost::intrusive_ptr<Result>(new Result(client)); +				return new Result(client);  			} -			 +  			~Result()  			{  				mClient.mResultDeleted = true;  			} -			 +  			virtual void error(U32 status, const std::string& reason)  			{  				mClient.mSawError = true; @@ -216,7 +170,7 @@ namespace tut  							const LLSD& content)  			{  				LLHTTPClient::Responder::completed(status, reason, content); -				 +  				mClient.mSawCompleted = true;  			} @@ -244,12 +198,12 @@ namespace tut  			mResult.clear();  			mHeader.clear();  			mResultDeleted = false; -			 +  			return Result::build(*this);  		}  	}; -	 -	 + +  	typedef test_group<HTTPClientTestData>	HTTPClientTestGroup;  	typedef HTTPClientTestGroup::object		HTTPClientTestObject;  	HTTPClientTestGroup httpClientTestGroup("http_client"); @@ -282,9 +236,7 @@ namespace tut  		sd["list"][1]["three"] = 3;  		sd["list"][1]["four"] = 4; -		setupTheServer(); - -		LLHTTPClient::post("http://localhost:8888/web/echo", sd, newResult()); +		LLHTTPClient::post(local_server + "web/echo", sd, newResult());  		runThePump();  		ensureStatusOK();  		ensure_equals("echoed result matches", getResult(), sd); @@ -297,12 +249,11 @@ namespace tut  		sd["message"] = "This is my test message."; -		setupTheServer(); -		LLHTTPClient::put("http://localhost:8888/test/storage", sd, newResult()); +		LLHTTPClient::put(local_server + "test/storage", sd, newResult());  		runThePump();  		ensureStatusOK(); -		LLHTTPClient::get("http://localhost:8888/test/storage", newResult()); +		LLHTTPClient::get(local_server + "test/storage", newResult());  		runThePump();  		ensureStatusOK();  		ensure_equals("echoed result matches", getResult(), sd); @@ -316,9 +267,7 @@ namespace tut  		sd["status"] = 543;  		sd["reason"] = "error for testing"; -		setupTheServer(); - -		LLHTTPClient::post("http://localhost:8888/test/error", sd, newResult()); +		LLHTTPClient::post(local_server + "test/error", sd, newResult());  		runThePump();  		ensureStatusError();  		ensure_contains("reason", mReason, sd["reason"]); @@ -327,23 +276,16 @@ namespace tut  	template<> template<>  		void HTTPClientTestObject::test<6>()  	{ -		setupTheServer(); - -		LLHTTPClient::get("http://localhost:8888/test/timeout", newResult()); -		runThePump(1.0f); -		killServer(); -		runThePump(); +		const F32 timeout = 1.0f; +		LLHTTPClient::get(local_server + "test/timeout", newResult(), LLSD(), timeout); +		runThePump(timeout * 5.0f);  		ensureStatusError(); -		ensure_equals("reason", mReason, "STATUS_ERROR"); +		ensure_equals("reason", mReason, "STATUS_EXPIRED");  	}  	template<> template<>  		void HTTPClientTestObject::test<7>()  	{ -		// Can not use the little mini server.  The blocking request -		// won't ever let it run.  Instead get from a known LLSD -		// source and compare results with the non-blocking get which -		// is tested against the mini server earlier.  		LLHTTPClient::get(local_server, newResult());  		runThePump();  		ensureStatusOK(); diff --git a/indra/llmessage/tests/llhttpclientadapter_test.cpp b/indra/llmessage/tests/llhttpclientadapter_test.cpp index 13ce0a0edd..13ce0a0edd 100644..100755 --- a/indra/llmessage/tests/llhttpclientadapter_test.cpp +++ b/indra/llmessage/tests/llhttpclientadapter_test.cpp diff --git a/indra/llmessage/tests/llmime_test.cpp b/indra/llmessage/tests/llmime_test.cpp index aed5c4589c..aed5c4589c 100644..100755 --- a/indra/llmessage/tests/llmime_test.cpp +++ b/indra/llmessage/tests/llmime_test.cpp diff --git a/indra/llmessage/tests/llmockhttpclient.h b/indra/llmessage/tests/llmockhttpclient.h index af26bf8803..af26bf8803 100644..100755 --- a/indra/llmessage/tests/llmockhttpclient.h +++ b/indra/llmessage/tests/llmockhttpclient.h diff --git a/indra/llmessage/tests/llnamevalue_test.cpp b/indra/llmessage/tests/llnamevalue_test.cpp index 8902fdd2e8..8902fdd2e8 100644..100755 --- a/indra/llmessage/tests/llnamevalue_test.cpp +++ b/indra/llmessage/tests/llnamevalue_test.cpp diff --git a/indra/llmessage/tests/llpartdata_test.cpp b/indra/llmessage/tests/llpartdata_test.cpp index 9123bd06c7..de81e0bbb2 100644..100755 --- a/indra/llmessage/tests/llpartdata_test.cpp +++ b/indra/llmessage/tests/llpartdata_test.cpp @@ -38,10 +38,34 @@  namespace tut  { + +	//bunch of sniffed data that *should* be a valid particle system +	static U8 msg[] = {  +		0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,  +		0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x80, 0x00, 0x80,  +		0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x5e, 0x12, 0x0b, 0xa1, 0x58, 0x05, 0xdc, 0x57, 0x66,  +		0xb7, 0xf5, 0xac, 0x4b, 0xd1, 0x8f, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  +		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x05, 0x02, 0x00, 0x00, 0x0a, 0xff,  +		0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00,  +		0x00, 0x7e, 0xc6, 0x81, 0xdc, 0x7e, 0xc6, 0x81, 0xdc, 0x77, 0xcf, 0xef, 0xd4, 0xce, 0x64, 0x1a, 0x7e,  +		0x26, 0x87, 0x55, 0x7f, 0xdd, 0x65, 0x22, 0x7f, 0xdd, 0x65, 0x22, 0x7f, 0x77, 0xcf, 0x98, 0xa3, 0xab,  +		0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf2,  +		0xf1, 0x65, 0x32, 0x1b, 0xef, 0x18, 0x70, 0x66, 0xba, 0x30, 0xa0, 0x11, 0xaa, 0x2f, 0xb0, 0xab, 0xd0,  +		0x30, 0x7d, 0xbd, 0x01, 0x00, 0xf8, 0x0d, 0xb8, 0x30, 0x01, 0x00, 0x00, 0x00, 0xce, 0xc6, 0x81, 0xdc,  +		0xce, 0xc6, 0x81, 0xdc, 0xc7, 0xcf, 0xef, 0xd4, 0x75, 0x65, 0x1a, 0x7f, 0x62, 0x6f, 0x55, 0x7f, 0x6d,  +		0x65, 0x22, 0x7f, 0x6d, 0x65, 0x22, 0x7f, 0xc7, 0xcf, 0x98, 0xa3, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,  +		0xab, 0xab, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xf2, 0xf1, 0x62, 0x12, 0x1b, 0xef,  +		0x18, 0x7e, 0xbd, 0x01, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  +		0x00, 0x00, 0x00, 0x00, 0x7c, 0xac, 0x28, 0x03, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48,  +		0xe0, 0xb9, 0x30, 0x03, 0xe1, 0xb9, 0x30, 0xbb, 0x00, 0x00, 0x00, 0x48, 0xe0, 0xb9, 0x30, 0x36, 0xd9,  +		0x81, 0xdc, 0x36, 0xd9, 0x81, 0xdc, 0x3f, 0xd0, 0xef, 0xd4, 0xa5, 0x7a, 0x72, 0x7f, 0x26, 0x30, 0x55,  +		0x7f, 0x95, 0x7a, 0x22, 0x7f, 0x95, 0x7a, 0x22, 0x7f, 0x3f, 0xd0, 0x98, 0xa3, 0xab, 0xab, 0xab, 0xab,  +		0xab, 0xab, 0xab, 0xab, 0x00, 0x00, 0x00, 0x00, 0x00 };  	struct partdata_test  	{  	}; +  	typedef test_group<partdata_test> partdata_test_t;  	typedef partdata_test_t::object partdata_test_object_t;  	tut::partdata_test_t tut_partdata_test("LLPartData"); @@ -49,168 +73,82 @@ namespace tut  	template<> template<>  	void partdata_test_object_t::test<1>()  	{ -		LLPartData llpdata,llpdata1; -		U8 pkbuf[128]; - -		llpdata.setFlags(LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK | -		LLPartData::LL_PART_BOUNCE_MASK | LLPartData::LL_PART_WIND_MASK | LLPartData::LL_PART_FOLLOW_SRC_MASK | -		LLPartData::LL_PART_FOLLOW_VELOCITY_MASK | LLPartData::LL_PART_TARGET_POS_MASK | LLPartData::LL_PART_TARGET_LINEAR_MASK | -		LLPartData::LL_PART_EMISSIVE_MASK | LLPartData::LL_PART_BEAM_MASK | LLPartData::LL_PART_DEAD_MASK); - -		llpdata.setMaxAge(29.3f); - -		LLVector3 llvec1(1.0f, .5f, .25f); -		llpdata.setStartColor(llvec1); -		llpdata.setStartAlpha(.7f); - -		LLVector3 llvec2(.2f, .3f, 1.0f); -		llpdata.setEndColor(llvec2); -		llpdata.setEndAlpha(1.0f); +		LLPartSysData llpsysdata; +		LLDataPackerBinaryBuffer dp1(msg, sizeof(msg)); -		llpdata.setStartScale(3.23f, 4.0f); -		llpdata.setEndScale(2.4678f, 1.0f); +		ensure("LLPartSysData::unpack failed.", llpsysdata.unpack(dp1)); -		LLDataPackerBinaryBuffer dp((U8*)pkbuf, 128); -		llpdata.pack(dp); -		S32 cur_size = dp.getCurrentSize(); -		 -		LLDataPackerBinaryBuffer dp1((U8*)pkbuf, cur_size); -		llpdata1.unpack(dp1); - -		ensure("1.mFlags values are different after unpacking", llpdata1.mFlags == llpdata.mFlags); -		ensure_approximately_equals("2.mMaxAge values are different after unpacking", llpdata1.mMaxAge, llpdata.mMaxAge, 8); - -		ensure_approximately_equals("3.mStartColor[0] values are different after unpacking", llpdata1.mStartColor.mV[0], llpdata.mStartColor.mV[0], 8); -		ensure_approximately_equals("4.mStartColor[1] values are different after unpacking", llpdata1.mStartColor.mV[1], llpdata.mStartColor.mV[1], 8); -		ensure_approximately_equals("5.mStartColor[2] values are different after unpacking", llpdata1.mStartColor.mV[2], llpdata.mStartColor.mV[2], 8); -		ensure_approximately_equals("6.mStartColor[3] values are different after unpacking", llpdata1.mStartColor.mV[3], llpdata.mStartColor.mV[3], 8); - -		ensure_approximately_equals("7.mEndColor[0] values are different after unpacking", llpdata1.mEndColor.mV[0], llpdata.mEndColor.mV[0], 8); -		ensure_approximately_equals("8.mEndColor[1] values are different after unpacking", llpdata1.mEndColor.mV[1], llpdata.mEndColor.mV[1], 8); -		ensure_approximately_equals("9.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[2], llpdata.mEndColor.mV[2], 8); -		ensure_approximately_equals("10.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[3], llpdata.mEndColor.mV[3], 8); - -		ensure_approximately_equals("11.mStartScale[0] values are different after unpacking", llpdata1.mStartScale.mV[0], llpdata.mStartScale.mV[0], 5); -		ensure_approximately_equals("12.mStartScale[1] values are different after unpacking", llpdata1.mStartScale.mV[1], llpdata.mStartScale.mV[1], 5); - -		ensure_approximately_equals("13.mEndScale[0] values are different after unpacking", llpdata1.mEndScale.mV[0], llpdata.mEndScale.mV[0], 5); -		ensure_approximately_equals("14.mEndScale[1] values are different after unpacking", llpdata1.mEndScale.mV[1], llpdata.mEndScale.mV[1], 5); -	} - - -	template<> template<> -	void partdata_test_object_t::test<2>() -	{ -		LLPartData llpdata,llpdata1; - -		llpdata.setFlags(LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK | -		LLPartData::LL_PART_BOUNCE_MASK | LLPartData::LL_PART_WIND_MASK | LLPartData::LL_PART_FOLLOW_SRC_MASK | -		LLPartData::LL_PART_FOLLOW_VELOCITY_MASK | LLPartData::LL_PART_TARGET_POS_MASK | LLPartData::LL_PART_TARGET_LINEAR_MASK | -		LLPartData::LL_PART_EMISSIVE_MASK | LLPartData::LL_PART_BEAM_MASK | LLPartData::LL_PART_DEAD_MASK); -		 -		llpdata.setMaxAge(29.3f); - -		LLVector3 llvec1(1.0f, .5f, .25f); -		llpdata.setStartColor(llvec1); -		llpdata.setStartAlpha(.7f); - -		LLVector3 llvec2(.2f, .3f, 1.0f); -		llpdata.setEndColor(llvec2); -		llpdata.setEndAlpha(1.0f); - -		llpdata.setStartScale(3.23f, 4.0f); -		llpdata.setEndScale(2.4678f, 1.0f); - -		LLSD llsd = llpdata.asLLSD(); - -		llpdata1.fromLLSD(llsd); - -		ensure("1.mFlags values are different after unpacking", llpdata1.mFlags == llpdata.mFlags); -		ensure_approximately_equals("2.mMaxAge values are different after unpacking", llpdata1.mMaxAge, llpdata.mMaxAge, 8); - -		ensure_approximately_equals("3.mStartColor[0] values are different after unpacking", llpdata1.mStartColor.mV[0], llpdata.mStartColor.mV[0], 8); -		ensure_approximately_equals("4.mStartColor[1] values are different after unpacking", llpdata1.mStartColor.mV[1], llpdata.mStartColor.mV[1], 8); -		ensure_approximately_equals("5.mStartColor[2] values are different after unpacking", llpdata1.mStartColor.mV[2], llpdata.mStartColor.mV[2], 8); -		ensure_approximately_equals("6.mStartColor[3] values are different after unpacking", llpdata1.mStartColor.mV[3], llpdata.mStartColor.mV[3], 8); - -		ensure_approximately_equals("7.mEndColor[0] values are different after unpacking", llpdata1.mEndColor.mV[0], llpdata.mEndColor.mV[0], 8); -		ensure_approximately_equals("8.mEndColor[1] values are different after unpacking", llpdata1.mEndColor.mV[1], llpdata.mEndColor.mV[1], 8); -		ensure_approximately_equals("9.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[2], llpdata.mEndColor.mV[2], 8); -		ensure_approximately_equals("10.mEndColor[2] values are different after unpacking", llpdata1.mEndColor.mV[3], llpdata.mEndColor.mV[3], 8); - -		ensure_approximately_equals("11.mStartScale[0] values are different after unpacking", llpdata1.mStartScale.mV[0], llpdata.mStartScale.mV[0], 5); -		ensure_approximately_equals("12.mStartScale[1] values are different after unpacking", llpdata1.mStartScale.mV[1], llpdata.mStartScale.mV[1], 5); - -		ensure_approximately_equals("13.mEndScale[0] values are different after unpacking", llpdata1.mEndScale.mV[0], llpdata.mEndScale.mV[0], 5); -		ensure_approximately_equals("14.mEndScale[1] values are different after unpacking", llpdata1.mEndScale.mV[1], llpdata.mEndScale.mV[1], 5); -	} - - -//*********llpartsysdata*********** - -	template<> template<> -	void partdata_test_object_t::test<3>() -	{ -		LLPartSysData llpsysdata, llpsysdata1; -		U8 pkbuf[256]; -		llpsysdata.setBurstSpeedMin(33.33f); -		ensure("1.mBurstSpeedMin coudnt be set", 33.33f == llpsysdata.mBurstSpeedMin); - -		llpsysdata.setBurstSpeedMax(44.44f);  -		ensure("2.mBurstSpeedMax coudnt be set", 44.44f == llpsysdata.mBurstSpeedMax); - -		llpsysdata.setBurstRadius(45.55f); -		ensure("3.mBurstRadius coudnt be set", 45.55f == llpsysdata.mBurstRadius); - -		LLVector3 llvec(44.44f, 111.11f, -40.4f); -		llpsysdata.setPartAccel(llvec); - -		llpsysdata.mCRC = 0xFFFFFFFF; -		llpsysdata.mFlags = 0x20; - -		llpsysdata.mPattern = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY; - -		llpsysdata.mMaxAge = 99.99f; -		llpsysdata.mStartAge = 18.5f; -		llpsysdata.mInnerAngle = 4.234f; -		llpsysdata.mOuterAngle = 7.123f; -		llpsysdata.mBurstRate  = 245.53f; -		llpsysdata.mBurstPartCount = 0xFF; -		llpsysdata.mAngularVelocity = llvec; - -		llpsysdata.mPartImageID.generate(); -		llpsysdata.mTargetUUID.generate(); +		//mCRC	1	unsigned int +		ensure("mCRC different after unpacking", llpsysdata.mCRC == (U32) 1); +		//mFlags	0	unsigned int +		ensure ("mFlags different after unpacking", llpsysdata.mFlags == (U32) 0); +		//mPattern	1 ''	unsigned char +		ensure ("mPattern different after unpacking", llpsysdata.mPattern == (U8) 1); +		//mInnerAngle	0.00000000	float +		ensure_approximately_equals("mInnerAngle different after unpacking", llpsysdata.mInnerAngle, 0.f, 8); +		//mOuterAngle	0.00000000	float +		ensure_approximately_equals("mOuterAngle different after unpacking", llpsysdata.mOuterAngle, 0.f, 8); +		//mAngularVelocity	0,0,0 +		ensure_approximately_equals("mAngularVelocity.mV[0] different after unpacking", llpsysdata.mAngularVelocity.mV[0], 0.f, 8); +		ensure_approximately_equals("mAngularVelocity.mV[0] different after unpacking", llpsysdata.mAngularVelocity.mV[1], 0.f, 8); +		ensure_approximately_equals("mAngularVelocity.mV[0] different after unpacking", llpsysdata.mAngularVelocity.mV[2], 0.f, 8); +		//mBurstRate	0.097656250	float +		ensure_approximately_equals("mBurstRate different after unpacking", llpsysdata.mBurstRate, 0.097656250f, 8); +		//mBurstPartCount	1 ''	unsigned char +		ensure("mBurstPartCount different after unpacking", llpsysdata.mBurstPartCount == (U8) 1); +		//mBurstRadius	0.00000000	float +		ensure_approximately_equals("mBurstRadius different after unpacking", llpsysdata.mBurstRadius, 0.f, 8); +		//mBurstSpeedMin	1.0000000	float +		ensure_approximately_equals("mBurstSpeedMin different after unpacking", llpsysdata.mBurstSpeedMin, 1.f, 8); +		//mBurstSpeedMax	1.0000000	float +		ensure_approximately_equals("mBurstSpeedMax different after unpacking", llpsysdata.mBurstSpeedMax, 1.f, 8); +		//mMaxAge	0.00000000	float +		ensure_approximately_equals("mMaxAge different after unpacking", llpsysdata.mMaxAge, 0.f, 8); +		//mStartAge	0.00000000	float +		ensure_approximately_equals("mStartAge different after unpacking", llpsysdata.mStartAge, 0.f, 8); +		//mPartAccel	<0,0,0> +		ensure_approximately_equals("mPartAccel.mV[0] different after unpacking", llpsysdata.mPartAccel.mV[0], 0.f, 7); +		ensure_approximately_equals("mPartAccel.mV[1] different after unpacking", llpsysdata.mPartAccel.mV[1], 0.f, 7); +		ensure_approximately_equals("mPartAccel.mV[2] different after unpacking", llpsysdata.mPartAccel.mV[2], 0.f, 7); + +		//mPartData +		LLPartData& data = llpsysdata.mPartData; + +		//mFlags	132354	unsigned int +		ensure ("mPartData.mFlags different after unpacking", data.mFlags == (U32) 132354); +		//mMaxAge	10.000000	float +		ensure_approximately_equals("mPartData.mMaxAge different after unpacking", data.mMaxAge, 10.f, 8);  +		//mStartColor	<1,1,1,1> +		ensure_approximately_equals("mPartData.mStartColor.mV[0] different after unpacking", data.mStartColor.mV[0], 1.f, 8); +		ensure_approximately_equals("mPartData.mStartColor.mV[1] different after unpacking", data.mStartColor.mV[1], 1.f, 8); +		ensure_approximately_equals("mPartData.mStartColor.mV[2] different after unpacking", data.mStartColor.mV[2], 1.f, 8); +		ensure_approximately_equals("mPartData.mStartColor.mV[3] different after unpacking", data.mStartColor.mV[3], 1.f, 8); +		//mEndColor	<1,1,0,0> +		ensure_approximately_equals("mPartData.mEndColor.mV[0] different after unpacking", data.mEndColor.mV[0], 1.f, 8); +		ensure_approximately_equals("mPartData.mEndColor.mV[1] different after unpacking", data.mEndColor.mV[1], 1.f, 8); +		ensure_approximately_equals("mPartData.mEndColor.mV[2] different after unpacking", data.mEndColor.mV[2], 0.f, 8); +		ensure_approximately_equals("mPartData.mEndColor.mV[3] different after unpacking", data.mEndColor.mV[3], 0.f, 8); +		//mStartScale	<1,1> +		ensure_approximately_equals("mPartData.mStartScale.mV[0] different after unpacking", data.mStartScale.mV[0], 1.f, 8); +		ensure_approximately_equals("mPartData.mStartScale.mV[1] different after unpacking", data.mStartScale.mV[1], 1.f, 8); +		//mEndScale	<0,0> +		ensure_approximately_equals("mPartData.mEndScale.mV[0] different after unpacking", data.mEndScale.mV[0], 0.f, 8); +		ensure_approximately_equals("mPartData.mEndScale.mV[1] different after unpacking", data.mEndScale.mV[1], 0.f, 8); +		//mPosOffset	<0,0,0> +		ensure_approximately_equals("mPartData.mPosOffset.mV[0] different after unpacking", data.mPosOffset.mV[0], 0.f, 8); +		ensure_approximately_equals("mPartData.mPosOffset.mV[1] different after unpacking", data.mPosOffset.mV[1], 0.f, 8); +		ensure_approximately_equals("mPartData.mPosOffset.mV[2] different after unpacking", data.mPosOffset.mV[2], 0.f, 8); +		//mParameter	0.00000000	float +		ensure_approximately_equals("mPartData.mParameter different after unpacking", data.mParameter, 0.f, 8); -		LLDataPackerBinaryBuffer dp((U8*)pkbuf, 256); -		llpsysdata.pack(dp); -		S32 cur_size = dp.getCurrentSize(); -		LLDataPackerBinaryBuffer dp1((U8*)pkbuf, cur_size); -		llpsysdata1.unpack(dp1); - -		ensure("1.mCRC's not equal", llpsysdata.mCRC == llpsysdata1.mCRC); -		ensure("2.mFlags's not equal", llpsysdata.mFlags == llpsysdata1.mFlags); -		ensure("3.mPattern's not equal", llpsysdata.mPattern == llpsysdata1.mPattern); -		ensure_approximately_equals("4.mMaxAge's not equal", llpsysdata.mMaxAge , llpsysdata1.mMaxAge, 8); -		ensure_approximately_equals("5.mStartAge's not equal", llpsysdata.mStartAge, llpsysdata1.mStartAge, 8); -		ensure_approximately_equals("6.mOuterAngle's not equal", llpsysdata.mOuterAngle, llpsysdata1.mOuterAngle, 5); -		ensure_approximately_equals("7.mInnerAngles's not equal", llpsysdata.mInnerAngle, llpsysdata1.mInnerAngle, 5); -		ensure_approximately_equals("8.mBurstRate's not equal", llpsysdata.mBurstRate, llpsysdata1.mBurstRate, 8); -		ensure("9.mBurstPartCount's not equal", llpsysdata.mBurstPartCount == llpsysdata1.mBurstPartCount); - -		ensure_approximately_equals("10.mBurstSpeedMin's not equal", llpsysdata.mBurstSpeedMin, llpsysdata1.mBurstSpeedMin, 8); -		ensure_approximately_equals("11.mBurstSpeedMax's not equal", llpsysdata.mBurstSpeedMax, llpsysdata1.mBurstSpeedMax, 8); - -		ensure_approximately_equals("12.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[0], llpsysdata1.mAngularVelocity.mV[0], 7); -		ensure_approximately_equals("13.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[1], llpsysdata1.mAngularVelocity.mV[1], 7); -		ensure_approximately_equals("14.mAngularVelocity's not equal", llpsysdata.mAngularVelocity.mV[2], llpsysdata1.mAngularVelocity.mV[2], 7); -			 -		ensure_approximately_equals("15.mPartAccel's not equal", llpsysdata.mPartAccel.mV[0], llpsysdata1.mPartAccel.mV[0], 7); -		ensure_approximately_equals("16.mPartAccel's not equal", llpsysdata.mPartAccel.mV[1], llpsysdata1.mPartAccel.mV[1], 7); -		ensure_approximately_equals("17.mPartAccel's not equal", llpsysdata.mPartAccel.mV[2], llpsysdata1.mPartAccel.mV[2], 7); - -		ensure("18.mPartImageID's not equal", llpsysdata.mPartImageID == llpsysdata1.mPartImageID); -		ensure("19.mTargetUUID's not equal", llpsysdata.mTargetUUID == llpsysdata1.mTargetUUID); -		ensure_approximately_equals("20.mBurstRadius's not equal", llpsysdata.mBurstRadius, llpsysdata1.mBurstRadius, 8); +		//mStartGlow	0.00000000	float +		ensure_approximately_equals("mPartData.mStartGlow different after unpacking", data.mStartGlow, 0.f, 8); +		//mEndGlow	0.00000000	float +		ensure_approximately_equals("mPartData.mEndGlow different after unpacking", data.mEndGlow, 0.f, 8); +		//mBlendFuncSource	2 ''	unsigned char +		ensure("mPartData.mBlendFuncSource different after unpacking", data.mBlendFuncSource == (U8) 2); +		//mBlendFuncDest	1 ''	unsigned char  +		ensure("mPartData.mBlendFuncDest different after unpacking", data.mBlendFuncDest == (U8) 1);  	}  } diff --git a/indra/llmessage/tests/llregionpresenceverifier_test.cpp b/indra/llmessage/tests/llregionpresenceverifier_test.cpp index 5b89f2a8c6..5b89f2a8c6 100644..100755 --- a/indra/llmessage/tests/llregionpresenceverifier_test.cpp +++ b/indra/llmessage/tests/llregionpresenceverifier_test.cpp diff --git a/indra/llmessage/tests/llsdmessage_test.cpp b/indra/llmessage/tests/llsdmessage_test.cpp index 31a791e4b4..44b024a83f 100644..100755 --- a/indra/llmessage/tests/llsdmessage_test.cpp +++ b/indra/llmessage/tests/llsdmessage_test.cpp @@ -42,6 +42,7 @@  // external library headers  // other Linden headers  #include "../test/lltut.h" +#include "../test/catch_and_store_what_in.h"  #include "llsdserialize.h"  #include "llevents.h"  #include "stringize.h" @@ -72,43 +73,14 @@ namespace tut      template<> template<>      void llsdmessage_object::test<1>()      { -        bool threw = false; +        std::string threw;          // This should fail...          try          {              LLSDMessage localListener;          } -        catch (const LLEventPump::DupPumpName&) -        { -            threw = true; -        } -        catch (const std::runtime_error& ex) -        { -            // This clause is because on Linux, on the viewer side, for this -            // one test program (though not others!), the -            // LLEventPump::DupPumpName exception isn't caught by the clause -            // above. Warn the user... -            std::cerr << "Failed to catch " << typeid(ex).name() << std::endl; -            // But if the expected exception was thrown, allow the test to -            // succeed anyway. Not sure how else to handle this odd case. -            if (std::string(typeid(ex).name()) == typeid(LLEventPump::DupPumpName).name()) -            { -                threw = true; -            } -            else -            { -                // We don't even recognize this exception. Let it propagate -                // out to TUT to fail the test. -                throw; -            } -        } -        catch (...) -        { -            std::cerr << "Utterly failed to catch expected exception!" << std::endl; -            // This case is full of fail. We HAVE to address it. -            throw; -        } -        ensure("second LLSDMessage should throw", threw); +        CATCH_AND_STORE_WHAT_IN(threw, LLEventPump::DupPumpName) +        ensure("second LLSDMessage should throw", ! threw.empty());      }      template<> template<> diff --git a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp index 3b04530c1a..3b04530c1a 100644..100755 --- a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp +++ b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp diff --git a/indra/llmessage/tests/lltesthttpclientadapter.cpp b/indra/llmessage/tests/lltesthttpclientadapter.cpp index 4539e4a540..4539e4a540 100644..100755 --- a/indra/llmessage/tests/lltesthttpclientadapter.cpp +++ b/indra/llmessage/tests/lltesthttpclientadapter.cpp diff --git a/indra/llmessage/tests/lltesthttpclientadapter.h b/indra/llmessage/tests/lltesthttpclientadapter.h index c29cbb3a2a..c29cbb3a2a 100644..100755 --- a/indra/llmessage/tests/lltesthttpclientadapter.h +++ b/indra/llmessage/tests/lltesthttpclientadapter.h diff --git a/indra/llmessage/tests/lltestmessagesender.cpp b/indra/llmessage/tests/lltestmessagesender.cpp index ee40e0249e..ee40e0249e 100644..100755 --- a/indra/llmessage/tests/lltestmessagesender.cpp +++ b/indra/llmessage/tests/lltestmessagesender.cpp diff --git a/indra/llmessage/tests/lltestmessagesender.h b/indra/llmessage/tests/lltestmessagesender.h index bb89289585..bb89289585 100644..100755 --- a/indra/llmessage/tests/lltestmessagesender.h +++ b/indra/llmessage/tests/lltestmessagesender.h diff --git a/indra/llmessage/tests/lltrustedmessageservice_test.cpp b/indra/llmessage/tests/lltrustedmessageservice_test.cpp index b287a29841..b287a29841 100644..100755 --- a/indra/llmessage/tests/lltrustedmessageservice_test.cpp +++ b/indra/llmessage/tests/lltrustedmessageservice_test.cpp diff --git a/indra/llmessage/tests/llxfer_file_test.cpp b/indra/llmessage/tests/llxfer_file_test.cpp index a8c1adf9b4..a8c1adf9b4 100644..100755 --- a/indra/llmessage/tests/llxfer_file_test.cpp +++ b/indra/llmessage/tests/llxfer_file_test.cpp diff --git a/indra/llmessage/tests/networkio.h b/indra/llmessage/tests/networkio.h index 2aff90ca1e..2aff90ca1e 100644..100755 --- a/indra/llmessage/tests/networkio.h +++ b/indra/llmessage/tests/networkio.h diff --git a/indra/llmessage/tests/test_llsdmessage_peer.py b/indra/llmessage/tests/test_llsdmessage_peer.py index fe4f3a8c01..e45249b1cb 100644..100755 --- a/indra/llmessage/tests/test_llsdmessage_peer.py +++ b/indra/llmessage/tests/test_llsdmessage_peer.py @@ -39,6 +39,9 @@ sys.path.insert(0, os.path.join(mydir, os.pardir, os.pardir, "lib", "python"))  from indra.util.fastest_elementtree import parse as xml_parse  from indra.base import llsd  from testrunner import freeport, run, debug, VERBOSE +import time + +_storage=None  class TestHTTPRequestHandler(BaseHTTPRequestHandler):      """This subclass of BaseHTTPRequestHandler is to receive and echo @@ -90,21 +93,14 @@ class TestHTTPRequestHandler(BaseHTTPRequestHandler):          # Read the provided POST data.          self.answer(self.read_xml()) +    def do_PUT(self): +        # Read the provided PUT data. +        self.answer(self.read_xml()) +      def answer(self, data, withdata=True): +        global _storage          debug("%s.answer(%s): self.path = %r", self.__class__.__name__, data, self.path) -        if "fail" not in self.path: -            data = data.copy()          # we're going to modify -            # Ensure there's a "reply" key in data, even if there wasn't before -            data["reply"] = data.get("reply", llsd.LLSD("success")) -            response = llsd.format_xml(data) -            debug("success: %s", response) -            self.send_response(200) -            self.send_header("Content-type", "application/llsd+xml") -            self.send_header("Content-Length", str(len(response))) -            self.end_headers() -            if withdata: -                self.wfile.write(response) -        else:                           # fail requested +        if "fail" in self.path or "test/error" in self.path: # fail requested              status = data.get("status", 500)              # self.responses maps an int status to a (short, long) pair of              # strings. We want the longer string. That's why we pass a string @@ -117,6 +113,30 @@ class TestHTTPRequestHandler(BaseHTTPRequestHandler):                                                     "without providing a reason" % status))[1])              debug("fail requested: %s: %r", status, reason)              self.send_error(status, reason) +        else: +            if "web/echo" in self.path: +                pass +            elif "test/timeout" in self.path: +                time.sleep(5.0) +                return +            elif "test/storage" in self.path: +                if "GET" == self.command: +                    data = _storage +                else: +                    _storage = data +                    data = "ok" +            else: +                data = data.copy()          # we're going to modify +                # Ensure there's a "reply" key in data, even if there wasn't before +                data["reply"] = data.get("reply", llsd.LLSD("success")) +            response = llsd.format_xml(data) +            debug("success: %s", response) +            self.send_response(200) +            self.send_header("Content-type", "application/llsd+xml") +            self.send_header("Content-Length", str(len(response))) +            self.end_headers() +            if withdata: +                self.wfile.write(response)      if not VERBOSE:          # When VERBOSE is set, skip both these overrides because they exist to diff --git a/indra/llmessage/tests/testrunner.py b/indra/llmessage/tests/testrunner.py index 5b9beb359b..5b9beb359b 100644..100755 --- a/indra/llmessage/tests/testrunner.py +++ b/indra/llmessage/tests/testrunner.py | 
