diff options
author | Renato Araujo Oliveira Filho <renato.filho@canonical.com> | 2012-11-08 17:38:23 +0000 |
---|---|---|
committer | Tarmac <> | 2012-11-08 17:38:23 +0000 |
commit | 1915b094437bc94aa4ea44e4ccf489456f375e06 (patch) | |
tree | 904b3c37a881caefe78ccfaca6d1dd28d782fce6 | |
parent | fc58dd68e0f40fe4fdb93a49333d7f56fea44b30 (diff) | |
parent | 67680f3a61e0e64bf46a63eb4ce7ce3091f1335a (diff) | |
download | qmenumodel-1915b094437bc94aa4ea44e4ccf489456f375e06.tar.gz qmenumodel-1915b094437bc94aa4ea44e4ccf489456f375e06.tar.bz2 qmenumodel-1915b094437bc94aa4ea44e4ccf489456f375e06.zip |
Updates to get coverage and test results in jenkins.
Approved by Sergio Schvezov.
-rw-r--r-- | .bzrignore | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | tests/client/CMakeLists.txt | 2 |
4 files changed, 12 insertions, 10 deletions
@@ -22,6 +22,7 @@ tests/client/modeltest tests/client/qmlfiles.h tests/client/qmltest tests/client/servicetest +tests/client/test_*.xml tests/script/__pycache__/ doc/html/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cd501b..7f60630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,16 +16,16 @@ add_definitions(-DQT_NO_KEYWORDS) find_program(DBUS_RUNNER dbus-test-runner) # Cooverage tools -OPTION(BUILD_WITH_COVERAGE "Build with coverage analysis support" OFF) -if(BUILD_WITH_COVERAGE) +OPTION(ENABLE_COVERAGE "Build with coverage analysis support" OFF) +if(ENABLE_COVERAGE) message(STATUS "Using coverage flags") find_program(COVERAGE_COMMAND gcov) if(NOT COVERAGE_COMMAND) message(FATAL_ERROR "gcov command not found") endif() - SET(CMAKE_C_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage") - SET(CMAKE_CXX_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage") - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov") + SET(CMAKE_C_FLAGS "-g -O0 -Wall --coverage") + SET(CMAKE_CXX_FLAGS "-g -O0 -Wall --coverage") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") include(${CMAKE_SOURCE_DIR}/cmake/lcov.cmake) endif() @@ -35,11 +35,12 @@ add_subdirectory(libqmenumodel) if(NOT DBUS_RUNNER) message(STATUS "dbus-test-runner not found tests disabled.") else() + # We need to enable test to create the 'make check' target mandatory on jenkins + enable_testing() if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") message(STATUS "Current version of qemu crashes during the tests. We will skip it for now.") else() - message(STATUS "Enable tests for: ${CMAKE_SYSTEM_PROCESSOR}") - enable_testing() + message(STATUS "Tests enabled for arch: ${CMAKE_SYSTEM_PROCESSOR}") add_subdirectory(tests) endif() endif() @@ -26,10 +26,10 @@ installed, install it and then re-run cmake. Then run either of these commands: = Getting code coverage information = To run the unit tests and generate code coverage information, you need to re-run -cmake with BUILD_WITH_COVERAGE set to ON and then invoke `make lcov`. +cmake with ENABLE_COVERAGE set to ON and then invoke `make lcov`. This requires lcov to be installed. - $ cmake -DBUILD_WITH_COVERAGE=ON . + $ cmake -DENABLE_COVERAGE=ON . $ make lcov This will generate a report (coverage/index.html) which you can view in a diff --git a/tests/client/CMakeLists.txt b/tests/client/CMakeLists.txt index 725289e..d946fad 100644 --- a/tests/client/CMakeLists.txt +++ b/tests/client/CMakeLists.txt @@ -10,7 +10,7 @@ macro(declare_test testname) add_test(${testname}
${DBUS_RUNNER}
- --task ${CMAKE_CURRENT_BINARY_DIR}/${testname} --task-name Client
+ --task ${CMAKE_CURRENT_BINARY_DIR}/${testname} -p -xunitxml -p -o -p test_${testname}.xml --task-name Client
--task ${CMAKE_CURRENT_SOURCE_DIR}/script_${testname}.py --task-name Server
--ignore-return)
set_tests_properties(${testname} PROPERTIES
|