Skip to content

Commit 4e8e091

Browse files
authored
Merge pull request #9583 from keymanapp/chore/linux/coverage
chore(linux): Add coverage action to `ibus-keyman/build.sh`
2 parents ab4f45e + 20149b6 commit 4e8e091

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

docs/settings/linux/tasks.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,23 @@
166166
"group": "build",
167167
"detail": "run unit and integration tests of ibus-keyman"
168168
},
169+
{
170+
"type": "shell",
171+
"label": "ibus-keyman: report",
172+
"command": "./build.sh",
173+
"args": [
174+
"test",
175+
"--report",
176+
"--debug",
177+
"--coverage",
178+
"--no-integration"
179+
],
180+
"options": {
181+
"cwd": "${workspaceFolder}/linux/ibus-keyman/",
182+
},
183+
"group": "build",
184+
"detail": "run tests and create unit test coverage report"
185+
},
169186
{
170187
"type": "shell",
171188
"label": "keyman-config: tests",

linux/ibus-keyman/build.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ builder_describe \
2020
"install install artifacts" \
2121
"uninstall uninstall artifacts" \
2222
"@/core:arch" \
23-
"--no-integration don't run integration tests"
23+
"--no-integration don't run integration tests" \
24+
"--report create coverage report" \
25+
"--coverage capture test coverage"
2426

2527
builder_parse "$@"
2628

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

45+
if builder_has_option --coverage; then
46+
MESON_COVERAGE=-Db_coverage=true
47+
else
48+
MESON_COVERAGE=
49+
fi
50+
4351
if builder_start_action clean; then
4452
rm -rf "$THIS_SCRIPT_PATH/../build/"
4553
builder_finish_action success clean
@@ -48,7 +56,7 @@ fi
4856
if builder_start_action configure; then
4957
cd "$THIS_SCRIPT_PATH"
5058
# shellcheck disable=SC2086
51-
meson setup "$MESON_PATH" --werror --buildtype $MESON_TARGET "${builder_extra_params[@]}"
59+
meson setup "$MESON_PATH" --werror --buildtype $MESON_TARGET ${MESON_COVERAGE} "${builder_extra_params[@]}"
5260
builder_finish_action success configure
5361
fi
5462

@@ -65,6 +73,10 @@ if builder_start_action test; then
6573
else
6674
meson test --print-errorlogs $builder_verbose
6775
fi
76+
if builder_has_option --coverage; then
77+
# Note: requires lcov > 1.16 to properly work (see https://github.com/mesonbuild/meson/issues/6747)
78+
ninja coverage-html
79+
fi
6880
builder_finish_action success test
6981
fi
7082

0 commit comments

Comments
 (0)