File: test-docker.sh

package info (click to toggle)
pygobject 3.55.3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 5,728 kB
  • sloc: ansic: 39,419; python: 26,856; sh: 114; makefile: 81; xml: 35; cpp: 1
file content (48 lines) | stat: -rwxr-xr-x 1,411 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash

set -e

python --version

SOURCE_DIR="$(pwd)"
COV_DIR="${SOURCE_DIR}/coverage"
COV_KEY="${CI_JOB_NAME_SLUG}"
JUNIT_XML="${SOURCE_DIR}/test-results.xml"

CFLAGS="-coverage -ftest-coverage -fprofile-arcs -Werror"
MALLOC_CHECK_=3
MALLOC_PERTURB_=$((RANDOM % 255 + 1))
G_SLICE="debug-blocks"
COVERAGE_FILE="${COV_DIR}/.coverage.${COV_KEY}"
CCACHE_BASEDIR="$(pwd)"
CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
export CFLAGS MALLOC_CHECK_ MALLOC_PERTURB_ G_SLICE COVERAGE_FILE \
       CCACHE_BASEDIR CCACHE_DIR

# https://docs.python.org/3/using/cmdline.html#envvar-PYTHONDEVMODE
export PYTHONDEVMODE=1
export MESONPY_EDITABLE_VERBOSE=1

mkdir -p "${CCACHE_DIR}"
mkdir -p "${COV_DIR}"

python -m venv /tmp/venv
# shellcheck disable=SC1091
source /tmp/venv/bin/activate

python -m pip install --upgrade pip
python -m pip install meson meson-python pycairo 'pytest<9' pytest-cov

# BUILD & TEST
python -m pip install --config-settings=setup-args="-Dtests=true" --no-build-isolation --editable .

# TEST
lcov --config-file .gitlab-ci/lcovrc --directory . --capture --initial --output-file \
    "${COV_DIR}/${CI_JOB_NAME_SLUG}-baseline.lcov"

xvfb-run -a python -m pytest -vs --cov --junit-xml="${JUNIT_XML}"
python -m coverage lcov -o "${COV_DIR}/${COV_KEY}.py.lcov"

# COLLECT GCOV COVERAGE
lcov --config-file .gitlab-ci/lcovrc --directory . --capture --output-file \
    "${COV_DIR}/${CI_JOB_NAME_SLUG}.lcov"