diff options
author | Mark Hatle <mark.hatle@amd.com> | 2025-07-29 14:43:08 -0400 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2025-08-04 07:55:06 -0700 |
commit | bfb799ef2a961898ad43a5803ce75d2fdb9d6c0b (patch) | |
tree | ec814b7003dcca51f6aa5fbc839bd120e6029f42 | |
parent | e711b2f39a94879812e5d7f721018f911f25ce38 (diff) | |
download | poky-bfb799ef2a961898ad43a5803ce75d2fdb9d6c0b.tar.gz |
bitbake: bitbake: runqueue: Verify mcdepends are valid
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.
[RP: Reworked test case to simplify and improve code]
(Bitbake rev: 9f6f049870e0ec829e171fe91ec8f7a092ddd2ab)
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/runqueue-tests/recipes/g1.bb | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/runqueue-tests/recipes/h1.bb | 0 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/runqueue.py | 11 |
4 files changed, 14 insertions, 1 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 439da2bb44..db68f97e68 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -729,6 +729,8 @@ class RunQueueData: | |||
729 | if mc == frommc: | 729 | if mc == frommc: |
730 | fn = taskData[mcdep].build_targets[pn][0] | 730 | fn = taskData[mcdep].build_targets[pn][0] |
731 | newdep = '%s:%s' % (fn,deptask) | 731 | newdep = '%s:%s' % (fn,deptask) |
732 | if newdep not in taskData[mcdep].taskentries: | ||
733 | bb.fatal("Task mcdepends on non-existent task %s" % (newdep)) | ||
732 | taskData[mc].taskentries[tid].tdepends.append(newdep) | 734 | taskData[mc].taskentries[tid].tdepends.append(newdep) |
733 | 735 | ||
734 | for mc in taskData: | 736 | for mc in taskData: |
diff --git a/bitbake/lib/bb/tests/runqueue-tests/recipes/g1.bb b/bitbake/lib/bb/tests/runqueue-tests/recipes/g1.bb new file mode 100644 index 0000000000..3c7dca0257 --- /dev/null +++ b/bitbake/lib/bb/tests/runqueue-tests/recipes/g1.bb | |||
@@ -0,0 +1,2 @@ | |||
1 | do_build[mcdepends] = "mc::mc-1:h1:do_invalid" | ||
2 | |||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/recipes/h1.bb b/bitbake/lib/bb/tests/runqueue-tests/recipes/h1.bb new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/bitbake/lib/bb/tests/runqueue-tests/recipes/h1.bb | |||
diff --git a/bitbake/lib/bb/tests/runqueue.py b/bitbake/lib/bb/tests/runqueue.py index cc87e8d6a8..74f5ded2e6 100644 --- a/bitbake/lib/bb/tests/runqueue.py +++ b/bitbake/lib/bb/tests/runqueue.py | |||
@@ -26,7 +26,7 @@ class RunQueueTests(unittest.TestCase): | |||
26 | a1_sstatevalid = "a1:do_package a1:do_package_qa a1:do_packagedata a1:do_package_write_ipk a1:do_package_write_rpm a1:do_populate_lic a1:do_populate_sysroot" | 26 | a1_sstatevalid = "a1:do_package a1:do_package_qa a1:do_packagedata a1:do_package_write_ipk a1:do_package_write_rpm a1:do_populate_lic a1:do_populate_sysroot" |
27 | b1_sstatevalid = "b1:do_package b1:do_package_qa b1:do_packagedata b1:do_package_write_ipk b1:do_package_write_rpm b1:do_populate_lic b1:do_populate_sysroot" | 27 | b1_sstatevalid = "b1:do_package b1:do_package_qa b1:do_packagedata b1:do_package_write_ipk b1:do_package_write_rpm b1:do_populate_lic b1:do_populate_sysroot" |
28 | 28 | ||
29 | def run_bitbakecmd(self, cmd, builddir, sstatevalid="", slowtasks="", extraenv=None, cleanup=False): | 29 | def run_bitbakecmd(self, cmd, builddir, sstatevalid="", slowtasks="", extraenv=None, cleanup=False, allowfailure=False): |
30 | env = os.environ.copy() | 30 | env = os.environ.copy() |
31 | env["BBPATH"] = os.path.realpath(os.path.join(os.path.dirname(__file__), "runqueue-tests")) | 31 | env["BBPATH"] = os.path.realpath(os.path.join(os.path.dirname(__file__), "runqueue-tests")) |
32 | env["BB_ENV_PASSTHROUGH_ADDITIONS"] = "SSTATEVALID SLOWTASKS TOPDIR" | 32 | env["BB_ENV_PASSTHROUGH_ADDITIONS"] = "SSTATEVALID SLOWTASKS TOPDIR" |
@@ -41,6 +41,8 @@ class RunQueueTests(unittest.TestCase): | |||
41 | output = subprocess.check_output(cmd, env=env, stderr=subprocess.STDOUT,universal_newlines=True, cwd=builddir) | 41 | output = subprocess.check_output(cmd, env=env, stderr=subprocess.STDOUT,universal_newlines=True, cwd=builddir) |
42 | print(output) | 42 | print(output) |
43 | except subprocess.CalledProcessError as e: | 43 | except subprocess.CalledProcessError as e: |
44 | if allowfailure: | ||
45 | return e.output | ||
44 | self.fail("Command %s failed with %s" % (cmd, e.output)) | 46 | self.fail("Command %s failed with %s" % (cmd, e.output)) |
45 | tasks = [] | 47 | tasks = [] |
46 | tasklog = builddir + "/task.log" | 48 | tasklog = builddir + "/task.log" |
@@ -314,6 +316,13 @@ class RunQueueTests(unittest.TestCase): | |||
314 | ["mc_2:a1:%s" % t for t in rerun_tasks] | 316 | ["mc_2:a1:%s" % t for t in rerun_tasks] |
315 | self.assertEqual(set(tasks), set(expected)) | 317 | self.assertEqual(set(tasks), set(expected)) |
316 | 318 | ||
319 | # Check that a multiconfig that doesn't exist rasies a correct error message | ||
320 | error_output = self.run_bitbakecmd(["bitbake", "g1"], tempdir, "", extraenv=extraenv, cleanup=True, allowfailure=True) | ||
321 | self.assertIn("non-existent task", error_output) | ||
322 | # If the word 'Traceback' or 'KeyError' is in the output we've regressed | ||
323 | self.assertNotIn("Traceback", error_output) | ||
324 | self.assertNotIn("KeyError", error_output) | ||
325 | |||
317 | self.shutdown(tempdir) | 326 | self.shutdown(tempdir) |
318 | 327 | ||
319 | def test_hashserv_single(self): | 328 | def test_hashserv_single(self): |