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): Allow to collect coverage on TC #9790

Merged
merged 2 commits into from
Oct 19, 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
3 changes: 3 additions & 0 deletions docs/linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ sudo apt install -y lcov libdatetime-perl gcovr
pip3 install coverage
```

**Note:** You want lcov > 1.16, so you might have to download and install
a newer version e.g. from <https://packages.ubuntu.com/mantic/lcov>.

#### Creating and displaying code coverage reports

All three projects (ibus-keyman, keyman-config, and keyman-system-service)
Expand Down
2 changes: 1 addition & 1 deletion linux/keyman-config/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ execute_with_temp_schema() {
TEMP_DATA_DIR=$(mktemp -d)
SCHEMA_DIR="${TEMP_DATA_DIR}/glib-2.0/schemas"
export XDG_DATA_DIRS="${TEMP_DATA_DIR}":${XDG_DATA_DIRS-}
export GSETTINGS_SCHEMA_DIR="${SCHEMA_DIR}"
export GSETTINGS_SCHEMA_DIR="${SCHEMA_DIR}:/usr/share/glib-2.0/schemas/:${GSETTINGS_SCHEMA_DIR-}"
mkdir -p "${SCHEMA_DIR}"
cp resources/com.keyman.gschema.xml "${SCHEMA_DIR}"/
glib-compile-schemas "${SCHEMA_DIR}"
Expand Down
9 changes: 6 additions & 3 deletions linux/keyman-config/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ if [ -n "$TEAMCITY_VERSION" ]; then
if ! pip3 list --format=columns | grep -q teamcity-messages; then
pip3 install teamcity-messages
fi
python3 -m teamcity.unittestpy discover -s tests -p test_*.py
test_module=teamcity.unittestpy
else
# shellcheck disable=SC2086
python3 ${coverage:-} -m unittest discover -v -s tests -p test_*.py
test_module=unittest
extra_opts=-v
fi

# shellcheck disable=SC2086
python3 ${coverage:-} -m ${test_module:-} discover ${extra_opts:-} -s tests -p test_*.py

rm -rf "$XDG_CONFIG_HOME"