Commit 5218fec9 authored by Alexandre Fiche's avatar Alexandre Fiche
Browse files

Merge branch 'release-tests' into 'develop'

Change WASP_TEST env var into a cmake option

See merge request !23
parents ae98f0d8 a77cef57
Pipeline #10863 passed with stages
in 16 minutes and 50 seconds
......@@ -81,7 +81,7 @@ build-env-ubuntu:
-DCMAKE_INSTALL_PREFIX=../install
-DCMAKE_CXX_FLAGS=-Wl,--as-needed
-DBUILD_TESTING=ON
-DWASPDATA_INPUT_DIR=$WASP_TEST
-DWASP_INPUT_DATA=$WASP_TEST
../
- ninja install
- rclone copy s3_otb:wasp-data/test_Preprocessing ../Data/test_Preprocessing
......@@ -89,7 +89,8 @@ build-env-ubuntu:
- rclone copy s3_otb:wasp-data/test_Preprocessing_Light ../Data/test_Preprocessing_Light
- rclone copy s3_otb:wasp-data/test_ProductFormatter_Light ../Data/test_ProductFormatter_Light
- rclone copy s3_otb:wasp-data/test_UpdateSynthesis_Light ../Data/test_UpdateSynthesis_Light
- ctest -E LUT
- rclone copy s3_otb:wasp-data/test_SimpleLutXMLReader ../Data/test_SimpleLutXMLReader
- ctest -V
- mkdir ../pkg-build
- cd ../pkg-build
- cmake -GNinja
......@@ -138,7 +139,7 @@ build-centos7-feat:
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DBUILD_TESTING=ON
-DCMAKE_BUILD_TYPE=Release
-DWASPDATA_INPUT_DIR=$WASP_TEST
-DWASP_INPUT_DATA=$WASP_TEST
../
- ninja
- rclone copy s3_otb:wasp-data/test_Preprocessing ../Data/test_Preprocessing
......@@ -146,7 +147,8 @@ build-centos7-feat:
- rclone copy s3_otb:wasp-data/test_Preprocessing_Light ../Data/test_Preprocessing_Light
- rclone copy s3_otb:wasp-data/test_ProductFormatter_Light ../Data/test_ProductFormatter_Light
- rclone copy s3_otb:wasp-data/test_UpdateSynthesis_Light ../Data/test_UpdateSynthesis_Light
- ctest -D ExperimentalTest -E LUT
- rclone copy s3_otb:wasp-data/test_SimpleLutXMLReader ../Data/test_SimpleLutXMLReader
- ctest -D ExperimentalTest
- find . -name "*.gcda" -exec gcov -p '{}' > /dev/null \;
- ls *.gcov | grep -E -v '^\^#Code#' | xargs -L 1 rm
- echo Filtered $(ls *.gcov | wc -l) gcov reports
......@@ -199,12 +201,14 @@ build-ubuntu-feat:
script:
- $(ls ./pkg-build/WASP-*.run | head -n 1) --target WASP
- export PYTHONPATH=$(pwd)/WASP/bin:$(pwd)/WASP/lib/python
- mv $(pwd)/WASP/bin/gdal-config /opt/otb/bin/
- pip install gdal==$(gdal-config --version)
- rclone copy s3_otb:wasp-data/test_S2B_T31TCH_1_20171008 Data/test_S2B_T31TCH_1_20171008
- rclone copy s3_otb:wasp-data/test_VNS_FR-LUS_4_20180207 Data/test_VNS_FR-LUS_4_20180207
- rclone copy s3_otb:wasp-data/test_S2B_T31TCH_1_20171008_l2_light_to_l3_light Data/test_S2B_T31TCH_1_20171008_l2_light_to_l3_light
- rclone copy s3_otb:wasp-data/test_S2B_T31TCH_1_20171008_l2_to_l3_light Data/test_S2B_T31TCH_1_20171008_l2_to_l3_light
- cd WASP
- nosetests --with-xunit --with-coverage --cover-xml --cover-package=bin lib/python/test_S2B_T31TCH_1_20171008.py lib/python/test_VNS_FR-LUS_4_20180207.py lib/python/test_S2B_T31TCH_1_20171008_l2_light_to_l3_light.py lib/python/test_S2B_T31TCH_1_20171008_l2_to_l3_light.py
- nosetests -v --with-xunit --with-coverage --cover-xml --cover-package=bin lib/python/test_S2B_T31TCH_1_20171008.py lib/python/test_VNS_FR-LUS_4_20180207.py lib/python/test_S2B_T31TCH_1_20171008_l2_light_to_l3_light.py lib/python/test_S2B_T31TCH_1_20171008_l2_to_l3_light.py
- cd ..
- sed -i "s@<source>.*</source>@<source>$CI_PROJECT_DIR</source>@" WASP/coverage.xml
- sed -i 's@filename="@filename="PythonScripts/@' WASP/coverage.xml
......
......@@ -43,11 +43,24 @@ add_definitions(-DVCL_CAN_STATIC_CONST_INIT_FLOAT=0)
option(WASP_PYTHON_TESTS "Also run WASP Python tests" OFF)
set(WASPDATA_INPUT_DIR "/WASP-Data-Input" CACHE PATH "input dir for testing")
set(WASP_INPUT_DATA "/WASP-Data-Input" CACHE PATH "input dir for testing")
set(OTB_INSTALL_APP_DIR "lib/otb/applications")
set(WASP_APP_BUILD_DIR "${CMAKE_BINARY_DIR}/lib/otb/applications")
# Configure the default WASP_BASELINE_ROOT for the location of OTB Data.
find_path(WASP_BASELINE_ROOT
NAMES README-WASP-Baseline
HINTS ${CMAKE_CURRENT_SOURCE_DIR}/Data
)
if(WASP_BASELINE_ROOT)
message(STATUS "WASP_BASELINE_ROOT: ${WASP_BASELINE_ROOT}")
endif()
add_subdirectory(Code/Common)
add_subdirectory(Code/MetadataHelper)
......@@ -59,7 +72,9 @@ add_subdirectory(Code/UpdateSynthesis)
add_subdirectory(Code/ProductFormatter)
add_subdirectory(PythonScripts)
install(FILES ./Scripts/WASP PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_EXECUTE DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(FILES ./Scripts/WASP ./Data/gdal-config PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_EXECUTE DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
message(WARNING "gdal-config move to OTB directory: ${OTB_DIR}/../../../bin/")
install(FILES ./Data/gdal-config PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_EXECUTE DESTINATION ${OTB_DIR}/../../../bin/)
# first we can indicate the documentation build as an option and set it to ON by default
option(BUILD_DOC "Build documentation" ON)
......
......@@ -32,6 +32,7 @@
#include "otbWrapperApplication.h"
using namespace ts::preprocessing;
const char * PreprocessingSentinel::GetNameOfClass() const
......@@ -39,6 +40,7 @@ const char * PreprocessingSentinel::GetNameOfClass() const
return "PreprocessingSentinel";
}
PreprocessingAdapter::FloatImageType::Pointer PreprocessingSentinel::getCloudMask(const std::string &filename, const unsigned char &bit){
return getFloatMask(filename, bit);
}
......
......@@ -20,7 +20,7 @@ target_link_libraries(test_ComputeNDVI
)
target_include_directories(test_ComputeNDVI PUBLIC ../include)
add_test(test_ComputeNDVI test_ComputeNDVI)
add_test(test_ComputeNDVI test_ComputeNDVI -- ${WASP_BASELINE_ROOT} ${WASP_INPUT_DATA})
add_executable(test_CreateS2AnglesRaster test_CreateS2AnglesRaster.cxx ../src/CreateS2AnglesRaster.cxx)
target_link_libraries(test_CreateS2AnglesRaster
......@@ -32,7 +32,7 @@ target_link_libraries(test_CreateS2AnglesRaster
)
target_include_directories(test_CreateS2AnglesRaster PUBLIC ../include)
add_test(test_CreateS2AnglesRaster test_CreateS2AnglesRaster)
add_test(test_CreateS2AnglesRaster test_CreateS2AnglesRaster -- ${WASP_BASELINE_ROOT} ${WASP_INPUT_DATA})
add_executable(test_DirectionalCorrection test_DirectionalCorrection.cxx
../src/DirectionalModel.cxx
......@@ -46,7 +46,7 @@ target_link_libraries(test_DirectionalCorrection
)
target_include_directories(test_DirectionalCorrection PUBLIC ../include)
add_test(test_DirectionalCorrection test_DirectionalCorrection)
add_test(test_DirectionalCorrection test_DirectionalCorrection -- ${WASP_BASELINE_ROOT} ${WASP_INPUT_DATA})
add_executable(test_DirectionalCorrectionLUT test_DirectionalCorrectionLUT.cxx
../src/DirectionalCorrectionLUT.cxx)
......@@ -61,14 +61,14 @@ target_link_libraries(test_DirectionalCorrectionLUT
)
target_include_directories(test_DirectionalCorrectionLUT PUBLIC ../include)
add_test(test_DirectionalCorrectionLUT test_DirectionalCorrectionLUT)
add_test(test_DirectionalCorrectionLUT test_DirectionalCorrectionLUT -- ${WASP_BASELINE_ROOT} ${WASP_INPUT_DATA})
otb_test_application(NAME apTvCompositePreprocessing
APP CompositePreprocessing
OPTIONS -xml ${WASPDATA_INPUT_DIR}/test_Preprocessing/INPUTS/SENTINEL2A_20180315-144453-175_L2A_T19LGH_D_V1-6/SENTINEL2A_20180315-144453-175_L2A_T19LGH_D_V1-6_MTD_ALL.xml
OPTIONS -xml ${WASP_INPUT_DATA}/test_Preprocessing/INPUTS/SENTINEL2A_20180315-144453-175_L2A_T19LGH_D_V1-6/SENTINEL2A_20180315-144453-175_L2A_T19LGH_D_V1-6_MTD_ALL.xml
-outcld cld10.tif
-outwat wat10.tif
-outsnw snw10.tif
......@@ -76,17 +76,17 @@ otb_test_application(NAME apTvCompositePreprocessing
-outr1 out_R1.tif
-outr2 out_R2.tif
-dircor roy
-dircor.roy.scatteringcoeffsr1 ${WASPDATA_INPUT_DIR}/test_Preprocessing/INPUTS/scattering_coeffs_10m.txt
-dircor.roy.scatteringcoeffsr2 ${WASPDATA_INPUT_DIR}/test_Preprocessing/INPUTS/scattering_coeffs_20m.txt)
-dircor.roy.scatteringcoeffsr1 ${WASP_INPUT_DATA}/test_Preprocessing/INPUTS/scattering_coeffs_10m.txt
-dircor.roy.scatteringcoeffsr2 ${WASP_INPUT_DATA}/test_Preprocessing/INPUTS/scattering_coeffs_20m.txt)
otb_test_application(NAME apTvCompositePreprocessingLight
APP CompositePreprocessing
OPTIONS -xml ${WASPDATA_INPUT_DIR}/test_Preprocessing_Light/INPUTS/SENTINEL2A_20211006-172402-047_L2A_T14SPE_C_V2-2_LIGHT/SENTINEL2A_20211006-172402-047_L2A_T14SPE_C_V2-2_MTD_ALL.xml
OPTIONS -xml ${WASP_INPUT_DATA}/test_Preprocessing_Light/INPUTS/SENTINEL2A_20211006-172402-047_L2A_T14SPE_C_V2-2_LIGHT/SENTINEL2A_20211006-172402-047_L2A_T14SPE_C_V2-2_MTD_ALL.xml
-outcld cld10.tif
-outwat wat10.tif
-outsnw snw10.tif
-outaot aot10.tif
-outr3 out_R1.tif
-dircor roy
-dircor.roy.scatteringcoeffsr3 ${WASPDATA_INPUT_DIR}/test_Preprocessing_Light/INPUTS/scattering_coeffs_light.txt)
\ No newline at end of file
-dircor.roy.scatteringcoeffsr3 ${WASP_INPUT_DATA}/test_Preprocessing_Light/INPUTS/scattering_coeffs_light.txt)
\ No newline at end of file
......@@ -33,10 +33,10 @@
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "itkImageRegionIterator.h"
using namespace boost::unit_test;
using namespace ts;
#define WASP_TEST "WASP_TEST"
#define TEST_NAME "test_Preprocessing"
typedef float OutputPixelType;
......@@ -46,9 +46,11 @@ typedef otb::ImageFileReader<OutputImageType> OutputImageReaderType;
typedef otb::ImageFileWriter<OutputImageType> OutputImageWriterType;
BOOST_AUTO_TEST_CASE(testNDVI){
std::string wasp_test = getEnvVar(WASP_TEST);
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 3 );
std::string wasp_baseline = framework::master_test_suite().argv[1];
std::string wasp_test = framework::master_test_suite().argv[2];
if(wasp_test.empty()){
std::cout << "Cannot find WASP_TEST environment variable. Exiting..." << std::endl;
std::cout << "Please set WASP_INPUT_DATA cmake option. Exiting..." << std::endl;
exit(1);
}
std::string xml = wasp_test + "/"
......@@ -57,11 +59,13 @@ BOOST_AUTO_TEST_CASE(testNDVI){
"SENTINEL2A_20180315-144453-175_L2A_T19LGH_D_V1-6/"
"SENTINEL2A_20180315-144453-175_L2A_T19LGH_D_V1-6_MTD_ALL.xml";
NDVIType ndvi;
ndvi.DoInit(xml);
OutputImageType::Pointer output = ndvi.DoExecute().GetPointer();
OutputImageReaderType::Pointer gReader = OutputImageReaderType::New();
gReader->SetFileName(wasp_test + "/" + TEST_NAME + "/ndvi.tif");
gReader->SetFileName(wasp_baseline + "/" + TEST_NAME + "/ndvi.tif");
OutputImageType::Pointer reference = gReader->GetOutput();
reference->UpdateOutputInformation();
BOOST_CHECK_EQUAL(reference->GetLargestPossibleRegion(), output->GetLargestPossibleRegion());
......
......@@ -35,10 +35,11 @@
#include "itkImageRegionIterator.h"
#include "otbWrapperApplication.h"
#include "otbNoDataHelper.h"
using namespace boost::unit_test;
using namespace ts;
#define WASP_TEST "WASP_TEST"
// #define WASP_TEST "WASP_TEST"
#define TEST_NAME "test_Preprocessing"
typedef float OutputPixelType;
......@@ -48,12 +49,15 @@ typedef otb::ImageFileReader<OutputImageType> OutputImageReaderType;
typedef otb::ImageFileWriter<OutputImageType> OutputImageWriterType;
BOOST_AUTO_TEST_CASE(testS2AnglesRasterCreationR2){
int resolution = 1;
std::string wasp_test = getEnvVar(WASP_TEST);
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 3 );
std::string wasp_baseline = framework::master_test_suite().argv[1];
std::string wasp_test = framework::master_test_suite().argv[2];
if(wasp_test.empty()){
std::cout << "Cannot find WASP_TEST environment variable. Exiting..." << std::endl;
std::cout << "Please set WASP_INPUT_DATA cmake option. Exiting..." << std::endl;
exit(1);
}
int resolution = 1;
std::string xml = wasp_test + "/"
+ TEST_NAME + "/"
"INPUTS/"
......@@ -65,7 +69,7 @@ BOOST_AUTO_TEST_CASE(testS2AnglesRasterCreationR2){
OutputImageType::Pointer output = rasterCreator.DoExecute();
output->UpdateOutputInformation();
OutputImageReaderType::Pointer gReader = OutputImageReaderType::New();
gReader->SetFileName(wasp_test + "/" + TEST_NAME + "/s2angles_raster_r" + std::to_string(resolution+1) + ".tif");
gReader->SetFileName(wasp_baseline + "/" + TEST_NAME + "/s2angles_raster_r" + std::to_string(resolution+1) + ".tif");
OutputImageType::Pointer reference = gReader->GetOutput();
reference->UpdateOutputInformation();
BOOST_CHECK_EQUAL(reference->GetLargestPossibleRegion(), output->GetLargestPossibleRegion());
......
......@@ -34,10 +34,11 @@
#include "itkImageRegionIterator.h"
#include "otbWrapperApplication.h"
#include "ImageResampler.h"
using namespace boost::unit_test;
using namespace ts;
#define WASP_TEST "WASP_TEST"
// #define WASP_TEST "WASP_TEST"
#define TEST_NAME "test_Preprocessing"
typedef float FloatPixelType;
......@@ -51,12 +52,15 @@ typedef otb::Wrapper::Int16VectorImageType ShortVectorImageType;
typedef otb::ImageFileReader<ShortVectorImageType> ShortVectorImageReaderType;
BOOST_AUTO_TEST_CASE(testDirectionalCorrectionR2){
size_t resolution = 1;
std::string wasp_test = getEnvVar(WASP_TEST);
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 3 );
std::string wasp_baseline = framework::master_test_suite().argv[1];
std::string wasp_test = framework::master_test_suite().argv[2];
if(wasp_test.empty()){
std::cout << "Cannot find WASP_TEST environment variable. Exiting..." << std::endl;
std::cout << "Please set WASP_INPUT_DATA cmake option. Exiting..." << std::endl;
exit(1);
}
size_t resolution = 1;
std::string xml = wasp_test + "/"
+ TEST_NAME + "/"
"INPUTS/"
......@@ -84,14 +88,14 @@ BOOST_AUTO_TEST_CASE(testDirectionalCorrectionR2){
anglesReader->UpdateOutputInformation();
FloatVectorImageType::Pointer anglesImg = anglesReader->GetOutput();
InputImageReaderType::Pointer ndviReader = InputImageReaderType::New();
ndviReader->SetFileName(wasp_test + "/" + TEST_NAME + "/INPUTS/" + "ndvi.tif");
ndviReader->SetFileName(wasp_baseline + "/" + TEST_NAME + "/ndvi.tif");
ndviReader->UpdateOutputInformation();
InputImageType::Pointer ndviImg = resampler.getResampler(ndviReader->GetOutput(), 0.5f)->GetOutput();
dirCorr.Init(resolution, xml, scatteringcoeffs, cldImg, watImg, snwImg, anglesImg, ndviImg);
dirCorr.DoExecute();
ShortVectorImageType::Pointer output = dirCorr.GetCorrectedImg();
ShortVectorImageReaderType::Pointer gReader = ShortVectorImageReaderType::New();
gReader->SetFileName(wasp_test + "/" + TEST_NAME + "/0_CP_R2.tif");
gReader->SetFileName(wasp_baseline + "/" + TEST_NAME + "/0_CP_R2.tif");
ShortVectorImageType::Pointer reference = gReader->GetOutput();
reference->UpdateOutputInformation();
BOOST_CHECK_EQUAL(reference->GetLargestPossibleRegion(), output->GetLargestPossibleRegion());
......
......@@ -34,10 +34,11 @@
#include "itkImageRegionIterator.h"
#include "otbWrapperApplication.h"
#include "ImageResampler.h"
using namespace boost::unit_test;
using namespace ts;
#define WASP_TEST "WASP_TEST"
// #define WASP_TEST "WASP_TEST"
#define TEST_NAME "test_Preprocessing"
typedef float FloatPixelType;
......@@ -53,10 +54,13 @@ typedef otb::ImageFileWriter<ShortVectorImageType> ShortVectorImageWriterType;
typedef otb::ImageFileWriter<FloatVectorImageType> FloatVectorImageWriterType;
BOOST_AUTO_TEST_CASE(testDirectionalCorrectionR2){
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 3 );
std::string wasp_baseline = framework::master_test_suite().argv[1];
size_t resolution = 1;
std::string wasp_test = getEnvVar(WASP_TEST);
std::string wasp_test = framework::master_test_suite().argv[2];
if(wasp_test.empty()){
std::cout << "Cannot find WASP_TEST environment variable. Exiting..." << std::endl;
std::cout << "Please set WASP_INPUT_DATA cmake option. Exiting..." << std::endl;
exit(1);
}
std::string xml = wasp_test + "/"
......@@ -94,22 +98,22 @@ BOOST_AUTO_TEST_CASE(testDirectionalCorrectionR2){
dirCorr.DoExecute();
ShortVectorImageType::Pointer output = dirCorr.GetCorrectedImg();
ShortVectorImageReaderType::Pointer gReader = ShortVectorImageReaderType::New();
gReader->SetFileName(wasp_test + "/" + TEST_NAME + "/INPUTS/" + "/0_CP_R2.tif");
gReader->SetFileName(wasp_baseline + "/" + TEST_NAME + "/0_CP_R2.tif");
ShortVectorImageType::Pointer reference = gReader->GetOutput();
reference->Update();
output->Update();
ShortVectorImageWriterType::Pointer l_writer = ShortVectorImageWriterType::New();
l_writer->SetInput(output);
l_writer->SetFileName(wasp_test + "/" + TEST_NAME + "/OUTPUTS//0_CP_R2.tif");
std::cout<<"Writing to "<<wasp_test << "/" << TEST_NAME << "/OUTPUTS//0_CP_R2.tif"<<std::endl;
l_writer->Update();
// ShortVectorImageWriterType::Pointer l_writer = ShortVectorImageWriterType::New();
// l_writer->SetInput(output);
// l_writer->SetFileName(wasp_test + "/" + TEST_NAME + "/OUTPUTS//0_CP_R2.tif");
// std::cout<<"Writing to "<<wasp_test << "/" << TEST_NAME << "/OUTPUTS//0_CP_R2.tif"<<std::endl;
// l_writer->Update();
FloatVectorImageWriterType::Pointer l_coeffwriter = FloatVectorImageWriterType::New();
l_coeffwriter->SetInput(dirCorr.GetCoeffImg());
l_coeffwriter->SetFileName(wasp_test + "/" + TEST_NAME + "/OUTPUTS//0_COEFF_R2.tif");
std::cout<<"Writing coeff image to "<<wasp_test << "/" << TEST_NAME << "/OUTPUTS//0_COEFF_R2.tif"<<std::endl;
l_coeffwriter->Update();
// FloatVectorImageWriterType::Pointer l_coeffwriter = FloatVectorImageWriterType::New();
// l_coeffwriter->SetInput(dirCorr.GetCoeffImg());
// l_coeffwriter->SetFileName(wasp_test + "/" + TEST_NAME + "/OUTPUTS//0_COEFF_R2.tif");
// std::cout<<"Writing coeff image to "<<wasp_test << "/" << TEST_NAME << "/OUTPUTS//0_COEFF_R2.tif"<<std::endl;
// l_coeffwriter->Update();
/*itk::ImageRegionIterator<ShortVectorImageType> imageIteratorRef(reference,reference->GetLargestPossibleRegion());
itk::ImageRegionIterator<ShortVectorImageType> imageIteratorNew(output,output->GetLargestPossibleRegion());
......
......@@ -9,4 +9,4 @@ target_link_libraries(test_SimpleLUTXMLreader
)
target_include_directories(test_SimpleLUTXMLreader PUBLIC ../include)
add_test(test_SimpleLUTXMLreader test_SimpleLUTXMLreader)
add_test(test_SimpleLUTXMLreader test_SimpleLUTXMLreader -- ${WASP_INPUT_DATA})
......@@ -33,10 +33,10 @@
#include "../include/vnsLookUpTableFileReader.h"
#include "stdlib.h"
#include <string>
using namespace boost::unit_test;
#define TEST_NAME "test_SimpleLutXMLReader"
#define TEST_SRC ts::getEnvVar("WASP_TEST")
#define EXAMPLE_LUTXML1 "giplut_dircor.xml"
const std::vector<double> SolarZenithAngles = {15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80};
......@@ -46,8 +46,10 @@ const std::vector<double> Value_Out = {0.0993027, 0.073317952454, 0.065475486,
BOOST_AUTO_TEST_CASE(SimpleLUTXMLReaderExample1)
{
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
std::cout << std::string(TEST_SRC + "/" + TEST_NAME + "/" + EXAMPLE_LUTXML1) << std::endl;
ts::SimpleLutXMLFileHandler::Pointer l_LUTXMLHandler = ts::SimpleLutXMLFileHandler::New();
......@@ -74,8 +76,10 @@ BOOST_AUTO_TEST_CASE(SimpleLUTXMLReaderExample1)
BOOST_AUTO_TEST_CASE(SimpleLUTXMLReaderExample2)
{
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
std::cout << std::string(TEST_SRC + "/" + TEST_NAME + "/" + EXAMPLE_LUTXML1) << std::endl;
ts::SimpleLutXMLFileHandler::Pointer l_LUTXMLHandler = ts::SimpleLutXMLFileHandler::New();
......
......@@ -27,10 +27,10 @@ target_link_libraries(test_MuscateMetadataHelperVenus
)
target_include_directories(test_MuscateMetadataHelper PUBLIC ../include)
add_test(test_MuscateMetadataHelper test_MuscateMetadataHelper)
add_test(test_MuscateMetadataHelper test_MuscateMetadataHelper -- ${WASP_INPUT_DATA})
target_include_directories(test_MetadataBands PUBLIC ../include)
add_test(test_MetadataBands test_MetadataBands)
target_include_directories(test_MuscateMetadataHelperVenus PUBLIC ../include)
add_test(test_MuscateMetadataHelperVenus test_MuscateMetadataHelperVenus)
add_test(test_MuscateMetadataHelperVenus test_MuscateMetadataHelperVenus -- ${WASP_INPUT_DATA})
......@@ -30,11 +30,12 @@
#include "MuscateMetadataHelper.h"
#include "GlobalDefs.h"
#include <string>
using namespace boost::unit_test;
using namespace ts;
#define TEST_NAME "test_MuscateMetadata"
#define TEST_SRC getEnvVar("WASP_TEST")
#define INPUT_XML1 "SENTINEL2A_20170402-093844-724_L2A_T32MNE_D_V1-4_MTD_ALL.xml"
#define INPUT_XML2 "SENTINEL2A_20170923-105717-357_L2A_T31TCH_D_V1-4_MTD_ALL.xml"
#define INPUT_XML3 "SENTINEL2B_20171008-105012-463_L2A_T31TCH_C_V1-0_MTD_ALL.xml"
......@@ -69,8 +70,10 @@ inline bool ends_with(std::string const & value, std::vector<std::string> const
BOOST_AUTO_TEST_CASE(TestGetFilenameByString){
MuscateMetadataHelper helper;
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
std::cout << std::string(TEST_SRC + "/" + TEST_NAME + "/" + INPUT_XML1) << std::endl;
if(helper.LoadMetadataFile(std::string(TEST_SRC + "/" + TEST_NAME + "/" + INPUT_XML1))){
......@@ -87,8 +90,10 @@ BOOST_AUTO_TEST_CASE(TestGetFilenameByString){
BOOST_AUTO_TEST_CASE(TestLoadMetadata_S2A_T32MNE){
MuscateMetadataHelper helper;
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
if(helper.LoadMetadataFile(std::string(TEST_SRC + "/" + TEST_NAME + "/" + INPUT_XML1))){
BOOST_CHECK_EQUAL(helper.GetMissionName(), "SENTINEL2A");
......@@ -126,8 +131,10 @@ BOOST_AUTO_TEST_CASE(TestLoadMetadata_S2A_T32MNE){
BOOST_AUTO_TEST_CASE(TestLoadMetadata_S2A_T31TCH){
MuscateMetadataHelper helper;
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
if(helper.LoadMetadataFile(std::string(TEST_SRC + "/" + TEST_NAME + "/" + INPUT_XML2))){
BOOST_CHECK_EQUAL(helper.GetMissionName(), "SENTINEL2A");
......@@ -165,8 +172,10 @@ BOOST_AUTO_TEST_CASE(TestLoadMetadata_S2A_T31TCH){
BOOST_AUTO_TEST_CASE(TestLoadMetadata_S2B_T31TCH){
MuscateMetadataHelper helper;
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
if(helper.LoadMetadataFile(std::string(TEST_SRC + "/" + TEST_NAME + "/" + INPUT_XML3))){
......
......@@ -30,11 +30,11 @@
#include "../include/MuscateMetadataHelper.h"
#include "../include/GlobalDefs.h"
#include <string>
using namespace boost::unit_test;
using namespace ts;
#define TEST_NAME "test_MuscateMetadata"
#define TEST_SRC getEnvVar("WASP_TEST")
#define INPUT_XML1 "VENUS-XS_20180202-105554-000_L2A_FR-LUS_C_V1-0_MTD_ALL.xml"
const std::vector<std::string> FRE_endings = {"FRE_B1", "FRE_B2", "FRE_B3", "FRE_B4", "FRE_B5", "FRE_B6", "FRE_B7", "FRE_B8", "FRE_B9", "FRE_B10", "FRE_B11", "FRE_B12"};
......@@ -65,8 +65,10 @@ inline bool ends_with(std::string const & value, std::vector<std::string> const
BOOST_AUTO_TEST_CASE(TestGetFilenameByString){
MuscateMetadataHelper helper;
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
std::cout << std::string(TEST_SRC + "/" + TEST_NAME + "/" + INPUT_XML1) << std::endl;
if(helper.LoadMetadataFile(std::string(TEST_SRC + "/" + TEST_NAME + "/" + INPUT_XML1))){
......@@ -83,8 +85,10 @@ BOOST_AUTO_TEST_CASE(TestGetFilenameByString){
BOOST_AUTO_TEST_CASE(TestLoadMetadata_Venus_FR_LUS){
MuscateMetadataHelper helper;
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
std::cout << std::string(TEST_SRC + "/" + TEST_NAME + "/" + INPUT_XML1) << std::endl;
if(helper.LoadMetadataFile(std::string(TEST_SRC + "/" + TEST_NAME + "/" + INPUT_XML1))){
......
......@@ -3,7 +3,7 @@ target_link_libraries(test_MuscateMetadataReader
MuscateMetadata
MetadataHelper
"${Boost_LIBRARIES}")
add_test(test_MuscateMetadataReader test_MuscateMetadataReader)
add_test(test_MuscateMetadataReader test_MuscateMetadataReader -- ${WASP_INPUT_DATA})
add_executable(test_MuscateMetadataWriteRead test_MuscateMetadataWriteRead.cxx)
target_link_libraries(test_MuscateMetadataWriteRead
......@@ -17,4 +17,4 @@ target_link_libraries(test_MuscateMetadataReadWrite
MuscateMetadata
MetadataHelper
"${Boost_LIBRARIES}")
add_test(test_MuscateMetadataReadWrite test_MuscateMetadataReadWrite)
add_test(test_MuscateMetadataReadWrite test_MuscateMetadataReadWrite -- ${WASP_INPUT_DATA})
......@@ -35,7 +35,6 @@
#include "stdlib.h"
#define TEST_NAME "test_MuscateMetadata"
#define TEST_SRC ts::getEnvVar("WASP_TEST")
#define EXAMPLE_XML1 "SENTINEL2A_20170402-093844-724_L2A_T32MNE_D_V1-4_MTD_ALL.xml"
#define EXAMPLE_XML2 "SENTINEL2B_20171008-105012-463_L2A_T31TCH_C_V1-0_MTD_ALL.xml"
#define EXAMPLE_XML3 "LANDSAT8-OLITIRS-XS_20170504-103532-111_L2A_T31TCH_C_V1-0_MTD_ALL.xml"
......@@ -47,10 +46,13 @@
#define EXAMPLE_XML_OUT4 "VENUS_MuscateWriteRead.xml"
using namespace ts::muscate;
using namespace boost::unit_test;
BOOST_AUTO_TEST_CASE(MuscateReadWriteS2A){
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
std::cout << std::string(TEST_SRC + "/" + TEST_NAME + "/" EXAMPLE_XML1) << std::endl;
auto reader = MuscateMetadataReader::New();
......@@ -76,8 +78,10 @@ BOOST_AUTO_TEST_CASE(MuscateReadWriteS2A){
}
BOOST_AUTO_TEST_CASE(MuscateReadWriteS2B){
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
std::cout << std::string(TEST_SRC + "/" + TEST_NAME + "/" EXAMPLE_XML2) << std::endl;
auto reader = MuscateMetadataReader::New();
......@@ -103,8 +107,10 @@ BOOST_AUTO_TEST_CASE(MuscateReadWriteS2B){
}
BOOST_AUTO_TEST_CASE(MuscateReadWriteL8){
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
std::cout << std::string(TEST_SRC + "/" + TEST_NAME + "/" EXAMPLE_XML3) << std::endl;
auto reader = MuscateMetadataReader::New();
......@@ -130,8 +136,10 @@ BOOST_AUTO_TEST_CASE(MuscateReadWriteL8){
}
BOOST_AUTO_TEST_CASE(MuscateReadWriteVenus){
BOOST_TEST_REQUIRE( framework::master_test_suite().argc == 2 );
std::string TEST_SRC = framework::master_test_suite().argv[1];
if(TEST_SRC == ""){
BOOST_FAIL("Did not set env-var WASP_TEST!");
BOOST_FAIL("Did not set WASP_INPUT_DATA cmake option!");
}
std::cout << std::string(TEST_SRC + "/" + TEST_NAME + "/" EXAMPLE_XML4) << std::endl;
auto reader = MuscateMetadataReader::New();
......