[PATCH v2] test-skeleton: redirect stderr to stdout

Arjun Shankar arjun.is@lostca.se
Fri Jun 17 15:34:00 GMT 2016


> Rather than worry if we use funcs that dirty stderr instead of writing
> to stdout, redirect stderr internally to stdout.  Now all output will
> go to stdout regardless.

> +  if (dup2 (STDOUT_FILENO, STDERR_FILENO) == -1)
> +    {
> +      printf ("binding stderr to stdout failed: %m\n");
> +      exit (1);
> +    }

Just want to mention this somewhat old but related thread:

https://sourceware.org/ml/libc-alpha/2014-10/msg00089.html

In short:
While I am not aware of any test that _requires_ writes to stderr, this
blanket `dup2' in the skeleton can affect such tests. Roland mentioned that
for such tests, if they show up, this behaviour can be made to depend on a
macro. I don't know if including a `#ifdef' in this first patch is good
since it probably will remain unused for now, but it's an idea.

Cheers,
Arjun



More information about the Libc-alpha mailing list