Bug 11482

Summary: yocto-compat-layer.py: return non-zero exit codes
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Patrick Ohly <patrick.ohly>
Component: Scripts and ToolsAssignee: Aníbal Limón <anibal.limon>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Medium+ CC: ross.burton
Version: unspecified   
Target Milestone: 2.4 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Patrick Ohly 2017-05-08 15:08:22 UTC
In the summary after a test, yocto-compat-layer.py explains which tests failed, but then doesn't actually indicate that to the caller in the return code:

$ oe-selftest ... 
INFO: ----------------------------------------------------------------------
INFO: Ran 4 tests in 2.756s
INFO: 
INFO: FAILED (errors=1, skipped=3)
INFO: 
INFO: Summary of results:
INFO: 
INFO: meta-refkit-gateway ... FAIL
# echo $?
0

That's because main() in yocto-compat-layer.py always returns 0. It would be better if it returned 1 if any test failed and 2 if none were run.

The a script can test for success (== 0) and distinguish between different kinds of failures (error or no tests) if desired.