From bd1f811abb8c82158d96efa4ab11ee238ee227d9 Mon Sep 17 00:00:00 2001 From: mpech Date: Wed, 29 Jun 2011 18:02:26 +0200 Subject: [PATCH] renaming clitk_data_path in clitk_test_data_path "factorizing" git repo in CTestConfig --- CTestConfig.cmake | 11 +++++++++++ tests/CMakeLists.txt | 12 +----------- tests/fetch_data_test.sh | 15 ++------------- tests/tools/clitkAffineTransformTest.cxx | 6 +++--- tests/tools/clitkImageInfoTest.cxx | 6 +++--- tests/tools/clitkImageInfoTest_oldWay.cpp | 4 ++-- tests/tools/clitkWriteDicomSeriesTest.cxx | 4 ++-- tests/vv/vvRegisterFormTest.cxx | 2 +- 8 files changed, 25 insertions(+), 35 deletions(-) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 1f71d14..6eb9c86 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -5,3 +5,14 @@ set(CTEST_DROP_METHOD "http") set(CTEST_DROP_SITE "my.cdash.org") set(CTEST_DROP_LOCATION "/submit.php?project=VV") set(CTEST_DROP_SITE_CDASH TRUE) + + +#========================================================= +SET(CLITK_TEST_DATA_PATH ${PROJECT_BINARY_DIR}/tests/data CACHE INTERNAL DOCSTRING) +# Get the data tests +IF(WIN32) + SET(scriptExt bat) +ELSE(UNIX) + SET(scriptExt sh) +ENDIF() +EXEC_PROGRAM(${PROJECT_SOURCE_DIR}/tests/fetch_data_test.${scriptExt} ARGS ${CLITK_TEST_DATA_PATH} http://russule/data/.git) \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 479b144..0ad6b85 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,18 +3,8 @@ cmake_policy(SET CMP0005 NEW) #========================================================= # Data tests path - -OPTION(CLITK_DATA_PATH ${CMAKE_CURRENT_BINARY_DIR}/data) -ADD_DEFINITIONS(-DCLITK_DATA_PATH=\"${CLITK_DATA_PATH}/\") -#========================================================= +ADD_DEFINITIONS(-DCLITK_TEST_DATA_PATH=\"${CLITK_TEST_DATA_PATH}/\") #========================================================= -# Get the data tests -IF(WIN32) - SET(scriptExt bat) -ELSE(UNIX) - SET(scriptExt sh) -ENDIF() -EXEC_PROGRAM(${CMAKE_CURRENT_SOURCE_DIR}/fetch_data_test.${scriptExt} ARGS ${CLITK_DATA_PATH}) #========================================================= # Google test macro macro(ADD_GOOGLE_TESTS executable) diff --git a/tests/fetch_data_test.sh b/tests/fetch_data_test.sh index ce581b6..f516146 100755 --- a/tests/fetch_data_test.sh +++ b/tests/fetch_data_test.sh @@ -2,22 +2,11 @@ # # arg[1] is TESTING_BINARY_DIR # This script has been edited from itk/Modules/ThirdParty/NIFTI/src/nifti/Testing/nifti_regress_test/cmake_testscripts/fetch_data_test.sh -if [ $# -lt 1 ] -then -echo Missing Binary directory name -exit 1 -fi - -repo=http://localhost/data/.git - if cd $1 then -git pull + git pull else -git clone $repo $1 -exit 1 + git clone $2 $1 fi - - exit 0 diff --git a/tests/tools/clitkAffineTransformTest.cxx b/tests/tools/clitkAffineTransformTest.cxx index 82d4df9..2a7fe92 100644 --- a/tests/tools/clitkAffineTransformTest.cxx +++ b/tests/tools/clitkAffineTransformTest.cxx @@ -52,8 +52,8 @@ static inline void compare(std::string mhd, std::string refMhd, std::string refR remove("out.raw"); } TEST(identity, clitkAffineTransformTest){ - std::string mhd1=std::string(CLITK_DATA_PATH)+"Deformation4D.mhd"; - std::string refMhd1=std::string(CLITK_DATA_PATH)+"Deformation4DRef.mhd"; - std::string refRaw1=std::string(CLITK_DATA_PATH)+"Deformation4DRef.raw"; + std::string mhd1=std::string(CLITK_TEST_DATA_PATH)+"Deformation4D.mhd"; + std::string refMhd1=std::string(CLITK_TEST_DATA_PATH)+"Deformation4DRef.mhd"; + std::string refRaw1=std::string(CLITK_TEST_DATA_PATH)+"Deformation4DRef.raw"; compare(mhd1, refMhd1, refRaw1); } \ No newline at end of file diff --git a/tests/tools/clitkImageInfoTest.cxx b/tests/tools/clitkImageInfoTest.cxx index 4f8413c..0b3f303 100644 --- a/tests/tools/clitkImageInfoTest.cxx +++ b/tests/tools/clitkImageInfoTest.cxx @@ -31,14 +31,14 @@ static inline void compare(std::string mhd, std::string ref){ remove("clitkImageInfoTest.out"); } TEST(clitkImageInfoTest, main){ - std::string mhd1=std::string(CLITK_DATA_PATH)+"Deformation4D.mhd"; + std::string mhd1=std::string(CLITK_TEST_DATA_PATH)+"Deformation4D.mhd"; ASSERT_TRUE(itksys::SystemTools::FileExists(mhd1.c_str(), true)); - std::string mhd2=std::string(CLITK_DATA_PATH)+"Lung3D.mhd"; + std::string mhd2=std::string(CLITK_TEST_DATA_PATH)+"Lung3D.mhd"; ASSERT_TRUE(itksys::SystemTools::FileExists(mhd2.c_str(), true)); mhd1+=" "+mhd2; - std::string ref1=std::string(CLITK_DATA_PATH)+"clitkImageInfoTestRef.out"; + std::string ref1=std::string(CLITK_TEST_DATA_PATH)+"clitkImageInfoTestRef.out"; ASSERT_TRUE(itksys::SystemTools::FileExists(ref1.c_str(), true)); compare(mhd1, ref1); } \ No newline at end of file diff --git a/tests/tools/clitkImageInfoTest_oldWay.cpp b/tests/tools/clitkImageInfoTest_oldWay.cpp index fa60e44..634a68c 100644 --- a/tests/tools/clitkImageInfoTest_oldWay.cpp +++ b/tests/tools/clitkImageInfoTest_oldWay.cpp @@ -24,8 +24,8 @@ #include int main(int argc, char** argv){ int fail = 1; - std::string mhd = std::string(CLITK_DATA_PATH); - std::string ref = std::string(CLITK_DATA_PATH); + std::string mhd = std::string(CLITK_TEST_DATA_PATH); + std::string ref = std::string(CLITK_TEST_DATA_PATH); //We select which image we use to test clitkImageInfo int idImg = atoi(argv[1]); diff --git a/tests/tools/clitkWriteDicomSeriesTest.cxx b/tests/tools/clitkWriteDicomSeriesTest.cxx index bc63080..2e0c505 100644 --- a/tests/tools/clitkWriteDicomSeriesTest.cxx +++ b/tests/tools/clitkWriteDicomSeriesTest.cxx @@ -21,8 +21,8 @@ #include TEST(clitkWriteDicomSeriesTest, main){ - std::string fIn=std::string(CLITK_DATA_PATH)+"/3d/mhd/00.mhd"; - std::string fOut=std::string(CLITK_DATA_PATH)+"/3d/dcm/1.2.840.113704.1.111.536.1248695032.26"; + std::string fIn=std::string(CLITK_TEST_DATA_PATH)+"/3d/mhd/00.mhd"; + std::string fOut=std::string(CLITK_TEST_DATA_PATH)+"/3d/dcm/1.2.840.113704.1.111.536.1248695032.26"; ASSERT_TRUE(itksys::SystemTools::FileExists(fIn.c_str(), true)); std::ostringstream cmd_line; cmd_line << TOOLS_PATH <<"clitkWriteDicomSeries -i " << fIn << " -d " << fOut << " -o dcm --verbose"; diff --git a/tests/vv/vvRegisterFormTest.cxx b/tests/vv/vvRegisterFormTest.cxx index 15d88c4..6c623df 100644 --- a/tests/vv/vvRegisterFormTest.cxx +++ b/tests/vv/vvRegisterFormTest.cxx @@ -22,7 +22,7 @@ #include "vvConfiguration.h" #include #include -const std::string data_path = CLITK_DATA_PATH; +const std::string data_path = CLITK_TEST_DATA_PATH; TEST(vvRegisterForm, canPush){ QUrl url; //the file exists with some old lines -- 2.47.1