diff mbox series

[v3,06/23] buildman: Allow ignoring warnings in the return code

Message ID 20200318154302.16389-4-sjg@chromium.org
State Accepted
Commit 7beb43c9807159463ad6dd2a29517d4cee1e7478
Headers show
Series gitlab: Simplify the test script | expand

Commit Message

Simon Glass March 18, 2020, 3:42 p.m. UTC
Sometimes we don't want buildman to return failure if it seems warnings.
Add a -W option to support this. If buildman detects warnings (and no
errors) it will return an exit code of 0 (success).

Note that the definition of 'warnings' includes the migration warnings
produced by U-Boot, such as:

    ===================== WARNING ======================
    This board does not use CONFIG_DM_MMC. Please update
    ...
    ====================================================

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

Changes in v3:
- Add more documentation on -W and the interaction with -E
- Expand the commit message

Changes in v2: None

 tools/buildman/README     | 20 ++++++++++++++++++--
 tools/buildman/cmdline.py |  2 ++
 tools/buildman/control.py |  2 +-
 3 files changed, 21 insertions(+), 3 deletions(-)

Comments

Tom Rini March 23, 2020, 1:12 p.m. UTC | #1
On Wed, Mar 18, 2020 at 09:42:44AM -0600, Simon Glass wrote:

> Sometimes we don't want buildman to return failure if it seems warnings.
> Add a -W option to support this. If buildman detects warnings (and no
> errors) it will return an exit code of 0 (success).
> 
> Note that the definition of 'warnings' includes the migration warnings
> produced by U-Boot, such as:
> 
>     ===================== WARNING ======================
>     This board does not use CONFIG_DM_MMC. Please update
>     ...
>     ====================================================
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>

Reviewed-by: Tom Rini <trini at konsulko.com>
diff mbox series

Patch

diff --git a/tools/buildman/README b/tools/buildman/README
index abbbbea9f2..116a0ee545 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -1070,16 +1070,32 @@  This will write the full build into /tmp/build including object files.
 Other options
 =============
 
-Buildman has various other command line options. Try --help to see them.
+Buildman has various other command-line options. Try --help to see them.
 
 To find out what architecture or toolchain prefix buildman will use for a build,
 see the -a and -A options.
 
+To request that compiler warnings be promoted to errors, use -E. This passes the
+-Werror flag to the compiler. Note that the build can still produce warnings
+with -E, e.g. the migration warnings:
+
+        ===================== WARNING ======================
+        This board does not use CONFIG_DM_MMC. Please update
+        ...
+        ====================================================
+
 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
+    129             Warnings found (only if no -W)
+
+You can use -W to tell Buildman to return 0 (success) instead of 129 when
+warnings are found. Note that it can be useful to combine -E and -W. This means
+that all compiler warnings will produce failures (code 128) and all other
+warnings will produce success (since 129 is changed to 0).
+
+If there are both warnings and errors, errors win, so buildman returns 128.
 
 
 How to change from MAKEALL
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 74b410010d..f387aeb1cf 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -108,6 +108,8 @@  def ParseArgs():
           default=False, help='Run make with V=1, logging all output')
     parser.add_option('-w', '--work-in-output', action='store_true',
           default=False, help='Use the output directory as the work directory')
+    parser.add_option('-W', '--ignore-warnings', action='store_true',
+          default=False, help='Return success even if there are warnings')
     parser.add_option('-x', '--exclude', dest='exclude',
           type='string', action='append',
           help='Specify a list of boards to exclude, separated by comma')
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index 5d80400f7a..ded4360250 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -386,6 +386,6 @@  def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
                                 options.keep_outputs, options.verbose)
             if fail:
                 return 128
-            elif warned:
+            elif warned and not options.ignore_warnings:
                 return 129
     return 0