Add a test for resulttool.durations.build_rows(), covering suppression
of delta/percentage reporting when durations round to zero. Times are
reported in seconds and fractional times can be calculated, so we
don't want to show (for example) RUN1 = RUN2 = 0 but a large delta
because one run was many fractions of a second faster.

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

diff --git a/meta/lib/oeqa/selftest/cases/resulttooltests.py 
b/meta/lib/oeqa/selftest/cases/resulttooltests.py
index b3c6f3329b..dfaa4edbba 100644
--- a/meta/lib/oeqa/selftest/cases/resulttooltests.py
+++ b/meta/lib/oeqa/selftest/cases/resulttooltests.py
@@ -730,3 +730,15 @@ class ResultToolTests(OESelftestTestCase):
         self.assertEqual(parsed[section]['timedout-suite'], 30.0)
         # the status-summary table above (percentages, not a Time(s) table) 
must not be picked up
         self.assertNotIn('someresultid', str(parsed))
+
+    def 
test_durations_build_rows_suppresses_pct_when_both_runs_round_to_zero(self):
+        alldurations = [
+            {'path': {'tiny': 0.2, 'big': 100.0}},
+            {'path': {'tiny': 0.4, 'big': 150.0}},
+        ]
+        rows = durations.build_rows(['tiny', 'big'], 'path', alldurations)
+        rowmap = {k: deltas for k, vals, deltas in rows}
+        # both runs round to 0s: no meaningful percentage to report
+        self.assertEqual(rowmap['tiny'], [(0.2, None)])
+        # normal case: delta and percentage both reported
+        self.assertEqual(rowmap['big'], [(50.0, 50.0)])
-- 
2.55.0

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

Reply via email to