Skip to content

Commit

Permalink
Merge pull request #9583 from keymanapp/chore/linux/coverage
Browse files Browse the repository at this point in the history
chore(linux): Add coverage action to `ibus-keyman/build.sh`
  • Loading branch information
ermshiperete authored Sep 20, 2023
2 parents ab4f45e + 20149b6 commit 4e8e091
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
17 changes: 17 additions & 0 deletions docs/settings/linux/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,23 @@
"group": "build",
"detail": "run unit and integration tests of ibus-keyman"
},
{
"type": "shell",
"label": "ibus-keyman: report",
"command": "./build.sh",
"args": [
"test",
"--report",
"--debug",
"--coverage",
"--no-integration"
],
"options": {
"cwd": "${workspaceFolder}/linux/ibus-keyman/",
},
"group": "build",
"detail": "run tests and create unit test coverage report"
},
{
"type": "shell",
"label": "keyman-config: tests",
Expand Down
16 changes: 14 additions & 2 deletions linux/ibus-keyman/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ builder_describe \
"install install artifacts" \
"uninstall uninstall artifacts" \
"@/core:arch" \
"--no-integration don't run integration tests"
"--no-integration don't run integration tests" \
"--report create coverage report" \
"--coverage capture test coverage"

builder_parse "$@"

Expand All @@ -40,6 +42,12 @@ builder_describe_outputs \
configure "${MESON_PATH}/build.ninja" \
build "${MESON_PATH}/src/ibus-engine-keyman"

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/"
builder_finish_action success clean
Expand All @@ -48,7 +56,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 All @@ -65,6 +73,10 @@ if builder_start_action test; then
else
meson test --print-errorlogs $builder_verbose
fi
if builder_has_option --coverage; then
# Note: requires lcov > 1.16 to properly work (see https://github.com/mesonbuild/meson/issues/6747)
ninja coverage-html
fi
builder_finish_action success test
fi

Expand Down

0 comments on commit 4e8e091

Please sign in to comment.