From 486b2c640dfb51ec58cf20d7c57494aabafa2e28 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Fri, 13 Oct 2017 08:50:56 -0700 Subject: [PATCH] Add a gcov tox environment --- .gitignore | 12 +++++++----- ci/docker-tox | 4 +--- ci/gcov-build | 5 +++++ ci/gcov-report | 4 ++++ tox.ini | 11 +++++++++-- 5 files changed, 26 insertions(+), 10 deletions(-) create mode 100755 ci/gcov-build create mode 100755 ci/gcov-report diff --git a/.gitignore b/.gitignore index e53328e..d746dd6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ -dumb-init -dist/ *.deb *.egg-info -.tox -build/ -__pycache__/ +*.gc* +*.o *.py[cod] .cache +.tox +__pycache__/ +build/ +dist/ +dumb-init diff --git a/ci/docker-tox b/ci/docker-tox index 2a81020..652e56f 100644 --- a/ci/docker-tox +++ b/ci/docker-tox @@ -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: diff --git a/ci/gcov-build b/ci/gcov-build new file mode 100755 index 0000000..0940f22 --- /dev/null +++ b/ci/gcov-build @@ -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 diff --git a/ci/gcov-report b/ci/gcov-report new file mode 100755 index 0000000..d5ef10a --- /dev/null +++ b/ci/gcov-report @@ -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:" diff --git a/tox.ini b/tox.ini index 8af8fa0..af78ff0 100644 --- a/tox.ini +++ b/tox.ini @@ -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}