From: James Turner Date: Fri, 8 Jan 2016 18:17:02 +0000 (-0600) Subject: Linux test_HTTP fixes. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=598b64fa9569c16878c904e344e2e2775e210c42;p=simgear.git Linux test_HTTP fixes. libCurl HTTP unit-test fixes. --- diff --git a/simgear/io/test_HTTP.cxx b/simgear/io/test_HTTP.cxx index d8b0f939..54693599 100644 --- a/simgear/io/test_HTTP.cxx +++ b/simgear/io/test_HTTP.cxx @@ -7,6 +7,8 @@ #include +#include + #include "HTTPClient.hxx" #include "HTTPRequest.hxx" @@ -15,6 +17,10 @@ #include #include +#if defined(ENABLE_CURL) +#include +#endif + using std::cout; using std::cerr; using std::endl; @@ -663,16 +669,21 @@ int main(int argc, char* argv[]) cout << "done3" << endl; // test connectToHost failure -// causes timeout on Jenkins slaves -#if 1 { TestRequest* tr = new TestRequest("http://not.found/something"); HTTP::Request_ptr own(tr); cl.makeRequest(tr); waitForFailed(&cl, tr); - COMPARE(tr->responseCode(), ENOENT); - } + + + +#if defined(ENABLE_CURL) + const int HOST_NOT_FOUND_CODE = CURLE_COULDNT_RESOLVE_HOST; +#else + const int HOST_NOT_FOUND_CODE = ENOENT; #endif + COMPARE(tr->responseCode(), HOST_NOT_FOUND_CODE); + } cout << "testing abrupt close" << endl; // test server-side abrupt close @@ -681,7 +692,13 @@ int main(int argc, char* argv[]) HTTP::Request_ptr own(tr); cl.makeRequest(tr); waitForFailed(&cl, tr); - COMPARE(tr->responseCode(), 500); + + #if defined(ENABLE_CURL) + const int SERVER_NO_DATA_CODE = CURLE_GOT_NOTHING; + #else + const int SERVER_NO_DATA_CODESERVER_NO_DATA_CODE = 500; + #endif + COMPARE(tr->responseCode(), SERVER_NO_DATA_CODE); } cout << "testing proxy close" << endl;