Skip to contentSkip to conversation

selftest: Add logging tests for bb.build.exec_func with shell/python code

PATCH New Peter Kjellerstedt 1 participant 1 message Feb 17, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftest: Add logging tests for bb.build.exec_func with shell/python code

The situation regarding logging is different when a function called by bb.build.exec_func() fails compared to when the task code fails directly.

---

The second test (with logs but without verbose) in bblogging.BitBakeLogging.test_python_exec_func_shell_logging will currently fail since stdout/stderr from the failing shell code is not included in the output. This can be fixed by reverting commit fc58ad84 in bitbake, but then some of the other tests will fail as there will be duplicated logs for them.

 .../recipes-test/logging-test/logging-test.bb | 10 +++
 meta/lib/oeqa/selftest/cases/bblogging.py     | 69 ++++++++++++++++++-
 2 files changed, 78 insertions(+), 1 deletion(-)
meta-selftest/recipes-test/logging-test/logging-test.bb +10 -0
index a6100123f9..ac3fb46f45 100644
@@ -11,12 +11,22 @@ do_shelltest() {
 }
 addtask do_shelltest
 
+python do_pythontest_exec_func_shell() {
+    bb.build.exec_func('do_shelltest', d)
+}
+addtask do_pythontest_exec_func_shell
+
 python do_pythontest_exit () {
     print("This is python stdout")
     sys.exit(1)
 }
 addtask do_pythontest_exit
 
+python do_pythontest_exec_func_python() {
+    bb.build.exec_func('do_pythontest_exit', d)
+}
+addtask do_pythontest_exec_func_python
+
 python do_pythontest_fatal () {
     print("This is python fatal test stdout")
     bb.fatal("This is a fatal error")
meta/lib/oeqa/selftest/cases/bblogging.py +68 -1

87 lines not on this page · raw message