debian/test.sh: factor out our dh_auto_test wrapper

Clean up any stray processes even if the test fails.

Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
Simon McVittie 2016-06-12 09:49:25 -04:00
parent 97502c57f0
commit 3691da8fbf
3 changed files with 23 additions and 8 deletions

2
debian/changelog vendored
View File

@ -4,6 +4,8 @@ ostree (2016.5-4) UNRELEASED; urgency=medium
d/p/tests-Use-strict-mode-by-default-for-C-tests.patch: add patches d/p/tests-Use-strict-mode-by-default-for-C-tests.patch: add patches
to make sure the tests fail as soon as something goes wrong to make sure the tests fail as soon as something goes wrong
* Build-depend on procps, used to check for leaked processes * Build-depend on procps, used to check for leaked processes
* debian/test.sh: factor out our dh_auto_test wrapper, and clean
up any stray processes even if the test fails
-- Simon McVittie <smcv@debian.org> Sat, 11 Jun 2016 19:52:40 +0100 -- Simon McVittie <smcv@debian.org> Sat, 11 Jun 2016 19:52:40 +0100

9
debian/rules vendored
View File

@ -26,14 +26,7 @@ override_dh_auto_configure:
chmod +x tests/*.js chmod +x tests/*.js
override_dh_auto_test: override_dh_auto_test:
VERBOSE=1 dh_auto_test debian/test.sh
# One test creates multiple GPG homedirs, each with its own agent
pkill --full "gpg-agent --homedir /var/tmp/tap-test\\.[^/]+/.*" || :
if pgrep lt-ostree || pgrep --full "gpg-agent --homedir /var/tmp/tap-test."; then \
echo "WARNING: daemon processes were leaked"; \
pgrep gpg-agent | xargs --no-run-if-empty ps ww; \
pgrep lt-ostree | xargs --no-run-if-empty ps ww; \
fi
override_dh_auto_install: override_dh_auto_install:
dh_auto_install dh_auto_install

20
debian/test.sh vendored Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
set -e
export VERBOSE=1
exit_status=0
dh_auto_test || exit_status=1
pkill --full "gpg-agent --homedir /var/tmp/tap-test\\.[^/]+/.*" || :
if pgrep lt-ostree || pgrep --full "gpg-agent --homedir /var/tmp/tap-test."; then \
echo "WARNING: daemon processes were leaked"
pgrep gpg-agent | xargs --no-run-if-empty ps ww
pgrep lt-ostree | xargs --no-run-if-empty ps ww
fi
exit $exit_status
# vim:set et sw=4 sts=4: