diff --git a/.luacov b/.luacov index 5f7f3eb72..f53807d47 100644 --- a/.luacov +++ b/.luacov @@ -2,7 +2,8 @@ -- This variable is set externally local build = os.getenv("BUILD_DIRECTORY") or error("$BUILD_DIRECTORY not set") -local lib_dir = build .. "lib/" +local lib_dir = os.getenv("AWESOME_LIB_DIR") or build .. "lib/" +local source = os.getenv("SOURCE_DIRECTORY") local function escape_pattern(str) return string.gsub(str, "%W", "%%%1") @@ -17,12 +18,16 @@ return { -- For things already having the correct path -- (happens with integration tests) "^lib/", + + -- For the shape-API auto-generated images + source and escape_pattern(source .. "lib/"), }, -- configuration for luacov-coveralls reporter coveralls = { pathcorrect = { { escape_pattern(lib_dir), "lib/"}, + source and { escape_pattern(source .. "lib/"), "lib/" }, }, }, } diff --git a/.travis.yml b/.travis.yml index 3ab3d791e..7c88a0c9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -96,4 +96,4 @@ after_success: # Push updated API docs for relevant branches, e.g. non-PRs builds on master. - if [ "$BUILD_APIDOC" = "true" ]; then build-utils/travis-apidoc.sh; fi # Push code coverage information - - if [ "$DO_COVERAGE" = "true" ]; then BUILD_DIRECTORY="$(pwd)/$(readlink build)/" luacov-coveralls --verbose --merge; fi + - if [ "$DO_COVERAGE" = "true" ]; then BUILD_DIRECTORY="$(pwd)/$(readlink build)/" SOURCE_DIRECTORY="$(pwd)/" luacov-coveralls --verbose --merge; fi diff --git a/docs/generate_examples.cmake b/docs/generate_examples.cmake index 61ec092c3..bb2d0716b 100644 --- a/docs/generate_examples.cmake +++ b/docs/generate_examples.cmake @@ -5,6 +5,9 @@ set(ENV{LUA_PATH} "${SOURCE_DIR}/lib/?;${SOURCE_DIR}/lib/?.lua;${LUA_PATH_}") file(MAKE_DIRECTORY "${BUILD_DIR}/doc/images") +set(ENV{BUILD_DIRECTORY} "${BUILD_DIR}/") +set(ENV{AWESOME_LIB_DIR} "${SOURCE_DIR}/lib/") + # # Shape API # @@ -17,8 +20,7 @@ foreach (SHAPE_NAME "circle" "arrow" "rounded_rect" "hexagon" "infobubble" # Generate some SVG for the documentation and load the examples for the doc execute_process( - COMMAND lua ${SOURCE_DIR}/tests/shape/test-shape.lua ${SHAPE_FILE} ${SHAPE_SVG} - OUTPUT_VARIABLE SHAPE_OUTPUT + COMMAND lua ${SOURCE_DIR}/tests/shape/test-shape.lua ${SHAPE_FILE} ${SHAPE_SVG} ${SOURCE_DIR}/.luacov ERROR_VARIABLE SHAPE_ERROR ) @@ -45,3 +47,5 @@ foreach (SHAPE_NAME "circle" "arrow" "rounded_rect" "hexagon" "infobubble" set(SHAPE_${SHAPE_NAME}_EXAMPLE ${SHAPE_COMMENTED}) endforeach() + +# vim: filetype=cmake:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80:foldmethod=marker diff --git a/tests/shape/test-shape.lua b/tests/shape/test-shape.lua index 6a5484de9..b15cbab06 100644 --- a/tests/shape/test-shape.lua +++ b/tests/shape/test-shape.lua @@ -3,7 +3,12 @@ -- it also "prove" that the code examples are all working local cairo = require( "lgi" ).cairo local shape = require( "gears.shape" ) -local filepath, svgpath = ... +local filepath, svgpath, luacovpath = ... + +-- If luacov is available, use it. Else, do nothing. +pcall(function() + require("luacov.runner")(luacovpath) +end) local function get_surface(p) local img = cairo.SvgSurface.create(p, 288, 76) @@ -29,3 +34,5 @@ local cr = get_surface(svgpath) cr:translate(3,3) loadfile(filepath)(shape, cr, show) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80