Skip to content

Commit a870b9a

Browse files
committed
chore(linux): Add coverage action to ibus-keyman/build.sh
1 parent ae49013 commit a870b9a

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-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": "create unit test coverage"
185+
},
169186
{
170187
"type": "shell",
171188
"label": "keyman-config: tests",

linux/ibus-keyman/build.sh

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

2527
builder_parse "$@"
2628

29+
builder_describe_internal_dependency \
30+
report:engine test:engine
31+
2732
if builder_is_debug_build; then
2833
MESON_TARGET=debug
2934
export CPPFLAGS=-DG_MESSAGES_DEBUG
@@ -40,6 +45,12 @@ builder_describe_outputs \
4045
configure "${MESON_PATH}/build.ninja" \
4146
build "${MESON_PATH}/src/ibus-engine-keyman"
4247

48+
if builder_has_option --coverage; then
49+
MESON_COVERAGE=-Db_coverage=true
50+
else
51+
MESON_COVERAGE=
52+
fi
53+
4354
if builder_start_action clean; then
4455
rm -rf "$THIS_SCRIPT_PATH/../build/"
4556
builder_finish_action success clean
@@ -48,7 +59,7 @@ fi
4859
if builder_start_action configure; then
4960
cd "$THIS_SCRIPT_PATH"
5061
# shellcheck disable=SC2086
51-
meson setup "$MESON_PATH" --werror --buildtype $MESON_TARGET "${builder_extra_params[@]}"
62+
meson setup "$MESON_PATH" --werror --buildtype $MESON_TARGET ${MESON_COVERAGE} "${builder_extra_params[@]}"
5263
builder_finish_action success configure
5364
fi
5465

@@ -79,3 +90,10 @@ if builder_start_action uninstall; then
7990
ninja uninstall
8091
builder_finish_action success uninstall
8192
fi
93+
94+
if builder_start_action report; then
95+
cd "$THIS_SCRIPT_PATH/$MESON_PATH"
96+
# Note: requires lcov > 1.16 to properly work (see https://github.com/mesonbuild/meson/issues/6747)
97+
ninja coverage-html
98+
builder_finish_action success report
99+
fi

0 commit comments

Comments
 (0)