summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-01 14:05:16 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-16 14:31:33 +0000
commitd6ba48450604003a28c7efa66e2051cf165ac753 (patch)
tree55940c8d264762bffc2a506d9c05a4586eb19104
parent72d7b5b5d409e9de83a6428d07e12d2ee0e2f810 (diff)
downloadpoky-d6ba48450604003a28c7efa66e2051cf165ac753.tar.gz
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) (From OE-Core rev: 2696e69af0b32e03692d8644cc01b28dcf221aa1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/utils.py5
-rw-r--r--meta/lib/oeqa/selftest/cases/oelib/utils.py4
2 files changed, 7 insertions, 2 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index d05f517a70..8a584d6ddd 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -318,9 +318,10 @@ def multiprocess_launch(target, items, d, extraargs=None):
318 for p in launched: 318 for p in launched:
319 p.join() 319 p.join()
320 if errors: 320 if errors:
321 msg = ""
321 for (e, tb) in errors: 322 for (e, tb) in errors:
322 bb.error(str(tb)) 323 msg = msg + str(e) + ": " + str(tb) + "\n"
323 bb.fatal("Fatal errors occurred in subprocesses, tracebacks printed above") 324 bb.fatal("Fatal errors occurred in subprocesses:\n%s" % msg)
324 return results 325 return results
325 326
326def squashspaces(string): 327def squashspaces(string):
diff --git a/meta/lib/oeqa/selftest/cases/oelib/utils.py b/meta/lib/oeqa/selftest/cases/oelib/utils.py
index 275aeda74e..789c6f78d2 100644
--- a/meta/lib/oeqa/selftest/cases/oelib/utils.py
+++ b/meta/lib/oeqa/selftest/cases/oelib/utils.py
@@ -66,6 +66,9 @@ class TestMultiprocessLaunch(TestCase):
66 66
67 def dummyerror(msg): 67 def dummyerror(msg):
68 print("ERROR: %s" % msg) 68 print("ERROR: %s" % msg)
69 def dummyfatal(msg):
70 print("ERROR: %s" % msg)
71 raise bb.BBHandledException()
69 72
70 @contextmanager 73 @contextmanager
71 def captured_output(): 74 def captured_output():
@@ -79,6 +82,7 @@ class TestMultiprocessLaunch(TestCase):
79 82
80 d = bb.data_smart.DataSmart() 83 d = bb.data_smart.DataSmart()
81 bb.error = dummyerror 84 bb.error = dummyerror
85 bb.fatal = dummyfatal
82 86
83 # Assert the function returns the right results 87 # Assert the function returns the right results
84 result = multiprocess_launch(testfunction, ["3", "4", "5", "6"], d, extraargs=(d,)) 88 result = multiprocess_launch(testfunction, ["3", "4", "5", "6"], d, extraargs=(d,))