Trying to understand some test "... 2>&1 >/dev/null | ..."

There is a bunch of failures caused by this kind of tests on windows, such as Preprocessor\include-directive1.c. Here an example of a test command:
// RUN: clang-cc -E %s -fno-caret-diagnostics 2>&1 >/dev/null | grep ‘file successfully included’ | count 3

From what I understand, first stderr is redirected to stdout and then stdout to /dev/null, meaning if I understand thing well that both stderr and stdout goes into /dev/null and are not passed to the next process in the pipe. So what it supposes to go in the following pipe? Obviously there is something I don’t know…

There is a bunch of failures caused by this kind of tests on windows, such
as Preprocessor\include-directive1.c. Here an example of a test command:
// RUN: clang-cc -E %s -fno-caret-diagnostics 2>&1 >/dev/null | grep 'file
successfully included' | count 3

From what I understand, first stderr is redirected to stdout and then stdout

to /dev/null, meaning if I understand thing well that both stderr and stdout
goes into /dev/null and are not passed to the next process in the pipe. So
what it supposes to go in the following pipe? Obviously there is something I
don't know...

nops. that means that stderr is passed through the pipe and stdout is discarded. The forwarding of fds is done in the specified order (and it matters).
Nuno

2009/8/11 Nuno Lopes <nunoplopes@sapo.pt>

There is a bunch of failures caused by this kind of tests on windows, such
as Preprocessor\include-directive1.c. Here an example of a test command:
// RUN: clang-cc -E %s -fno-caret-diagnostics 2>&1 >/dev/null | grep ‘file
successfully included’ | count 3

From what I understand, first stderr is redirected to stdout and then stdout

to /dev/null, meaning if I understand thing well that both stderr and stdout
goes into /dev/null and are not passed to the next process in the pipe. So
what it supposes to go in the following pipe? Obviously there is something I
don’t know…

nops. that means that stderr is passed through the pipe and stdout is discarded. The forwarding of fds is done in the specified order (and it matters).
Nuno

Thanks for clarifying that. Got another 4 tests passing on Windows fixing that bug.