diff --git a/Testing/Code/TestSystem/CMakeLists.txt b/Testing/Code/TestSystem/CMakeLists.txt index 91883a3cae25bf723e7ab1b5f7ead2674bc9a7ac..5c35cf0121fa846348f4bf034f170b49aba84480 100644 --- a/Testing/Code/TestSystem/CMakeLists.txt +++ b/Testing/Code/TestSystem/CMakeLists.txt @@ -20,6 +20,12 @@ SET(EPSILON_3 0.001) SET(TESTSYSTEM_TESTS ${CXX_TEST_PATH}/otbTestSystemTests) +#Test if the current working copy corresponds to the nightly revision number +ADD_TEST(tsTuIsNightlyRevision ${TESTSYSTEM_TESTS} + otbIsNightlyRevision + ${OTB_WC_REVISION} + http://www.orfeo-toolbox.org/nightly/libNightlyNumber ) + #Test a basic ascii comparison ADD_TEST(tsTvCompareAscii ${TESTSYSTEM_TESTS} --compare-ascii ${NOTOL} @@ -124,6 +130,7 @@ ADD_TEST(tsTvCompareAscii5epsilon2 ${TESTSYSTEM_TESTS} # ------- CXX source files ----------------------------------- SET(TESTSYSTEM_SRCS otbTestSystemTests.cxx +otbIsNightlyRevision.cxx otbCompareAsciiTests.cxx otbCompareAsciiTests2.cxx otbCompareAsciiTests3.cxx diff --git a/Testing/Code/TestSystem/otbIsNightlyRevision.cxx b/Testing/Code/TestSystem/otbIsNightlyRevision.cxx new file mode 100644 index 0000000000000000000000000000000000000000..765905530626a324d930973de08d02302ff5e36a --- /dev/null +++ b/Testing/Code/TestSystem/otbIsNightlyRevision.cxx @@ -0,0 +1,47 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include <iostream> +#include <fstream> + +#include "otbCurlHelper.h" + +int otbIsNightlyRevision(int argc, char * argv[]) +{ + if (argc != 2) + { + return EXIT_FAILURE; + } + + std::string wcRevision = argv[1]; + std::string nightlyRevisionUrl = argv[2]; + + otb::CurlHelper::Pointer curl = otb::CurlHelper::New(); + + std::string nightlyRevision; + curl->RetrieveUrlInMemory(nightlyRevisionUrl, nightlyRevision); + + if (nightlyRevision == wcRevision) + { + return EXIT_SUCCESS; + } + else + { + return EXIT_FAILURE; + } + +} diff --git a/Testing/Code/TestSystem/otbTestSystemTests.cxx b/Testing/Code/TestSystem/otbTestSystemTests.cxx index a3c3c06d022f8e8d7517a857c69a9edd5a190553..af852e91c7aba1fdf8ef52617ea07fa2f5b7702d 100644 --- a/Testing/Code/TestSystem/otbTestSystemTests.cxx +++ b/Testing/Code/TestSystem/otbTestSystemTests.cxx @@ -26,6 +26,7 @@ void RegisterTests() { + REGISTER_TEST(otbIsNightlyRevision); REGISTER_TEST(otbCompareAsciiTests); REGISTER_TEST(otbCompareAsciiTests2); REGISTER_TEST(otbCompareAsciiTests3);