commit
7825fda346
5 changed files with 24 additions and 21 deletions
|
@ -2,22 +2,17 @@
|
|||
sha: 003e43251aea1da33f2072f2365ec8b9ceaae070
|
||||
hooks:
|
||||
- id: autopep8-wrapper
|
||||
language_version: python2.7
|
||||
- id: check-added-large-files
|
||||
- id: check-docstring-first
|
||||
language_version: python2.7
|
||||
- id: check-json
|
||||
- id: check-merge-conflict
|
||||
- id: check-xml
|
||||
- id: check-yaml
|
||||
- id: debug-statements
|
||||
language_version: python2.7
|
||||
- id: detect-private-key
|
||||
- id: double-quote-string-fixer
|
||||
language_version: python2.7
|
||||
- id: end-of-file-fixer
|
||||
- id: flake8
|
||||
language_version: python2.7
|
||||
- id: name-tests-test
|
||||
exclude: ^tests/lib
|
||||
- id: requirements-txt-fixer
|
||||
|
@ -26,7 +21,6 @@
|
|||
sha: 3d86483455ab5bd06cc1069fdd5ac57be5463f10
|
||||
hooks:
|
||||
- id: reorder-python-imports
|
||||
language_version: python2.7
|
||||
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
|
||||
sha: 181a63c511691da58116fa19a7241956018660bc
|
||||
hooks:
|
||||
|
|
|
@ -21,6 +21,7 @@ TARGETS = [
|
|||
'itest_wheezy',
|
||||
'itest_jessie',
|
||||
'itest_stretch',
|
||||
'itest_tox',
|
||||
]
|
||||
|
||||
|
||||
|
|
22
Makefile
22
Makefile
|
@ -2,11 +2,12 @@ CFLAGS=-std=gnu99 -static -Wall -Werror -O3
|
|||
|
||||
TEST_PACKAGE_DEPS := python python-pip
|
||||
|
||||
DOCKER_RUN_TEST := docker run -v $(PWD):/mnt:ro
|
||||
DOCKER_RUN_TEST := docker run -ti -v $(PWD):/mnt:ro
|
||||
|
||||
# test installation using Debian packages
|
||||
DOCKER_DEB_TEST := sh -euxc ' \
|
||||
apt-get update \
|
||||
&& apt-get install -y --no-install-recommends $(TEST_PACKAGE_DEPS) \
|
||||
&& (which timeout || apt-get install -y --no-install-recommends timeout) \
|
||||
&& dpkg -i /mnt/dist/*.deb \
|
||||
&& tmp=$$(mktemp -d) \
|
||||
&& cp -r /mnt/* "$$tmp" \
|
||||
|
@ -15,10 +16,11 @@ DOCKER_DEB_TEST := sh -euxc ' \
|
|||
&& py.test tests/ \
|
||||
&& exec dumb-init /mnt/tests/test-zombies \
|
||||
'
|
||||
|
||||
# test installation using `pip install`
|
||||
DOCKER_PYTHON_TEST := sh -uexc ' \
|
||||
apt-get update \
|
||||
&& apt-get install -y --no-install-recommends python-pip build-essential $(TEST_PACKAGE_DEPS) \
|
||||
&& (which timeout || apt-get install -y --no-install-recommends timeout) \
|
||||
&& tmp=$$(mktemp -d) \
|
||||
&& cp -r /mnt/* "$$tmp" \
|
||||
&& cd "$$tmp" \
|
||||
|
@ -30,6 +32,17 @@ DOCKER_PYTHON_TEST := sh -uexc ' \
|
|||
&& exec dumb-init /mnt/tests/test-zombies \
|
||||
'
|
||||
|
||||
# test several Python versions using tox
|
||||
DOCKER_TOX_TEST := sh -uexc ' \
|
||||
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0x5BB92C09DB82666C \
|
||||
&& echo "deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main" >> /etc/apt/sources.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends python2.6 python2.7 python3.4 python-tox build-essential git $(TEST_PACKAGE_DEPS) \
|
||||
&& tmp=$$(mktemp -du) \
|
||||
&& cp -r /mnt "$$tmp" \
|
||||
&& cd "$$tmp" \
|
||||
&& tox \
|
||||
'
|
||||
.PHONY: build
|
||||
build:
|
||||
$(CC) $(CFLAGS) -o dumb-init dumb-init.c
|
||||
|
@ -74,6 +87,9 @@ itest_wheezy: _itest-debian-wheezy
|
|||
itest_jessie: _itest-debian-jessie
|
||||
itest_stretch: _itest-debian-stretch
|
||||
|
||||
itest_tox:
|
||||
$(DOCKER_RUN_TEST) ubuntu:trusty $(DOCKER_TOX_TEST)
|
||||
|
||||
_itest-%: _itest_deb-% _itest_python-%
|
||||
@true
|
||||
|
||||
|
|
|
@ -12,15 +12,6 @@ def ttyflags(fd):
|
|||
T.tcsetattr(fd, T.TCSANOW, attrs)
|
||||
|
||||
|
||||
def tac():
|
||||
"""
|
||||
run tac. if it fails to complete in 1 second send SIGKILL and exit with an
|
||||
error.
|
||||
"""
|
||||
from os import execvp
|
||||
execvp('timeout', ('timeout', '1', 'dumb-init', 'tac'))
|
||||
|
||||
|
||||
def readall(fd):
|
||||
"""read until EOF"""
|
||||
from os import read
|
||||
|
@ -58,6 +49,7 @@ def test_tty(debug_disabled):
|
|||
import pty
|
||||
pid, fd = pty.fork()
|
||||
if pid == 0:
|
||||
tac()
|
||||
from os import execvp
|
||||
execvp('dumb-init', ('dumb-init', 'tac'))
|
||||
else:
|
||||
_test(fd)
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -1,8 +1,8 @@
|
|||
[tox]
|
||||
envlist = py27,py34
|
||||
envlist = py26,py27,py34
|
||||
|
||||
[testenv]
|
||||
deps = -rrequirements-dev.txt
|
||||
deps = -r{toxinidir}/requirements-dev.txt
|
||||
commands =
|
||||
python -m pytest
|
||||
pre-commit run --all-files
|
||||
|
|
Loading…
Reference in a new issue