diff mbox series

[2/6] runqueue: fix init of RunQueueScheduler.prio_map; add test for 'basic' scheduler

Message ID 20260825194549.152553-2-chris.laplante@agilent.com
State New
Headers show
Series [1/6] data_smart: use Pattern.search instead of findall, to match comment | expand

Commit Message

chris.laplante@agilent.com Aug. 25, 2026, 7:45 p.m. UTC
From: Chris Laplante <chris.laplante@agilent.com>

Before this patch, RunQueueScheduler.prio_map was incorrectly
initialized as a list with a single element, the dictionary keys view.

It broke like so:

ERROR: An uncaught exception occurred in runqueue
Traceback (most recent call last):
  File "/home/laplante/repos/bitbake/lib/bb/runqueue.py", line 1663, in execute_runqueue
    return self._execute_runqueue()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/laplante/repos/bitbake/lib/bb/runqueue.py", line 1629, in _execute_runqueue
    retval = self.rqexe.execute()
             ^^^^^^^^^^^^^^^^^^^^
  File "/home/laplante/repos/bitbake/lib/bb/runqueue.py", line 2357, in execute
    task = self.sched.next()
           ^^^^^^^^^^^^^^^^^
  File "/home/laplante/repos/bitbake/lib/bb/runqueue.py", line 308, in next
    return self.next_buildable_task()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/laplante/repos/bitbake/lib/bb/runqueue.py", line 285, in next_buildable_task
    self.rev_prio_map[tid] = self.prio_map.index(tid)
                             ^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: '/home/laplante/repos/bitbake/lib/bb/tests/runqueue-tests/recipes/a1.bb:do_fetch' is not in list

The other schedulers don't have this problem because they overwrite
prio_map.

AI-Generated: GPT-5.6 Sol

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
 lib/bb/runqueue.py       | 2 +-
 lib/bb/tests/runqueue.py | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 544081053..c2e6561ec 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -154,7 +154,7 @@  class RunQueueScheduler(object):
         self.rqdata = rqdata
         self.numTasks = len(self.rqdata.runtaskentries)
 
-        self.prio_map = [self.rqdata.runtaskentries.keys()]
+        self.prio_map = list(self.rqdata.runtaskentries.keys())
 
         self.buildable = set()
         self.skip_maxthread = {}
diff --git a/lib/bb/tests/runqueue.py b/lib/bb/tests/runqueue.py
index 74f5ded2e..42c02cd15 100644
--- a/lib/bb/tests/runqueue.py
+++ b/lib/bb/tests/runqueue.py
@@ -63,6 +63,15 @@  class RunQueueTests(unittest.TestCase):
 
             self.shutdown(tempdir)
 
+    def test_basic_scheduler(self):
+        with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir:
+            cmd = ["bitbake", "a1"]
+            tasks = self.run_bitbakecmd(cmd, tempdir, extraenv={"BB_SCHEDULER": "basic"})
+            expected = ['a1:' + task for task in self.alltasks]
+            self.assertEqual(set(tasks), set(expected))
+
+            self.shutdown(tempdir)
+
     def test_single_setscenevalid(self):
         with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir:
             cmd = ["bitbake", "a1"]