Commit 1af8df2d authored by Guillaume Pasero's avatar Guillaume Pasero

BUG: update Curl adpaters test for git repository

parent 74e0ed91
......@@ -10,6 +10,7 @@ otb_module(OTBCurlAdapters
TEST_DEPENDS
OTBTestKernel
OTBTinyXML
DESCRIPTION
"${DOCUMENTATION}"
......
......@@ -14,11 +14,11 @@ otb_module_target_label(otbCurlAdaptersTestDriver)
otb_add_test(NAME tsTvDataIsNightlyRevision COMMAND otbCurlAdaptersTestDriver
otbIsNightlyRevision
${OTB_DATA_WC_REVISION}
http://hg.orfeo-toolbox.org/nightly/dataNightlyNumber )
https://git.orfeo-toolbox.org/otb-data.git/commit/refs/heads/nightly )
set_property(TEST tsTvDataIsNightlyRevision PROPERTY RESOURCE_LOCK web_access)
otb_add_test(NAME tsTvIsNightlyRevision COMMAND otbCurlAdaptersTestDriver
otbIsNightlyRevision
${OTB_WC_REVISION}
http://hg.orfeo-toolbox.org/nightly/libNightlyNumber )
https://git.orfeo-toolbox.org/otb.git/commit/refs/heads/nightly )
set_property(TEST tsTvIsNightlyRevision PROPERTY RESOURCE_LOCK web_access)
......@@ -18,6 +18,7 @@
#include <iostream>
#include <fstream>
#include "otb_tinyxml.h"
#include "otbCurlHelper.h"
int otbIsNightlyRevision(int argc, char * argv[])
......@@ -33,8 +34,23 @@ int otbIsNightlyRevision(int argc, char * argv[])
otb::CurlHelper::Pointer curl = otb::CurlHelper::New();
std::string curlOutput;
curl->RetrieveUrlInMemory(nightlyRevisionUrl, curlOutput);
std::string nightlyRevision;
curl->RetrieveUrlInMemory(nightlyRevisionUrl, nightlyRevision);
TiXmlDocument doc;
doc.Parse(curlOutput.c_str());
TiXmlHandle docHandle(&doc);
TiXmlElement* commitChild = docHandle.FirstChild("html").FirstChild("body").Child("div",3).FirstChild("table").Child("tr",4).Child("td",1).Element();
if (commitChild)
{
if (strcmp(commitChild->Attribute("class"),"sha1") == 0)
{
nightlyRevision = std::string(commitChild->GetText());
}
}
if (nightlyRevision == wcRevision)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment