Re: tr/pty-all (Re: What's cooking in git.git (Dec 2011, #04; Tue, 13))
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:52:38
Jeff King wrote: [...]
A test which accidentally reads stdin would soak up all of the rest of the input intended for the outer shell loop. Let's redirect stdin from a known source to eliminate variation. We could just connect it to /dev/null. However, tests which accidentally read stdin would then see immediate EOF, which may or may not cause them to notice the errror.
[...]
quoted hunk ↗ jump to hunk
+++ b/t/test-lib.sh
[...]
quoted hunk ↗ jump to hunk
@@ -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. With or without something along those lines on top, your patch looks like a good change. Thanks for a thoughtful analysis. Jonathan