On Thu, 2017-06-22 at 11:18 -0500, Leonardo Sandoval wrote: > On Thu, 2017-06-22 at 17:59 +0200, Patrick Ohly wrote: > > On Thu, 2017-06-22 at 10:37 -0500, Leonardo Sandoval wrote: > > > On Thu, 2017-06-22 at 17:14 +0200, Patrick Ohly wrote: > > > > On Thu, 2017-06-22 at 09:58 -0500, Leonardo Sandoval wrote: > > > > > On Thu, 2017-06-22 at 16:17 +0200, Patrick Ohly wrote: > > > > > > On Mon, 2017-06-19 at 07:39 -0700, > > > > > > leonardo.sandoval.gonza...@linux.intel.com wrote: > > > > > > > From: Leonardo Sandoval > > > > > > > <leonardo.sandoval.gonza...@linux.intel.com> > > > > > > > > > > > > > > Do not mix the stderr into stdout, allowing test cases to query > > > > > > > the specific output. > > > > > > > > > > > > This changes the behavior of functions that are also used outside of > > > > > > OE-core in a way that won't be easy to notice. I also don't think > > > > > > that > > > > > > it is the right default. For example, for bitbake it is easier to > > > > > > understand where an error occurred when stderr goes to the same > > > > > > stream > > > > > > as stdout. > > > > > > > > > > how would that make it easier? > > > > > > > > Because then output will be properly interleaved, as it would be on a > > > > console. > > > > > > > > Actually, the entire error reporting in runCmd() only prints > > > > result.output, so with stderr going to result.error by default, you > > > > won't get the actual errors reported anymore at all, will you? > > > > > > > > > > process stderr will go into result.error and process stdout into > > > result.output. So when the process is executed ignoring the return > > > status, then test must check result.error. I find the latter cleaner > > > that checking errors into stdout. > > > > It depends on how the result is used. That you prefer split output for > > some tests does not mean that everyone wants the same in their tests. I > > don't want it in my own usage of runCmd() or bitbake() because I don't > > care about where a message was printed. I just want it in proper order. > > > > If you change the default, then you will also have to enhance runCmd()'s > > error handling to include results.error. That's currently missing in > > your patch. > > it is not missing, it is on 2/2
I'm talking about this code: def runCmd(command, ignore_status=False, timeout=None, assert_error=True, native_sysroot=None, limit_exc_output=0, **options): ... if result.status and not ignore_status: exc_output = result.output if limit_exc_output > 0: split = result.output.splitlines() if len(split) > limit_exc_output: exc_output = "\n... (last %d lines of output)\n" % limit_exc_output + \ '\n'.join(split[-limit_exc_output:]) if assert_error: raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, exc_output)) else: raise CommandError(result.status, command, exc_output) You are not extending that in either 2/2, are you? At the moment, when a command fails, one gets stdout+stderr. With your path, one only gets stdout, which typically won't have the error message that caused the non-zero status. Here's my proposal: 1. drop the "commands: send stderr to a new pipe" path, because that has much wider implications for everyone else 2. in "selftest/cases: use stderr data when querying for errors", explicitly change the bitbake() calls so that they have stderr=subprocess.PIPE Example: @OETestID(105) def test_bitbake_invalid_recipe(self): - result = bitbake('-b asdf', ignore_status=True) - self.assertTrue("ERROR: Unable to find any recipe file matching 'asdf'" in result.output, msg = "Though asdf recipe doesn't exist, bitbake didn't output any err. message. bitbake output: %s" % result.output) + invalid = 'asdf' + result = bitbake('-b %s' % invalid, ignore_status=True, stderr=subprocess.PIPE) + self.assertTrue("ERROR: Unable to find any recipe file matching '%s'" % invalid in result.error, msg = "Though %s recipe doesn't exist, bitbake didn't output any err. message. bitbake output: %s" % (invalid, result.error)) -- Best Regards, Patrick Ohly The content of this message is my personal opinion only and although I am an employee of Intel, the statements I make here in no way represent Intel's position on the issue, nor am I authorized to speak on behalf of Intel on this matter. -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core