[Concept,01/14] test/py: Support a timing report when max_count is 0

Message ID 20250820144621.1073679-2-sjg@u-boot.org
State New
Headers
Series efi: app: Support booting an OS |

Commit Message

Simon Glass Aug. 20, 2025, 2:46 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

If only a single test runs, it does not set the max_count variable, so
it remains as zero. Handle this situation as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/py/conftest.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Patch

diff --git a/test/py/conftest.py b/test/py/conftest.py
index f0101ed6b3d..2baceda51b2 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -579,7 +579,10 @@  def show_timings():
             value (int): Value to display, i.e. the relative length of the bar
         """
         if value:
-            bar_length = int((value / max_count) * max_bar_length)
+            if max_count:
+                bar_length = int((value / max_count) * max_bar_length)
+            else:
+                bar_length = 1
             print(f"{key:>8} : {get_time_delta(msecs):>7}  |{'#' * bar_length} {value}", file=buf)
 
     # Create the buckets we will use, each has a count and a total time