Add a gcov tox environment

This commit is contained in:
Anthony Sottile 2017-10-13 08:50:56 -07:00
parent 844e87fcee
commit 486b2c640d
5 changed files with 26 additions and 10 deletions

12
.gitignore vendored
View file

@ -1,9 +1,11 @@
dumb-init
dist/
*.deb
*.egg-info
.tox
build/
__pycache__/
*.gc*
*.o
*.py[cod]
.cache
.tox
__pycache__/
build/
dist/
dumb-init

View file

@ -9,14 +9,12 @@ sed -E \
-i /etc/apt/sources.list
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0x5BB92C09DB82666C
echo 'deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu xenial main' >> /etc/apt/sources.list
echo 'deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main' >> /etc/apt/sources.list
apt-get update
apt-get install -y --no-install-recommends \
git \
python2.6-dev \
python2.7-dev \
python3.5-dev \
python3.6-dev
# We cannot use the Ubuntu versions of tox or virtualenv:

5
ci/gcov-build Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
envbindir="$1"
cc -c dumb-init.c -o dumb-init.o -g --coverage
cc dumb-init.o -o "${envbindir}/dumb-init" -g --coverage

4
ci/gcov-report Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
gcov -f dumb-init.c
grep '#####' dumb-init.c.gcov | cut -d':' -f2 | xargs echo "Missing:"

11
tox.ini
View file

@ -1,12 +1,19 @@
[tox]
envlist = py26,py27,py35,py36
envlist = py27,py36,gcov
[testenv]
deps = -r{toxinidir}/requirements-dev.txt
passenv = HOME SSH_AUTH_SOCK USER
passenv = SSH_AUTH_SOCK
commands =
python -m pytest
[testenv:gcov]
skip_install = True
commands =
{toxinidir}/ci/gcov-build {envbindir}
{[testenv]commands}
{toxinidir}/ci/gcov-report
[testenv:pre-commit]
basepython = /usr/bin/python3.6
commands = pre-commit {posargs:run --all-files}