[PATCH] test/T030-config: Separate stdout and stderr output
Luis Ressel
aranea at aixah.de
Sun Mar 10 17:11:55 PDT 2019
On Sun, Mar 10, 2019 at 10:42:59PM +0200, Tomi Ollila wrote:
> On Sun, Mar 10 2019, Luis Ressel wrote:
>
> > test_begin_subtest "List all items"
> > -notmuch config list 2>&1 | notmuch_config_sanitize > OUTPUT
> > +notmuch config list 2>OUTPUT-ERR | notmuch_config_sanitize > OUTPUT
> > +echo "====" >> OUTPUT
> > +notmuch_config_sanitize < OUTPUT-ERR >> OUTPUT
>
> IMO the above would be better (model/pattern for further use) as:
>
> notmuch config list >STDOUT 2>STDERR
> { cat STDOUT; echo "===="; cat STDERR; } | notmuch_config_sanitize > OUTPUT
Yes, that'd certainly look better.
> (I would like to put that cat-echo-cat into function but naming is hard...)
"concat" perhaps? Or "concat_separator"/"concat_with_separator"?
> alternatives:
>
> 1) drop ====, then one cat STDOUT STDERR ... would be enough
>
> 2) printf '%s====\n%s' "$(< STDOUT)" "$(< STDERR)"
>
> 3) head -1000 STDOUT STDERR
>
> -- in case of (3) are we sure that all head(1) implementations print the
> filenames (and formats (possible) extra newlines) the same way.
>
> -- ( (2) brings $(< ...) (faster replacement for $(cat ...) which we
> haven't used in notmuch test suite so far -- but we could!)
Any of those options would be fine with me, with a preference for 2).
As for 3), POSIX specifies the exact header format head should use:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html
(There may be nonconformant implementations anyway, of course.)
Regards,
Luis Ressel
More information about the notmuch
mailing list