From: larsxschneider@gmail.com
To: git@vger.kernel.org
Cc: luke@diamand.org, sunshine@sunshineco.com, gitster@pobox.com,
peff@peff.net, Lars Schneider <larsxschneider@gmail.com>
Subject: [PATCH v6 5/6] git-p4: add trap to kill p4d on test exit
Date: Thu, 19 Nov 2015 09:58:10 +0100 [thread overview]
Message-ID: <1447923491-15330-6-git-send-email-larsxschneider@gmail.com> (raw)
In-Reply-To: <1447923491-15330-1-git-send-email-larsxschneider@gmail.com>
From: Lars Schneider <larsxschneider@gmail.com>
Sometimes the "prove" test runner hangs on test exit because p4d is
still running. Add a trap to always kill "p4d" on test exit.
You can reproduce the problem by commenting "P4D_TIMEOUT" in
"lib-git-p4.sh" and running "prove ./t9800-git-p4-basic.sh".
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---
t/lib-git-p4.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index acd5578..f9ae1d7 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -74,6 +74,15 @@ cli="$TRASH_DIRECTORY/cli"
git="$TRASH_DIRECTORY/git"
pidfile="$TRASH_DIRECTORY/p4d.pid"
+# Sometimes "prove" seems to hang on exit because p4d is still running
+cleanup() {
+ if test -f "$pidfile"
+ then
+ kill -9 $(cat "$pidfile") 2>/dev/null && exit 255
+ fi
+}
+trap cleanup EXIT
+
# git p4 submit generates a temp file, which will
# not get cleaned up if the submission fails. Don't
# clutter up /tmp on the test machine.
--
2.5.1
next prev parent reply other threads:[~2015-11-19 8:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-19 8:58 [PATCH v6 0/6] Add Travis CI support larsxschneider
2015-11-19 8:58 ` [PATCH v6 1/6] implement test_might_fail using a refactored test_must_fail larsxschneider
2015-11-19 8:58 ` [PATCH v6 2/6] add "ok=sigpipe" to test_must_fail and use it to fix flaky tests larsxschneider
2015-11-19 8:58 ` [PATCH v6 3/6] git-p4: retry kill/cleanup operations in tests with timeout larsxschneider
2015-11-19 8:58 ` [PATCH v6 4/6] git-p4: add p4d timeout in tests larsxschneider
2015-11-19 8:58 ` larsxschneider [this message]
2015-11-19 8:58 ` [PATCH v6 6/6] Add Travis CI support larsxschneider
2015-11-19 14:35 ` Jeff King
2015-11-20 9:29 ` Lars Schneider
2015-11-19 14:14 ` [PATCH v6 0/6] " Jeff King
2015-11-20 8:46 ` Lars Schneider
2015-11-20 12:56 ` Luke Diamand
2015-11-23 18:59 ` Jeff King
2015-11-23 21:19 ` Luke Diamand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447923491-15330-6-git-send-email-larsxschneider@gmail.com \
--to=larsxschneider@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=luke@diamand.org \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).