Skip to content

Commit

Permalink
chore(linux): Add coverage action to ibus-keyman/build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ermshiperete committed Sep 18, 2023
1 parent ae49013 commit 7798f73
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
16 changes: 16 additions & 0 deletions docs/settings/linux/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,22 @@
"group": "build",
"detail": "run unit and integration tests of ibus-keyman"
},
{
"type": "shell",
"label": "ibus-keyman: report",
"command": "./build.sh",
"args": [
"report",
"--debug",
"--coverage",
"--no-integration"
],
"options": {
"cwd": "${workspaceFolder}/linux/ibus-keyman/",
},
"group": "build",
"detail": "create unit test coverage"
},
{
"type": "shell",
"label": "keyman-config: tests",
Expand Down
26 changes: 23 additions & 3 deletions linux/ibus-keyman/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@ builder_describe \
"test" \
"install install artifacts" \
"uninstall uninstall artifacts" \
"report create coverage report" \
"@/core:arch" \
"--no-integration don't run integration tests"
"--no-integration don't run integration tests" \
"--coverage capture test coverage"

builder_parse "$@"

builder_describe_internal_dependency \
report:engine test:engine

if builder_is_debug_build; then
MESON_TARGET=debug
export CPPFLAGS=-DG_MESSAGES_DEBUG
Expand All @@ -38,7 +43,15 @@ cd "$THIS_SCRIPT_PATH"

builder_describe_outputs \
configure "${MESON_PATH}/build.ninja" \
build "${MESON_PATH}/src/ibus-engine-keyman"
build "${MESON_PATH}/src/ibus-engine-keyman" \
test "${MESON_PATH}/src/ibus-engine-keyman.p/engine.c.gcno" \
report "${MESON_PATH}/meson-logs/coveragereport/index.html"

if builder_has_option --coverage; then
MESON_COVERAGE=-Db_coverage=true
else
MESON_COVERAGE=
fi

if builder_start_action clean; then
rm -rf "$THIS_SCRIPT_PATH/../build/"
Expand All @@ -48,7 +61,7 @@ fi
if builder_start_action configure; then
cd "$THIS_SCRIPT_PATH"
# shellcheck disable=SC2086
meson setup "$MESON_PATH" --werror --buildtype $MESON_TARGET "${builder_extra_params[@]}"
meson setup "$MESON_PATH" --werror --buildtype $MESON_TARGET ${MESON_COVERAGE} "${builder_extra_params[@]}"
builder_finish_action success configure
fi

Expand Down Expand Up @@ -79,3 +92,10 @@ if builder_start_action uninstall; then
ninja uninstall
builder_finish_action success uninstall
fi

if builder_start_action report; then
cd "$THIS_SCRIPT_PATH/$MESON_PATH"
# Note: requires lcov > 1.16 to properly work (see https://github.com/mesonbuild/meson/issues/6747)
ninja coverage-html
builder_finish_action success report
fi

0 comments on commit 7798f73

Please sign in to comment.