Setting up basic outomated Coverage cDash client
###############################################

This manual shows how to set up a simple basic cDash client which runs every 
night the tests. This is based on sources and structure of MeteoIO 
(http://slfsmm.indefero.net/p/meteoio/) and a Linux host.

Special about this client is, that he will compile as Build type Debug and that 
information about Code Coverage of the testing will be sent to the cDash Server !


1. Needs
--------
1. 	First need a host, best if it runs 24/24 with internet connection. (no 
	matter if virtual machine, or own hardware)
	
2.	Make sure following things are installed
	- ccmake (version 2.8.0 or greater)
	- subversion
	- valgrind
	- gcc (See important IMPORTANT)
	
3.	You need also that on your cDash server you want to use your project where 
	you show the test results is allready set up and given correct svn 
	connection information. (In this example, the free cDash host server from
	Kitware, http://my.cdash.org/ )
	
4.	Your CDash projet where you want to submit the results needs the group "Coverage"
	Created be the CDash administrator ! [NOT NEDED ENYMORE !!!!]
	

IMPORTANT: Coverage testing only works with GCC as compiler right now with cDash !!!!
	
2. Get files
------------
1. Make direcotry and checkout svn files:
	- mkdir -p ${HOME}/cdash_clients/meteoio
	- cd ${HOME}/cdash_clients/
	- svn co http://slfsmm.indefero.net/svn/slfsmm/meteoio/YOUR_BRANCH_OR_TRUNK meteoio
	
2. Get cDash connection configuration
	- Login in the cDash site -> myCDash
	- [Action] Edit Project which should show the results
	- Miscellanceous -> rigth click on CTestConfig.cmake -> Save Link As
	- Save CTestConfig.cmake directly in the root direcory of your 
	source files (here cdash_clients/meteoio/) or move it 
	there avter download
	
3. 	First Test if connection works:
	- cd ${HOME}/cdash_clients/meteoio/
	- ccmake . [configure and generate with all default]
	- make
	- ctest -D Experimental
	
3. Make CTest Script which is run daily
---------------------------------------
1.	Make a new file "startScriptCoverage.cmake" in the root of the source files 
	(here ${HOME}/cdash_clients/meteoio/)
	
2. But following content in te startScriptCoverage.cmake file:

	# simple Script that makes Nigthly build with cTest and publie it on CDash with coverage informations. 
	# This script need to be started be cron. The command for the cron is :
	# "ctest -S startScriptCoverage.cmake"
	
	# set for the thest source and binary directories
	SET(CTEST_SOURCE_DIRECTORY .)
	SET(CTEST_BINARY_DIRECTORY .)
	
	# set cTest commands to be used
	#SET(CTEST_COMMAND "\"${CTEST_EXECUTABLE_NAME}\" -D Experimental --track Coverage")
	SET(CTEST_COMMAND "\"${CTEST_EXECUTABLE_NAME}\" -D Nightly")
	
	#set cMake command to be used
	SET(CTEST_CMAKE_COMMAND "\"${CMAKE_EXECUTABLE_NAME}\"")
	
	#also possible to set initial cache values for config to set that the test are build
	# BUILD NAME SET HERE DROUG CACHE.. OLD WAY TO OD BUT ONLY WORKING WAY
	SET(CTEST_INITIAL_CACHE "
		BUILD_TESTING:BOOL=ON
		BUILD_TESTING_WITH_COVERAGE:BOOL=ON
		BUILDNAME:STRING=Linux_Coverage_noOptim
	")
	
3.	Test script with command "ctest -S startScriptCoverage.cmake -V"
	
4. set up Cron jop to run test every night at 01:05
---------------------------------------------------
1.	crontab -e
2.	chose your editor ( me 8. bim.basic)
3.	Add follwoing line :
	1 1 * * * cd ${HOME}/cdash_clients/meteoio/ && make clean
	5 1 * * * cd ${HOME}/cdash_clients/meteoio/ && /usr/bin/ctest -S ${HOME}/cdash_clients/meteoio/startScriptCoverage.cmake -V > ${HOME}/cdash_clients/meteoio/startScriptCoverage.log 2>&1
4.	write and quit ( vim command ":wq")
	
If error on test, you have the log in file startScriptCoverage.log


5. Annexes: 
-----------
For more information about CTest scripting: http://www.cmake.org/Wiki/CMake_Scripting_Of_CTest
For more information about CTest coverage : http://cmake.org/Wiki/CTest/Coverage

