celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject celix git commit: CELIX-270: fix code coverage cmake configuration
Date Sat, 10 Oct 2015 18:35:08 GMT
Repository: celix
Updated Branches:
  refs/heads/develop 4fc908f61 -> 7f032d759


CELIX-270: fix code coverage cmake configuration


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/7f032d75
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/7f032d75
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/7f032d75

Branch: refs/heads/develop
Commit: 7f032d759a692815f895ae41191a79da2b33cc84
Parents: 4fc908f
Author: Bjoern Petri <bpetri@apache.org>
Authored: Sat Oct 10 20:34:34 2015 +0200
Committer: Bjoern Petri <bpetri@apache.org>
Committed: Sat Oct 10 20:34:34 2015 +0200

----------------------------------------------------------------------
 .travis.yml                          |  9 ++++--
 cmake/cmake_celix/CodeCoverage.cmake | 48 +++++++++++++++----------------
 2 files changed, 30 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/7f032d75/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 1814464..6d4a57c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,7 +2,8 @@ language: c
 
 before_install:
   - sudo apt-get update -qq
-  - sudo apt-get install -y uuid-dev libjansson-dev libxml2-dev
+  - sudo apt-get install -y uuid-dev libjansson-dev libxml2-dev lcov
+
 
 matrix:
   include:
@@ -17,7 +18,9 @@ before_script:
 
 script: 
     - cd build
-    - cmake -DBUILD_DEPLOYMENT_ADMIN=ON -DBUILD_EXAMPLES=ON -DBUILD_LOG_SERVICE=ON -DBUILD_LOG_WRITER=ON
-DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON
-DBUILD_RSA_DISCOVERY_SHM=ON -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=ON
-DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON -DBUILD_SHELL_TUI=ON
-DBUILD_DEVICE_ACCESS=ON -DBUILD_DEVICE_ACCESS_EXAMPLE=ON -DBUILD_FRAMEWORK_TESTS=ON -DBUILD_UTILS-TESTS=ON
-DCPPUTEST_INCLUDE_DIR=$HOME/cpputest/include -DCPPUTEST_LIBRARY=$HOME/cpputest/lib/libCppUTest.a
-DCPPUTEST_EXT_INCLUDE_DIR=$HOME/cpputest/include -DCPPUTEST_EXT_LIBRARY=$HOME/cpputest/lib/libCppUTestExt.a
-DCMAKE_INSTALL_PREFIX=../install ..
+    - cmake -DBUILD_DEPLOYMENT_ADMIN=ON -DBUILD_EXAMPLES=ON -DBUILD_LOG_SERVICE=ON -DBUILD_LOG_WRITER=ON
-DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_RSA_DISCOVERY_CONFIGURED=ON -DBUILD_RSA_DISCOVERY_ETCD=ON
-DBUILD_RSA_DISCOVERY_SHM=ON -DBUILD_RSA_EXAMPLES=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_SHM=ON
-DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON -DBUILD_REMOTE_SHELL=ON -DBUILD_SHELL=ON -DBUILD_SHELL_TUI=ON
-DBUILD_DEVICE_ACCESS=ON -DBUILD_DEVICE_ACCESS_EXAMPLE=ON -DBUILD_FRAMEWORK_TESTS=OFF -DBUILD_UTILS-TESTS=ON
-DCPPUTEST_INCLUDE_DIR=$HOME/cpputest/include -DCPPUTEST_LIBRARY=$HOME/cpputest/lib/libCppUTest.a
-DCPPUTEST_EXT_INCLUDE_DIR=$HOME/cpputest/include -DCPPUTEST_EXT_LIBRARY=$HOME/cpputest/lib/libCppUTestExt.a
-DENABLE_CODE_COVERAGE=ON -DCMAKE_INSTALL_PREFIX=../install ..
     - make all && make deploy && make install-all
-    - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/utils && ./utils/array_list_test
&& ./utils/celix_threads_test && ./utils/linked_list_test && ./utils/hash_map_test

+    - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/utils:`pwd`/framework && make
test && make coverage
+
+
 

http://git-wip-us.apache.org/repos/asf/celix/blob/7f032d75/cmake/cmake_celix/CodeCoverage.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/CodeCoverage.cmake b/cmake/cmake_celix/CodeCoverage.cmake
index 76b1f39..51b5001 100644
--- a/cmake/cmake_celix/CodeCoverage.cmake
+++ b/cmake/cmake_celix/CodeCoverage.cmake
@@ -1,19 +1,19 @@
 # Boost Software License - Version 1.0 - August 17th, 2003
-# 
+#
 # Permission is hereby granted, free of charge, to any person or organization
 # obtaining a copy of the software and accompanying documentation covered by
 # this license (the "Software") to use, reproduce, display, distribute,
 # execute, and transmit the Software, and to prepare derivative works of the
 # Software, and to permit third-parties to whom the Software is furnished to
 # do so, all subject to the following:
-# 
+#
 # The copyright notices in the Software and this entire statement, including
 # the above license grant, this restriction and the following disclaimer,
 # must be included in all copies of the Software, in whole or in part, and
 # all derivative works of the Software, unless such copies or derivative
 # works are solely in the form of machine-executable object code generated by
 # a source language processor.
-# 
+#
 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 # FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
@@ -30,7 +30,7 @@
 # 1. Copy this file into your cmake modules path
 # 2. Add the following line to your CMakeLists.txt:
 #      INCLUDE(CodeCoverage)
-# 
+#
 # 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target
 #    which runs your test executable and produces a lcov code coverage report.
 #
@@ -55,37 +55,36 @@ IF(ENABLE_CODE_COVERAGE)
     FIND_PROGRAM( LCOV_PATH lcov )
     FIND_PROGRAM( GENHTML_PATH genhtml )
     FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests)
-    
+
     IF(NOT GCOV_PATH)
     	MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
     ENDIF() # NOT GCOV_PATH
-    
+
     #IF(NOT CMAKE_COMPILER_IS_GNUCXX)
     #	MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
     #ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX
-    
+
     IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
       MESSAGE( WARNING "Code coverage results with an optimised (non-Debug) build may be
misleading" )
     ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
-    
+
     # Setup compiler options
     ADD_DEFINITIONS(--coverage)
     set(CMAKE_SHARED_LINKER_FLAGS "--coverage")
     set(CMAKE_EXE_LINKER_FLAGS "--coverage")
-    
+
     IF(NOT TARGET coverage)
         add_custom_target(coverage
     	    COMMAND ${CMAKE_COMMAND} -E make_directory coverage_results
-    	    COMMAND ${GENHTML_PATH} -o coverage_results coverage/*.info.cleaned
-    	    COMMAND ${CMAKE_COMMAND} -E remove_directory coverage
-    	
+          COMMAND ${GENHTML_PATH} -o coverage_results coverage/*/*.info.cleaned
+
     	    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-    	    COMMENT "Generating report.\nOpen ./${_outputname}/index.html in your browser to
view the coverage report."
+          COMMENT "Generating report.\nOpen ./${_outputname}/index.html in your browser to
view the coverage report."
         )
-    
+
         SET_TARGET_PROPERTIES(coverage PROPERTIES COVERAGE_TARGET_ADDED "")
     ENDIF()
-    
+
 ENDIF(ENABLE_CODE_COVERAGE)
 
 # Param _targetname     The name of new the custom make target
@@ -99,28 +98,29 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
     	IF(NOT LCOV_PATH)
     		MESSAGE(FATAL_ERROR "lcov not found! Aborting...")
     	ENDIF() # NOT LCOV_PATH
-    
+
     	IF(NOT GENHTML_PATH)
     		MESSAGE(FATAL_ERROR "genhtml not found! Aborting...")
     	ENDIF() # NOT GENHTML_PATH
-    
+
     	# Setup target
-    	ADD_CUSTOM_TARGET(${_targetname}
-    		
+      ADD_CUSTOM_TARGET(${_targetname}_coverage
+
     		# Cleanup lcov
     		${LCOV_PATH} --directory . --zerocounters
-    		
+
     		# Run tests
     		COMMAND ${_testrunner} ${ARGV3}
-    		
+
     		# Capturing lcov counters and generating report
     		COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/coverage
+    		COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/coverage/${_testrunner}
     		COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info
     		COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'mock/*' 'test/*' '/usr/*' --output-file
${_outputname}.info.cleaned
-    		
+
     		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     		COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters
and generating report."
     	)
-    	ADD_DEPENDENCIES(coverage ${_targetname})
+      ADD_DEPENDENCIES(coverage ${_targetname}_coverage)
     ENDIF(ENABLE_CODE_COVERAGE)
-ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
\ No newline at end of file
+ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE


Mime
View raw message