Merge pull request #148 from asottile/gcov

Add a gcov tox environment
This commit is contained in:
Chris Kuehl 2017-10-13 10:22:44 -07:00 committed by GitHub
commit 730933f911
5 changed files with 26 additions and 10 deletions

12
.gitignore vendored
View file

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

View file

@ -9,14 +9,12 @@ sed -E \
-i /etc/apt/sources.list -i /etc/apt/sources.list
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0x5BB92C09DB82666C 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 update
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
git \ git \
python2.6-dev \
python2.7-dev \ python2.7-dev \
python3.5-dev \
python3.6-dev python3.6-dev
# We cannot use the Ubuntu versions of tox or virtualenv: # 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] [tox]
envlist = py26,py27,py35,py36 envlist = py27,py36,gcov
[testenv] [testenv]
deps = -r{toxinidir}/requirements-dev.txt deps = -r{toxinidir}/requirements-dev.txt
passenv = HOME SSH_AUTH_SOCK USER passenv = SSH_AUTH_SOCK
commands = commands =
python -m pytest python -m pytest
[testenv:gcov]
skip_install = True
commands =
{toxinidir}/ci/gcov-build {envbindir}
{[testenv]commands}
{toxinidir}/ci/gcov-report
[testenv:pre-commit] [testenv:pre-commit]
basepython = /usr/bin/python3.6 basepython = /usr/bin/python3.6
commands = pre-commit {posargs:run --all-files} commands = pre-commit {posargs:run --all-files}