Add a test for resulttool.durations.filter_sort_rows(), ensuring the
'-l/--limit' option applies after '-s/--sort-by-delta', truncating the
already-sorted rows rather than sorting a truncated set.

AI-Generated: Uses Claude Sonnet 5
---
 meta/lib/oeqa/selftest/cases/resulttooltests.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/resulttooltests.py 
b/meta/lib/oeqa/selftest/cases/resulttooltests.py
index 886c5bb3ed..d45213b5b4 100644
--- a/meta/lib/oeqa/selftest/cases/resulttooltests.py
+++ b/meta/lib/oeqa/selftest/cases/resulttooltests.py
@@ -798,3 +798,13 @@ class ResultToolTests(OESelftestTestCase):
         args = SimpleNamespace(threshold=0.0, sort_by_delta=True, limit=0)
         ordered = [k for k, vals, deltas in durations.filter_sort_rows(rows, 
args)]
         self.assertEqual(ordered, ['big', 'medium', 'small'])
+
+    def test_durations_filter_sort_rows_limit_applies_after_sort(self):
+        rows = [
+            ('small', [10.0, 11.0], [(1.0, 10.0)]),
+            ('big', [10.0, 30.0], [(20.0, 200.0)]),
+            ('medium', [10.0, 15.0], [(5.0, 50.0)]),
+        ]
+        args = SimpleNamespace(threshold=0.0, sort_by_delta=True, limit=2)
+        ordered = [k for k, vals, deltas in durations.filter_sort_rows(rows, 
args)]
+        self.assertEqual(ordered, ['big', 'medium'])
-- 
2.55.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#246551): 
https://lists.openembedded.org/g/openembedded-core/message/246551
Mute This Topic: https://lists.openembedded.org/mt/121399158/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to