From: Mark Hatle <mark.hatle@kernel.crashing.org>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH v2] bitbake: runqueue: Verify mcdepends are valid
Date: Tue, 25 Feb 2025 12:38:53 -0600 [thread overview]
Message-ID: <1740508733-4989-1-git-send-email-mark.hatle@kernel.crashing.org> (raw)
From: Mark Hatle <mark.hatle@amd.com>
In order to avoid a potentially confusing backtrace, check that the mcdepend
is valid when we add it.
Add a test case to ensure invalid configurations are caught and trigger an
error.
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
---
lib/bb/runqueue.py | 2 ++
lib/bb/tests/runqueue-tests/recipes/g1.bb | 2 ++
lib/bb/tests/runqueue-tests/recipes/h1.bb | 0
lib/bb/tests/runqueue.py | 18 ++++++++++++++++++
4 files changed, 22 insertions(+)
create mode 100644 lib/bb/tests/runqueue-tests/recipes/g1.bb
create mode 100644 lib/bb/tests/runqueue-tests/recipes/h1.bb
diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index ffb2d2849..539a6065f 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -730,6 +730,8 @@ class RunQueueData:
if mc == frommc:
fn = taskData[mcdep].build_targets[pn][0]
newdep = '%s:%s' % (fn,deptask)
+ if newdep not in taskData[mcdep].taskentries:
+ bb.fatal("Task mcdepends on non-existent task %s" % (newdep))
taskData[mc].taskentries[tid].tdepends.append(newdep)
for mc in taskData:
diff --git a/lib/bb/tests/runqueue-tests/recipes/g1.bb b/lib/bb/tests/runqueue-tests/recipes/g1.bb
new file mode 100644
index 000000000..3c7dca025
--- /dev/null
+++ b/lib/bb/tests/runqueue-tests/recipes/g1.bb
@@ -0,0 +1,2 @@
+do_build[mcdepends] = "mc::mc-1:h1:do_invalid"
+
diff --git a/lib/bb/tests/runqueue-tests/recipes/h1.bb b/lib/bb/tests/runqueue-tests/recipes/h1.bb
new file mode 100644
index 000000000..e69de29bb
diff --git a/lib/bb/tests/runqueue.py b/lib/bb/tests/runqueue.py
index cc87e8d6a..e15fdc330 100644
--- a/lib/bb/tests/runqueue.py
+++ b/lib/bb/tests/runqueue.py
@@ -314,6 +314,24 @@ class RunQueueTests(unittest.TestCase):
["mc_2:a1:%s" % t for t in rerun_tasks]
self.assertEqual(set(tasks), set(expected))
+ # AssertionError is raised by self.run_bitbakecmd in the event of a failure
+ # in thise case a failure is required, but we need to do further processing
+ # to tell if it's the RIGHT kind of failure.
+ with self.assertRaises(AssertionError):
+ try:
+ self.run_bitbakecmd(["bitbake", "g1"], tempdir, "", extraenv=extraenv, cleanup=True)
+ except AssertionError as e:
+ # If the word 'Traceback' or 'KeyError' is in the exception text,
+ # we've regressed. So verify it's NOT present, and pass the
+ # exception to indicate a 'pass'.
+ if not ('Traceback' in str(e) or 'KeyError' in str(e)):
+ # Raising 'AssertionError' is a test pass
+ raise e
+ else:
+ # Dump the output for triage, but don't raise an
+ # exception, this indicates a test failure.
+ print("%s: %s" % (type(e), e))
+
self.shutdown(tempdir)
def test_hashserv_single(self):
--
2.34.1
next reply other threads:[~2025-02-25 18:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 18:38 Mark Hatle [this message]
2025-02-27 12:29 ` [bitbake-devel] [PATCH v2] bitbake: runqueue: Verify mcdepends are valid Richard Purdie
2025-02-27 17:04 ` Mark Hatle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1740508733-4989-1-git-send-email-mark.hatle@kernel.crashing.org \
--to=mark.hatle@kernel.crashing.org \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.