mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-16 07:47:22 +01:00
tests: Fix coverage data
As the documentation generation insert increasingly large ammount of code into the lua files, the coverage data is getting less and less accurate. This try to fix this by only collecting such data after the `configure_file` calls are done.
This commit is contained in:
parent
f9c9e11d11
commit
ac7ea4c70f
3 changed files with 18 additions and 3 deletions
|
@ -84,14 +84,14 @@ install:
|
|||
- travis_retry sudo luarocks install lua-discount
|
||||
|
||||
# Instal luacov-coveralls for code coverage testing.
|
||||
- if [ "$DO_COVERAGE" = "true" ]; then sudo luarocks install luacov-coveralls; fi
|
||||
- if [ "$DO_COVERAGE" = "true" ]; then sudo luarocks install luacov-coveralls; else export DO_COVERAGE=0; fi
|
||||
|
||||
# Determine custom version.
|
||||
- export AWESOME_VERSION="${TRAVIS_BRANCH}-g$(git rev-parse --short HEAD)"
|
||||
- 'if [ "$TRAVIS_PULL_REQUEST" != false ]; then AWESOME_VERSION="${AWESOME_VERSION}-PR${TRAVIS_PULL_REQUEST}"; fi'
|
||||
|
||||
script:
|
||||
- export CMAKE_ARGS="-DLUA_LIBRARY=${LUALIBRARY} -DLUA_INCLUDE_DIR=${LUAINCLUDE} -D OVERRIDE_VERSION=$AWESOME_VERSION"
|
||||
- export CMAKE_ARGS="-DLUA_LIBRARY=${LUALIBRARY} -DLUA_INCLUDE_DIR=${LUAINCLUDE} -D OVERRIDE_VERSION=$AWESOME_VERSION -D DO_COVERAGE=${DO_COVERAGE}"
|
||||
- |
|
||||
if [ -n "$BUILD_IN_DIR" ]; then
|
||||
SOURCE_DIRECTORY="$PWD"
|
||||
|
|
|
@ -346,4 +346,14 @@ foreach(file ${AWESOME_ADDITIONAL_FILES})
|
|||
endforeach()
|
||||
#}}}
|
||||
|
||||
# The examples coverage need to be done again after the configure_file has
|
||||
# inserted the additional code. Otherwise, the result will be off, rendering
|
||||
# the coverage useless as a tool to track untested code.
|
||||
if(GENERATE_DOC AND DO_COVERAGE)
|
||||
message(STATUS "Running tests again with coverage")
|
||||
set(USE_LCOV 1)
|
||||
|
||||
include(tests/examples/CMakeLists.txt)
|
||||
endif()
|
||||
|
||||
# vim: filetype=cmake:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80:foldmethod=marker
|
||||
|
|
|
@ -144,11 +144,16 @@ function(run_test test_path namespace template escaped_content)
|
|||
get_filename_component(${test_path} TEST_FILE_NAME NAME)
|
||||
set(IMAGE_PATH "${IMAGE_DIR}/AUTOGEN${namespace}_${TEST_FILE_NAME}")
|
||||
|
||||
# Use the example testing as coverage source
|
||||
if (USE_LCOV)
|
||||
set(LCOV_PATH ${SOURCE_DIR}/.luacov)
|
||||
endif()
|
||||
|
||||
# Execute the script, leave the image extension decision to the test
|
||||
# SVG is preferred, but PNG is better suited for some tests, like bitmap
|
||||
# patterns.
|
||||
execute_process(
|
||||
COMMAND lua ${template} ${test_path} ${IMAGE_PATH} ${SOURCE_DIR}/.luacov
|
||||
COMMAND lua ${template} ${test_path} ${IMAGE_PATH} ${LCOV_PATH}
|
||||
OUTPUT_VARIABLE TEST_OUTPUT
|
||||
ERROR_VARIABLE TEST_ERROR
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue