All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Andrew Jones <drjones@redhat.com>, kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH v3 3/6] arch-run: reduce return code ambiguity
Date: Wed, 2 Mar 2016 16:42:38 +0100	[thread overview]
Message-ID: <20160302154237.GA2354@potion.brq.redhat.com> (raw)
In-Reply-To: <56D6FC58.9010307@redhat.com>

2016-03-02 15:44+0100, Paolo Bonzini:
> On 02/03/2016 13:57, Radim Krčmář wrote:
>> 2016-03-01 22:29+0100, Paolo Bonzini:
>>> On 29/02/2016 19:53, Andrew Jones wrote:
>>>> +	errors=$("${@}" 2>&1 1>&${stdout} | tee >(cat - 1>&2); exit ${PIPESTATUS[0]})
>>>
>>> Whoa! :)  So stdout goes to {stdout} and from there to the real stdout;
>>> stderr instead is tee'd to stderr and $errors.
>> 
>> Yeah. :)
>> 
>>> Is the "tee" and "cat" necessary?  Can you just use printf somewhat like:
>> 
>> They are, if you want want to improve chances of getting the original
>> order of stdout and stderr.
> 
> Getting the original order can't really work if you use separate file
> descriptions.

Yes, there is no "true" order ... my concern is about transparency:
tee delays stderr much less than if we buffered stderr until QEMU has
finished, so mixed stdout/stderr has better chance of being visible in
sans-wrapper order.

> I'm not sure how you would have something on stderr, except on the very
> last line?  The idea being that 1) the test only writes to stdout 2)
> QEMU only writes to stderr 3) QEMU exits after writing to stderr.  If
> this is true, the proposed assignment/printf pair works just fine.

QEMU prints some warnings without immediately exiting, e.g.
  warning: host doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]

So it's possible that stdout is printed after stderr.  Preserving the
visible output could be less confusing in these rare cases.  I agree
with the late printf if you think that the ugly code is not worth it.

  reply	other threads:[~2016-03-02 15:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 18:53 [kvm-unit-tests PATCH v3 0/6] reduce exit status ambiguity and more Andrew Jones
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 1/6] x86: clean up exit use, use abort Andrew Jones
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 2/6] run scripts need consistent exit status Andrew Jones
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 3/6] arch-run: reduce return code ambiguity Andrew Jones
2016-03-01 21:29   ` Paolo Bonzini
2016-03-02 12:57     ` Radim Krčmář
2016-03-02 14:44       ` Paolo Bonzini
2016-03-02 15:42         ` Radim Krčmář [this message]
2016-03-02 16:05           ` Paolo Bonzini
2016-03-02 17:13             ` Radim Krčmář
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 4/6] cleanup unittests.cfg headers Andrew Jones
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 5/6] runtime: enable some unittest config overriding Andrew Jones
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 6/6] run scripts: add timeout support Andrew Jones
2016-03-01 21:30 ` [kvm-unit-tests PATCH v3 0/6] reduce exit status ambiguity and more Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160302154237.GA2354@potion.brq.redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.