[PATCH] test/T030-config: Separate stdout and stderr output
Tomi Ollila
tomi.ollila at iki.fi
Sun Mar 10 13:42:59 PDT 2019
On Sun, Mar 10 2019, Luis Ressel wrote:
> POSIX doesn't specify the flushing behaviour of the STDOUT stream, so
> it's invalid to assume a particular order between the stdout and stderr
> output. The current test breaks on musl due to this.
> ---
> test/T030-config.sh | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/test/T030-config.sh b/test/T030-config.sh
> index f36695c6..9404390b 100755
> --- a/test/T030-config.sh
> +++ b/test/T030-config.sh
> @@ -43,7 +43,9 @@ notmuch config set foo.nonexistent
> test_expect_equal "$(notmuch config get foo.nonexistent)" ""
>
> 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
(I would like to put that cat-echo-cat into function but naming is hard...)
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!)
Tomi
More information about the notmuch
mailing list