+++ /dev/null
-# This file is configured by CMake automatically as DartConfiguration.tcl
-# If you choose not to use CMake, this file may be hand configured, by
-# filling in the required variables.
-
-
-# Configuration directories and files
-SourceDirectory: /home/mpech/workspace/vvSource
-BuildDirectory: /home/mpech/workspace/vvSource
-
-# Where to place the cost data store
-CostDataFile:
-
-# Site is something like machine.domain, i.e. pragmatic.crd
-Site: russule
-
-# Build name is osname-revision-compiler, i.e. Linux-2.4.2-2smp-c++
-BuildName: Linux-c++
-
-# Submission information
-IsCDash: TRUE
-CDashVersion:
-QueryCDashVersion:
-DropSite: localhost
-DropLocation: /cdash/submit.php?project=vv
-DropSiteUser:
-DropSitePassword:
-DropSiteMode:
-DropMethod: http
-TriggerSite:
-ScpCommand: /usr/bin/scp
-
-# Dashboard start time
-NightlyStartTime: 00:00:00 EST
-
-# Commands for the build/test/submit cycle
-ConfigureCommand: "/usr/bin/cmake" "/home/mpech/workspace/vvSource"
-MakeCommand: /usr/bin/gmake -i
-DefaultCTestConfigurationType: Release
-
-# CVS options
-# Default is "-d -P -A"
-CVSCommand: /usr/bin/cvs
-CVSUpdateOptions: -d -A -P
-
-# Subversion options
-SVNCommand: /usr/bin/svn
-SVNUpdateOptions:
-
-# Git options
-GITCommand: /usr/bin/git
-GITUpdateOptions:
-GITUpdateCustom:
-
-# Generic update command
-UpdateCommand: /usr/bin/git
-UpdateOptions:
-UpdateType: git
-
-# Compiler info
-Compiler: /usr/bin/c++
-
-# Dynamic analysis and coverage
-PurifyCommand:
-ValgrindCommand:
-ValgrindCommandOptions:
-MemoryCheckCommand: MEMORYCHECK_COMMAND-NOTFOUND
-MemoryCheckCommandOptions:
-MemoryCheckSuppressionFile:
-CoverageCommand: /usr/bin/gcov
-
-# Cluster commands
-SlurmBatchCommand: SLURM_SBATCH_COMMAND-NOTFOUND
-SlurmRunCommand: SLURM_SRUN_COMMAND-NOTFOUND
-
-# Testing options
-# TimeOut is the amount of time in seconds to wait for processes
-# to complete during testing. After TimeOut seconds, the
-# process will be summarily terminated.
-# Currently set to 25 minutes
-TimeOut: 1500
-
-UseLaunchers:
-CurlOptions:
-# warning, if you add new options here that have to do with submit,
-# you have to update cmCTestSubmitCommand.cxx
-
-# For CTest submissions that timeout, these options
-# specify behavior for retrying the submission
-CTestSubmitRetryDelay: 5
-CTestSubmitRetryCount: 3
${GTEST_DIR}/include
)
-FILE(GLOB srcs *.cxx)
-ADD_EXECUTABLE(toolsTest ${srcs})
+SET (CUSTOM_TEST_SRC
+ clitkImageInfoTest.cxx
+ vvMainTest.cxx
+)
+ADD_EXECUTABLE(toolsTest ${CUSTOM_TEST_SRC})
ADD_DEFINITIONS(-DTOOLS_PATH=\"${PROJECT_BINARY_DIR}/bin/\")
-target_link_libraries(toolsTest vvLib ${vvExternalLibs} gtest)
+TARGET_LINK_LIBRARIES(toolsTest vvLib ${vvExternalLibs} gtest)
# Add all tests found in the source code, calling the executable to run them
add_google_tests ( ${EXECUTABLE_OUTPUT_PATH}/toolsTest ${srcs})
SET(BUILDNAME ${BUILDNAME}_tools CACHE INTERNAL DOCSTRING)
-ADD_EXECUTABLE(clitkImageInfoTest_oldWay clitkImageInfoTest_oldWay.cpp)
-target_link_libraries(clitkImageInfoTest_oldWay vvLib ${vvExternalLibs})
-ADD_TEST(clitkImageInfoTest_oldWay ${EXECUTABLE_OUTPUT_PATH}/clitkImageInfoTest_oldWay firstOne)
-ADD_TEST(clitkImageInfoTest_oldWay ${EXECUTABLE_OUTPUT_PATH}/clitkImageInfoTest_oldWay secondOne)
\ No newline at end of file
+SET (srcs
+ toolTestRunner.cxx
+)
+ADD_EXECUTABLE(toolTestRunner ${srcs})
+TARGET_LINK_LIBRARIES(toolTestRunner vvLib ${vvExternalLibs})
+SET(exe ${EXECUTABLE_OUTPUT_PATH}/toolTestRunner)
+#=========================================================
+# clitkImageInfo
+ADD_TEST(clitkImageInfo_1 ${exe} clitkImageInfo Deformation4D.mhd Deformation4D_ref.info)
+ADD_TEST(clitkImageInfo_2 ${exe} clitkImageInfo Lung3D.mhd Lung3D_ref.info)
+#=========================================================
+# clitkGetSpacing
+ADD_TEST(clitkGetSpacing_1 ${exe} clitkGetSpacing Deformation4D.mhd Cropped_Deformation4D_ref.spacing)
+ADD_TEST(clitkGetSpacing_2 ${exe} clitkGetSpacing Lung3D.mhd Cropped_Deformation4D_ref.spacing)
+UNSET(exe)
\ No newline at end of file
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://www.centreleonberard.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================*/
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <fstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <itksys/SystemTools.hxx>
+const int NO_OUTPUT_OPTION=-1;
+int getOutputOptionIndex(int argc, char** argv){
+ for(int i=1; i<argc; i++){
+ std::string s = argv[i];
+ if(s=="-o"){
+ return i+1;
+ }
+ }
+ return NO_OUTPUT_OPTION;
+}
+char* getTmpFileName(){
+ char buffer [L_tmpnam];
+ char * pointer;
+
+ char* back = tmpnam (buffer);
+ if(back==NULL){
+ std::cout<<"fail to get temporary file name"<<std::endl;
+ exit(1);
+ }
+ return pointer;
+}
+//todo, check if files exist
+/**
+ * argv
+ * [1] executable
+ * [2] random options
+ * [2.x] -o
+ * [2.x+1] outFileName
+ * [3] reference file
+ *
+ * [2.x] and [2.x+1] are optional
+ */
+int main(int argc, char** argv){
+ std::ostringstream cmd_line;
+ for(int i=1; i<argc; i++){
+ cmd_line<<argv[i]<<" ";
+ }
+ int outputOptionIndex = getOutputOptionIndex(argc, argv);
+ char* outFile;
+ if(NO_OUTPUT_OPTION==outputOptionIndex){
+ outFile = getTmpFileName();
+ cmd_line<<" "<<outFile;
+ }else{
+ outFile = argv[outputOptionIndex];
+ }
+
+ std::cout<<"running "<<cmd_line.str()<<std::endl;
+ system(cmd_line.str().c_str());
+ //files should be equal, so if this is the case return success=0
+ char* refFile = argv[argc-1];
+ std::cout<<"comapring "<<outFile<<" to "<<refFile<<std::endl;
+ bool fail = (itksys::SystemTools::FilesDiffer(outFile, refFile))?0:1;
+ remove(outFile);
+ return fail;
+}