[cfe-dev] Patch to fix 2>&1 > /dev/null tests on Windows

Daniel Dunbar daniel at zuster.org
Mon Aug 17 22:17:20 PDT 2009


On Thu, Aug 13, 2009 at 5:14 AM, Baptiste
Lepilleur<baptiste.lepilleur at gmail.com> wrote:
> 2009/8/13 Daniel Dunbar <daniel at zuster.org>
>>
>> Hi Baptiste,
>>
>> This patch isn't quite correct, the situation is both more complicated
>> and simpler. What the script needs to do is just model the file
>> mappings (which start out as the default), and then apply each
>> redirection to that model. Then at the end, it needs to verify that we
>> can call the subprocess module with the right settings to match the
>> redirection.
>>
>> For now, a simpler patch which I would be fine with is to just change
>> those 4 tests to use a temporary file instead of shell redirection
>> fun, e.g.:
>>
>> RUN: clang 2> %t
>> RUN: grep 'file ...' %t | count 3
>>
>>  - Daniel
>
> You're right, this will work just as well. It is a lot simpler and remove
> the /dev/null issue.

I'm not sure if you have already done this on your branch, but if you
submit a patch for this issue I will apply it.

> Can you elaborate why the patch is incorrect? From the tests I made the
> stderr of clang-cc is correctly redirected to stdin of count/grep... What am
> I missing?

Well, the patch handles one case but the mechanism (in the shell) is
much more general. One can do all sorts of unreadable things in the
shell, e.g:
  echo "hi" 2> a 1>&2
which aren't really modeled by your patch.

 - Daniel

>>
>> On Tue, Aug 11, 2009 at 3:19 PM, Baptiste
>> Lepilleur<baptiste.lepilleur at gmail.com> wrote:
>> > This patch fixes failures of test such as:
>> > // RUN: clang-cc -E %s -fno-caret-diagnostics 2>&1 >/dev/null | grep
>> > 'file
>> > successfully included' | count 3
>> >
>> > when run on Windows with the shell emulation.
>
>




More information about the cfe-dev mailing list