Re: [PATCH 02/17] t0001 (mingw): do not expect a specific order of stdout/stderr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 18, 2019 at 8:24 AM Johannes Schindelin via GitGitGadget
<gitgitgadget@xxxxxxxxx> wrote:
> When redirecting stdout/stderr to the same file, we cannot guarantee
> that stdout will come first.
>
> In fact, in this test case, it seems that an MSVC build always prints
> stderr first.
>
> In any case, this test case does not want to verify the *order* but
> the *presence* of both outputs, so let's relax the test a little.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
> ---
> diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> @@ -474,7 +474,8 @@ test_expect_success MINGW 'redirect std handles' '
>         printf ".git\nfatal: Needed a single revision\n" >expect &&
> -       test_cmp expect output.txt
> +       sort <output.txt >output.sorted &&
> +       test_cmp expect output.sorted

It was quite surprising to see this sorting only 'output' but not
'expect'. I see now that 'output' is already "sorted" (in that sense),
but it feels fragile. More robust would be to sort 'expect' as well:

    printf ".git\nfatal: Needed a single revision\n" | sort >expect &&

This would protect against the next person who modifies the 'printf'
testing on Unix and Windows/gcc and thinking all is well even though
the change might make the test fail for an MSVC build.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux