diff options
| author | Monty Brandenberg <monty@lindenlab.com> | 2012-06-11 19:06:52 -0400 |
|---|---|---|
| committer | Monty Brandenberg <monty@lindenlab.com> | 2012-06-11 19:06:52 -0400 |
| commit | 75242eab8f8a892c792681fca080d86cfbb3e061 (patch) | |
| tree | 9703c6539ecb58b657b6b2d11bedf35eb8573ce6 /indra/llcorehttp/tests/llcorehttp_test.cpp | |
| parent | 267ab5b417eaef64a170d69ad83334df9d566ed9 (diff) | |
Bring in the testrunner/http server scaffold for better integration testing.
This brings in a copy of llmessage's llsdmessage testing server. We run
a mocked HTTP service to handle requests and the integration tests run
against it by picking up the LL_TEST_PORT environment variable when running.
Add some checks and output to produce useful info when run in the wrong
environment and when bad status is received. Later will add a dead port
as well so we can test that rather than use 'localhost:2'.
Diffstat (limited to 'indra/llcorehttp/tests/llcorehttp_test.cpp')
| -rw-r--r-- | indra/llcorehttp/tests/llcorehttp_test.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/indra/llcorehttp/tests/llcorehttp_test.cpp b/indra/llcorehttp/tests/llcorehttp_test.cpp index 2d48bca443..f59361ab53 100644 --- a/indra/llcorehttp/tests/llcorehttp_test.cpp +++ b/indra/llcorehttp/tests/llcorehttp_test.cpp @@ -27,6 +27,7 @@ #include "llcorehttp_test.h" #include <iostream> +#include <sstream> // These are not the right way in viewer for some reason: // #include <tut/tut.hpp> @@ -130,3 +131,38 @@ void ssl_locking_callback(int mode, int type, const char * /* file */, int /* li } +std::string get_base_url() +{ + const char * env(getenv("LL_TEST_PORT")); + + if (! env) + { + std::cerr << "LL_TEST_PORT environment variable missing." << std::endl; + std::cerr << "Test expects to run in test_llcorehttp_peer.py script." << std::endl; + tut::ensure("LL_TEST_PORT set in environment", NULL != env); + } + + int port(atoi(env)); + std::ostringstream out; + out << "http://localhost:" << port << "/"; + return out.str(); +} + + +void stop_thread(LLCore::HttpRequest * req) +{ + if (req) + { + req->requestStopThread(NULL); + + int count = 0; + int limit = 10; + while (count++ < limit && ! HttpService::isStopped()) + { + req->update(1000); + usleep(100000); + } + } +} + + |
