diff mbox series

[v2,20/28] buildman: Show a summary of the build result

Message ID 20200409150840.v2.20.Ib67b1b74e8bc38990eac6aefbf1174812e060346@changeid
State Accepted
Commit 7b33f21804437bedc5cb2b58cff7706a514c0f57
Headers show
Series buildman: Improve summary output | expand

Commit Message

Simon Glass April 9, 2020, 9:08 p.m. UTC
When buildman finishes it leaves the last summary line visible, which
shows the number of successful builds, builds with warnings and builds
with errors.

It is useful also to see how many builds were done in total along with
the time taken. Show these on a separate line before buildman finishes.

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

---

Changes in v2: None

 tools/buildman/builder.py | 17 +++++++++++++++++
 tools/buildman/test.py    |  6 +++---
 2 files changed, 20 insertions(+), 3 deletions(-)

Comments

Simon Glass April 17, 2020, 11:29 p.m. UTC | #1
When buildman finishes it leaves the last summary line visible, which
shows the number of successful builds, builds with warnings and builds
with errors.

It is useful also to see how many builds were done in total along with
the time taken. Show these on a separate line before buildman finishes.

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

---

Changes in v2: None

 tools/buildman/builder.py | 17 +++++++++++++++++
 tools/buildman/test.py    |  6 +++---
 2 files changed, 20 insertions(+), 3 deletions(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 73753eb4bc9..6819e5b40da 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -192,6 +192,7 @@  class Builder:
         _next_delay_update: Next time we plan to display a progress update
                 (datatime)
         _show_unknown: Show unknown boards (those not built) in summary
+        _start_time: Start time for the build
         _timestamps: List of timestamps for the completion of the last
             last _timestamp_count builds. Each is a datetime object.
         _timestamp_count: Number of timestamps to keep in our list.
@@ -281,6 +282,7 @@  class Builder:
         self._build_period_us = None
         self._complete_delay = None
         self._next_delay_update = datetime.now()
+        self._start_time = datetime.now()
         self.force_config_on_failure = True
         self.force_build_failures = False
         self.force_reconfig = False
@@ -1642,4 +1644,19 @@  class Builder:
         # Wait until we have processed all output
         self.out_queue.join()
         Print()
+
+        msg = 'Completed: %d total built' % self.count
+        if self.already_done:
+           msg += ' (%d previously' % self.already_done
+           if self.already_done != self.count:
+               msg += ', %d newly' % (self.count - self.already_done)
+           msg += ')'
+        duration = datetime.now() - self._start_time
+        if duration > timedelta(microseconds=1000000):
+            if duration.microseconds >= 500000:
+                duration = duration + timedelta(seconds=1)
+            duration = duration - timedelta(microseconds=duration.microseconds)
+            msg += ', duration %s' % duration
+        Print(msg)
+
         return (self.fail, self.warned)
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index a495df03036..fb861e16a1b 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -205,9 +205,9 @@  class TestBuild(unittest.TestCase):
             if line.text.strip():
                 count += 1
 
-        # We should get two starting messages, then an update for every commit
-        # built.
-        self.assertEqual(count, len(commits) * len(boards) + 2)
+        # We should get two starting messages, an update for every commit built
+        # and a summary message
+        self.assertEqual(count, len(commits) * len(boards) + 3)
         build.SetDisplayOptions(**kwdisplay_args);
         build.ShowSummary(self.commits, board_selected)
         if echo_lines: