From 3b0f255e96f0f6cd246bd69c7dcc31443bc75bbb Mon Sep 17 00:00:00 2001 From: malaterre Date: Sun, 25 Apr 2004 18:31:48 +0000 Subject: [PATCH] ENH: Adding automatic testing 1. Need a DartConfig.cmake to submit to public 2. Add a test driver gdcmTest.cxx 3. gdcmTestMain, an helper for the main test driver gdcmTest 4. Files in Test don't have a main anymore, this becomes intersting when we add more and more tests, thus dsw don't have to load too many projects --- CMakeLists.txt | 12 +++++++++++- DartConfig.cmake | 37 ++++++++++++++++++++++++++++++++++++ Testing/CMakeLists.txt | 16 ++++++++++++++-- Testing/TestBug.cxx | 2 +- Testing/TestChangeHeader.cxx | 2 +- Testing/TestDicomDir.cxx | 7 +++---- Testing/TestHash.cxx | 2 +- src/gdcmParser.cxx | 8 ++++---- 8 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 DartConfig.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 4433fd5f..4cb746f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,16 @@ SUBDIRS( Test ) +#----------------------------------------------------------------------------- +# Add the testing directories +OPTION(GDCM_BUILD_TESTING "Test the project" ON) +IF(GDCM_BUILD_TESTING) + ENABLE_TESTING() + INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake) + SUBDIRS(Test) +ENDIF(GDCM_BUILD_TESTING) + + #----------------------------------------------------------------------------- OPTION(GDCM_VTK "Build VTK-GDCM Lib." OFF) IF(GDCM_VTK) @@ -116,7 +126,7 @@ EXPORT_LIBRARY_DEPENDENCIES( ${GDCM_BINARY_DIR}/gdcmLibraryDepends.cmake ) -# Intall the âckaging files for use by FIND_PACKAGE(GDCM) in user projects. +# Intall the packaging files for use by FIND_PACKAGE(GDCM) in user projects. INSTALL_FILES(/lin/gdcm FILES ${GDCM_SOURCE_DIR}/gdcmUse.cmake ${GDCM_BINARY_DIR}/gdcmConfig.cmake diff --git a/DartConfig.cmake b/DartConfig.cmake new file mode 100644 index 00000000..b8cd6865 --- /dev/null +++ b/DartConfig.cmake @@ -0,0 +1,37 @@ +# Dashboard is opened for submissions for a 24 hour period starting at +# the specified NIGHLY_START_TIME. Time is specified in 24 hour format. +SET (NIGHTLY_START_TIME "1:00:00 EDT") + +# Dart server to submit results (used by client) +SET (DROP_SITE "public.kitware.com") +SET (DROP_LOCATION "/incoming") +SET (DROP_SITE_USER "ftpuser") +SET (DROP_SITE_PASSWORD "public") +SET (DROP_METHOD "ftp") +SET (TRIGGER_SITE + "http://${DROP_SITE}/cgi-bin/Submit-Public-TestingResults.pl") + +# Project Home Page +SET (PROJECT_URL "http://www.creatis.insa-lyon.fr/Public/Gdcm") + +# Dart server configuration +SET (ROLLUP_URL "http://${DROP_SITE}/cgi-bin/Public-rollup-dashboard.sh") +SET (CVS_WEB_URL "http://${DROP_SITE}/cgi-bin/cvsweb.cgi/Public/") +SET (CVS_WEB_CVSROOT "Public") + +OPTION(BUILD_DOXYGEN "Build source documentation using doxygen" "Off") +SET (DOXYGEN_CONFIG "${PROJECT_BINARY_DIR}/doxygen.config" ) +SET (USE_DOXYGEN "On") +SET (DOXYGEN_URL "http://${DROP_SITE}/Public/Doxygen/html/" ) + +SET (USE_GNATS "On") +SET (GNATS_WEB_URL "http://${DROP_SITE}/Bug/index.php") + +# Continuous email delivery variables +SET (CONTINUOUS_FROM "luis.ibanez@kitware.com") +SET (SMTP_MAILHOST "public.kitware.com") +SET (CONTINUOUS_MONITOR_LIST "luis.ibanez@kitware.com") +SET (CONTINUOUS_BASE_URL "http://www.kitware.com/Testing") + +MARK_AS_ADVANCED(BUILD_DOXYGEN) + diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index aff9d67a..0b27899a 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -2,6 +2,10 @@ # http://www.cmake.org/pipermail/cmake/2001-November/002491.html # So that dll is copied to each subdir where needed +SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH}) + +SET(GDCM_TESTS ${CXX_TEST_PATH}/gdcmTests) + INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) CHECK_INCLUDE_FILE("stdint.h" CMAKE_HAVE_STDINT_H) @@ -18,6 +22,9 @@ SET(TEST_SOURCES bug1.cxx pourFindTaggs.cxx dcm2acr.cxx + PrintDicomDir.cxx + makeDicomDir.cxx + testDicomDir.cxx ) # include stuff @@ -35,6 +42,11 @@ FOREACH(file ${TEST_SOURCES}) ) ENDIF(GDCM_TEST_COMPILE_FLAGS) GET_FILENAME_COMPONENT(name ${file} NAME_WE) - ADD_EXECUTABLE(${name} ${file}) - TARGET_LINK_LIBRARIES(${name} gdcm) + ADD_TEST(${name} ${GDCM_TESTS} ${name}) ENDFOREACH(file ${TEST_SOURCES}) + + +ADD_EXECUTABLE(gdcmTests gdcmTests.cxx ${TEST_SOURCES}) +TARGET_LINK_LIBRARIES(gdcmTests gdcm) + + diff --git a/Testing/TestBug.cxx b/Testing/TestBug.cxx index 51383677..c63e0091 100644 --- a/Testing/TestBug.cxx +++ b/Testing/TestBug.cxx @@ -1,7 +1,7 @@ // The following crashes on Win32 #include "gdcm.h" -int main(int argc, char* argv[]) +int bug1(int argc, char* argv[]) { gdcmHeader* e1; diff --git a/Testing/TestChangeHeader.cxx b/Testing/TestChangeHeader.cxx index 3f2d5b81..d33fc1f2 100644 --- a/Testing/TestChangeHeader.cxx +++ b/Testing/TestChangeHeader.cxx @@ -9,7 +9,7 @@ // et des pixels d'une autre image -int main(int argc, char* argv[]) { +int testChangeEntete(int argc, char* argv[]) { std::string premier, deuxieme; char resultat[200]; diff --git a/Testing/TestDicomDir.cxx b/Testing/TestDicomDir.cxx index e47753c9..9b6855b7 100644 --- a/Testing/TestDicomDir.cxx +++ b/Testing/TestDicomDir.cxx @@ -16,9 +16,8 @@ #define ostringstream ostrstream //extern "C" -using namespace std; -int main(int argc, char* argv[]) +int testDicomDir(int argc, char* argv[]) { gdcmDicomDir *e1; ListTag::iterator deb , fin; @@ -80,7 +79,7 @@ int main(int argc, char* argv[]) } */ - cout << std::endl << std::endl + std::cout << std::endl << std::endl << " = Liste des PATIENT/STUDY/SERIE ==========================================" << std::endl<< std::endl; @@ -136,7 +135,7 @@ int main(int argc, char* argv[]) } */ - cout << std::endl << std::endl + std::cout << std::endl << std::endl << " = Contenu Complet du DICOMDIR ==========================================" << std::endl<< std::endl; e1->Print(); diff --git a/Testing/TestHash.cxx b/Testing/TestHash.cxx index 19112e09..f0af57bb 100644 --- a/Testing/TestHash.cxx +++ b/Testing/TestHash.cxx @@ -3,7 +3,7 @@ #include #include -int main() { +int hashtest( int, char * [] ) { typedef std::map dict; diff --git a/src/gdcmParser.cxx b/src/gdcmParser.cxx index 0ec0e22f..14ed1564 100644 --- a/src/gdcmParser.cxx +++ b/src/gdcmParser.cxx @@ -187,9 +187,9 @@ void gdcmParser::PrintEntryNiceSQ(std::ostream & os) { std::cout << "Kaie ! Kaie! SQ stack overflow" << std::endl; return; } - if (DEBUG) cout << "\n >>>>> empile niveau " << top + if (DEBUG) std::cout << "\n >>>>> empile niveau " << top << "; Lgr SeQ: " << (*i)->GetReadLength() - << "\n" <GetReadLength(); pile[top].alreadyParsedlength = 0; @@ -221,11 +221,11 @@ void gdcmParser::PrintEntryNiceSQ(std::ostream & os) { << std::endl; } else { if (DEBUG) - cout << "alrdyPseLgt:" + std::cout << "alrdyPseLgt:" << pile[top].alreadyParsedlength << " totSeQlgt: " << pile[top].totalSQlength << " curPseLgt: " << currentParsedlength - << endl; + << std::endl; while (pile[top].alreadyParsedlength==pile[top].totalSQlength) { if (DEBUG) -- 2.45.1