Re: tr/pty-all (Re: What's cooking in git.git (Dec 2011, #04; Tue, 13))
- From
Jeff King <peff@peff.net>
- Date
- Dec 15, 2011, 00:25 UTC
- Message-ID
- <20111215002530.GA2566@sigill.intra.peff.net>
- In-Reply-To
- <20111214233119.GA2354@elie>
On Wed, Dec 14, 2011 at 05:31:19PM -0600, Jonathan Nieder wrote:
Show 11 quoted lines
> > @@ -469,7 +471,7 @@ test_debug () {
> > test_eval_ () {
> > # This is a separate function because some tests use
> > # "return" to end a test_expect_success block early.
> > - eval >&3 2>&4 "$*"
> > + eval <"$TEST_DIRECTORY/stdin-garbage" >&3 2>&4 "$*"
>
> How about /dev/urandom on platforms that support it? It wouldn't be
> as pleasant to debug as "This is a magic stdin garbage stream", but it
> would be more likely to (despite the name :)) predictably trip errors,
> or at least hangs, in problematic tests.I'd rather have something deterministic. If you really want to be mean to accidental readers of stdin, then put binary junk into stdin-garbage (even the results of a single run of /dev/urandom, if you like). But I suspect arbitrary text is good enough to throw a monkey wrench into anything that will care about its input (and those that don't are beyond our ability to auto-detect anyway[1]). And it's way easier to debug than seeing random binary bits.
-Peff
[1] Actually, you could abandon the idea of feeding garbage altogether, and instead open the descriptor outside the test, then check that its offset is still 0 after the test. You'd have to use a helper program to do the ftell(), but it should work as the descriptor position will be shared.