Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(linux): Add coverage action to ibus-keyman/build.sh #9583

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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