mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
lib/oe/utils: Improve multiprocess_lauch exception handling
We've seen a cryptic: "ERROR: Fatal errors occurred in subprocesses, tracebacks printed above" message from oe-selftest with no other traceback information. Improve the traceback logging to try and give a better indication of any errors that is ocurring. (From OE-Core rev: 521dd3d00979a27b6932e58d5497de68abac26e1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -318,9 +318,10 @@ def multiprocess_launch(target, items, d, extraargs=None):
|
|||||||
for p in launched:
|
for p in launched:
|
||||||
p.join()
|
p.join()
|
||||||
if errors:
|
if errors:
|
||||||
|
msg = ""
|
||||||
for (e, tb) in errors:
|
for (e, tb) in errors:
|
||||||
bb.error(str(tb))
|
msg = msg + str(e) + ": " + str(tb) + "\n"
|
||||||
bb.fatal("Fatal errors occurred in subprocesses, tracebacks printed above")
|
bb.fatal("Fatal errors occurred in subprocesses:\n%s" % msg)
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def squashspaces(string):
|
def squashspaces(string):
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ class TestMultiprocessLaunch(TestCase):
|
|||||||
|
|
||||||
def dummyerror(msg):
|
def dummyerror(msg):
|
||||||
print("ERROR: %s" % msg)
|
print("ERROR: %s" % msg)
|
||||||
|
def dummyfatal(msg):
|
||||||
|
print("ERROR: %s" % msg)
|
||||||
|
raise bb.BBHandledException()
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def captured_output():
|
def captured_output():
|
||||||
@@ -79,6 +82,7 @@ class TestMultiprocessLaunch(TestCase):
|
|||||||
|
|
||||||
d = bb.data_smart.DataSmart()
|
d = bb.data_smart.DataSmart()
|
||||||
bb.error = dummyerror
|
bb.error = dummyerror
|
||||||
|
bb.fatal = dummyfatal
|
||||||
|
|
||||||
# Assert the function returns the right results
|
# Assert the function returns the right results
|
||||||
result = multiprocess_launch(testfunction, ["3", "4", "5", "6"], d, extraargs=(d,))
|
result = multiprocess_launch(testfunction, ["3", "4", "5", "6"], d, extraargs=(d,))
|
||||||
|
|||||||
Reference in New Issue
Block a user