On Fri, 1 Nov 2024 at 03:57, Vince Chang <[email protected]> wrote:
> > > Also if you can (in a separate commit) drop all usage of this
> > > "2>/dev/null" pattern in wic tests that only harms fail diagnostics,
> > > that would be helpful.
> >
> > I will send a separate commit to remove "2>/dev/null" in the wic test cases.
> >
>
> The wic test cases use out.splitlines to get the command result. If we remove
> "2>/dev/null", it may capture other warning messages, making it unable to get
> the current result.
> To avoid needing additional code to use splitted.index("BYT;") and
> considering that ‘2>/dev/null’ is also used in ‘debugfs’, I would suggest not
> removing "2>/dev/null". If the same issue arises again, we can manually
> remove it to see where the error is. What do you think?
>
If the issue is intermittent or difficult to reproduce (and in this
case it was - I had to spend a couple hours reproducing it for you on
a particular build host in yocto CI cluster), it is far better to
write the code such that the needed diagnostics are printed right when
the error occurs in the first place in CI.
Anyway, implementation runCmd() indeed defaults to stderr being
redirected and appended to stdout, so the standard stream and the
error stream are mashed together.
To avoid that, you should also set stderr=subprocess.PIPE when calling
runCmd(). Check meta/lib/oeqa/selftest/cases/runcmd.py for examples:
def test_output(self):
result = runCmd("echo stdout; echo stderr >&2", shell=True, sync=False)
self.assertEqual("stdout\nstderr", result.output)
self.assertEqual("", result.error)
def test_output_split(self):
result = runCmd("echo stdout; echo stderr >&2", shell=True,
stderr=subprocess.PIPE, sync=False)
self.assertEqual("stdout", result.output)
self.assertEqual("stderr", result.error)
Alex
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#206600):
https://lists.openembedded.org/g/openembedded-core/message/206600
Mute This Topic: https://lists.openembedded.org/mt/109308684/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-