Skip to content
  • Jeff King's avatar
    do not use GIT_TRACE_PACKET=3 in tests · 2ad23273
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    Some test scripts use the GIT_TRACE mechanism to dump
    debugging information to descriptor 3 (and point it to a
    file using the shell). On Windows, however, bash is unable
    to set up descriptor 3. We do not write our trace to the
    file, and worse, we may interfere with other operations
    happening on descriptor 3, causing tests to fail or even
    behave inconsistently.
    
    Prior to commit 97a83fa8 (upload-pack: remove packet debugging
    harness), these tests used GIT_DEBUG_SEND_PACK, which only
    supported output to a descriptor. The tests in t5503 were
    always broken on Windows, and were marked to be skipped via
    the NOT_MINGW prerequisite. In t5700, the tests used to pass
    prior to 97a83fa8, but only because they were not careful
    enough; because we only grepped the trace file, an empty
    file looked successful to us. But post-97a83fa8
    
    , the writing
    to descriptor 3 causes "git fetch" to hang (presumably
    because we are throwing random bytes into the middle of the
    protocol).
    
    Now that we are using the GIT_TRACE mechanism, we can
    improve both scripts by asking git to write directly to a
    file rather than a descriptor. That fixes the hang in t5700,
    and should allow t5503 to successfully run on Windows.
    
    In both cases we now also use "test -s" to double-check that
    our trace file actually contains output, which should reduce
    the possibility of an erroneously passing test.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Tested-by: default avatarJohannes Sixt <j6t@kdbg.org>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    2ad23273