From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, David Barr <david.barr@cordelta.com>
Subject: Re: [PATCH] Portability: returning void
Date: Wed, 30 Mar 2011 00:13:39 -0400 [thread overview]
Message-ID: <20110330041339.GA26281@sigill.intra.peff.net> (raw)
In-Reply-To: <20110330035733.GA2793@elie>
On Tue, Mar 29, 2011 at 10:57:33PM -0500, Jonathan Nieder wrote:
> Jeff King wrote:
>
> > While we're at it, let's make the "kill" process a little
> > more robust. Specifically:
> >
> > 1. Wrap the "kill" in a test_when_finished, since we want
> > to clean up the process whether the test succeeds or not.
> >
> > 2. The "kill" is part of our && chain for test success. It
> > probably won't fail, but it can if the process has
> > expired before we manage to kill it. So let's mark it
> > as OK to fail.
> >
> > Signed-off-by: Jeff King <peff@peff.net>
> > ---
> > Actually, my (2) above is unlikely to trigger, since the test would have
> > to hang for 100 seconds first, which probably means it is failing
> > anyway. But I did run across it when I screwed up my fix.
>
> That is actually how the tests distinguish between success and
> failure. Any idea about a better way?
Ah. I was trying not to look too hard at how the tests actually work, so
I completely missed that. Yes, if the "kill" is part of the actual test,
then it should stay in the test. We can also put in a test_when_finished
to kill it should the test fail to make it that far. If the cleanup one
does an extra kill, it shouldn't be a big deal.
> I was in the process of writing a commit message for the same "exec"
> trick, but I'm glad you got to it first. ;-)
I don't know why I didn't think of it sooner. :)
> > Also, is it just me, or does it seem weird that test_when_finished
> > blocks failing can produce test failure? I would think you would be able
> > to put any old cleanup crap into them and not care whether it worked or
> > not.
>
> I'm generally happy that it catches mistakes in cleanup code, but I
> could easily be convinced to change it anyway.
I don't think it's a big deal. It just surprised me.
> Maybe it would be good to factor out a helper to make future
> improvements a little easier, like so:
>
> -- 8< --
> Subject: t0081: introduce helper to fill a pipe in the background
>
> The fill_input function generates a fifo and runs a command to write
> to it and wait a while. The intended use is to test programs that
> need to be able to cope with input of limited length without relying
> on EOF or SIGPIPE to detect its end.
Yeah, that looks much nicer. Do you want to just re-roll that on top of
what's in 'master', with the "exec" magic and the defensive
test_when_finished in it (or as a separate patch on top if you want to
split the refactor and fix)? Feel free to borrow from my commit message.
-Peff
next prev parent reply other threads:[~2011-03-30 4:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-29 17:31 [PATCH] Portability: returning void Michael Witten
2011-03-29 20:02 ` Jonathan Nieder
2011-03-29 22:16 ` Jeff King
2011-03-29 22:36 ` Jeff King
2011-03-29 23:49 ` Jonathan Nieder
2011-03-30 0:16 ` Jeff King
2011-03-30 0:29 ` Jonathan Nieder
2011-03-30 3:30 ` Jeff King
2011-03-30 3:57 ` Jonathan Nieder
2011-03-30 4:13 ` Jeff King [this message]
2011-03-30 6:54 ` Johannes Sixt
2011-03-30 8:16 ` [PATCH/RFC svn-fe] tests: introduce helper to fill a pipe in the background Jonathan Nieder
2011-03-30 8:41 ` [PATCH] Portability: returning void Jonathan Nieder
2011-03-30 12:40 ` Jeff King
2011-03-30 18:54 ` Jonathan Nieder
2011-03-30 4:41 ` [PULL svn-fe] " Jonathan Nieder
2011-03-30 19:31 ` Junio C Hamano
2011-03-30 0:42 ` [PATCH] " Jonathan Nieder
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=20110330041339.GA26281@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=david.barr@cordelta.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.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).