[U-Boot] [PATCH v9 07/14] buildman: Set the return code to indicate build result

Simon Glass sjg at chromium.org
Mon Aug 25 17:58:28 CEST 2014


When buildman finds errors/warnings when building, set the return code to
indicate this.

Suggested-by: York Sun <yorksun at freescale.com>
Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v9:
- Add new patch to set the return code to indicate build result

Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None

 tools/buildman/README      | 6 ++++++
 tools/buildman/builder.py  | 5 +++++
 tools/buildman/buildman.py | 3 ++-
 tools/buildman/control.py  | 9 +++++++--
 4 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index d4e8404..d20508f 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -690,6 +690,12 @@ Other options
 
 Buildman has various other command line options. Try --help to see them.
 
+When doing builds, Buildman's return code will reflect the overall result:
+
+    0 (success)     No errors or warnings found
+    128             Errors found
+    129             Warnings found
+
 
 How to change from MAKEALL
 ==========================
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index a555bd8..106fde0 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -1031,6 +1031,10 @@ class Builder:
                     value is Board object
             keep_outputs: True to save build output files
             verbose: Display build results as they are completed
+        Returns:
+            Tuple containing:
+                - number of boards that failed to build
+                - number of boards that issued warnings
         """
         self.commit_count = len(commits) if commits else 1
         self.commits = commits
@@ -1060,3 +1064,4 @@ class Builder:
         self.out_queue.join()
         print
         self.ClearLine(0)
+        return (self.fail, self.warned)
diff --git a/tools/buildman/buildman.py b/tools/buildman/buildman.py
index e18859b..fbd3125 100755
--- a/tools/buildman/buildman.py
+++ b/tools/buildman/buildman.py
@@ -136,4 +136,5 @@ elif options.full_help:
 
 # Build selected commits for selected boards
 else:
-    control.DoBuildman(options, args)
+    ret_code = control.DoBuildman(options, args)
+    sys.exit(ret_code)
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index d98e50a..239c423 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -94,7 +94,7 @@ def DoBuildman(options, args):
     if options.list_tool_chains:
         toolchains.List()
         print
-        return
+        return 0
 
     # Work out how many commits to build. We want to build everything on the
     # branch. We also build the upstream commit as a control so we can see
@@ -219,5 +219,10 @@ def DoBuildman(options, args):
                 options.show_detail = True
             builder.ShowSummary(commits, board_selected)
         else:
-            builder.BuildBoards(commits, board_selected,
+            fail, warned = builder.BuildBoards(commits, board_selected,
                                 options.keep_outputs, options.verbose)
+            if fail:
+                return 128
+            elif warned:
+                return 129
+    return 0
-- 
2.1.0.rc2.206.gedb03e5



More information about the U-Boot mailing list