diff mbox series

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

Message ID 20200315234303.18598-4-sjg@chromium.org
State New
Headers show
Series gitlab: Simplify the test script | expand

Commit Message

Simon Glass March 15, 2020, 11:42 p.m. UTC
Sometimes we don't want to get an error with warnings. Add a -W option to
support this. If buildman detects warnings (and no error) it will return
an exit code of 0 (success).

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

Changes in v2: None

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

Comments

Tom Rini March 16, 2020, 8:50 p.m. UTC | #1
On Sun, Mar 15, 2020 at 05:42:46PM -0600, Simon Glass wrote:

> Sometimes we don't want to get an error with warnings. Add a -W option to
> support this. If buildman detects warnings (and no error) it will return
> an exit code of 0 (success).
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
> Changes in v2: None
> 
>  tools/buildman/README     | 2 +-
>  tools/buildman/cmdline.py | 2 ++
>  tools/buildman/control.py | 2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/buildman/README b/tools/buildman/README
> index abbbbea9f2..87bd8ee9d7 100644
> --- a/tools/buildman/README
> +++ b/tools/buildman/README
> @@ -1079,7 +1079,7 @@ 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 (use -W to return 0 in this case)
>  
>  
>  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

What's the use-case for this?  Thanks!
Simon Glass March 17, 2020, 4:11 p.m. UTC | #2
Hi Tom,

On Mon, 16 Mar 2020 at 14:50, Tom Rini <trini at konsulko.com> wrote:
>
> On Sun, Mar 15, 2020 at 05:42:46PM -0600, Simon Glass wrote:
>
> > Sometimes we don't want to get an error with warnings. Add a -W option to
> > support this. If buildman detects warnings (and no error) it will return
> > an exit code of 0 (success).
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > Changes in v2: None
> >
> >  tools/buildman/README     | 2 +-
> >  tools/buildman/cmdline.py | 2 ++
> >  tools/buildman/control.py | 2 +-
> >  3 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/buildman/README b/tools/buildman/README
> > index abbbbea9f2..87bd8ee9d7 100644
> > --- a/tools/buildman/README
> > +++ b/tools/buildman/README
> > @@ -1079,7 +1079,7 @@ 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 (use -W to return 0 in this case)
> >
> >
> >  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
>
> What's the use-case for this?  Thanks!

You can see in the later commit that uses it. At present buildman
returns 129 if it gets a warning (e.g. the Makefile migration
warnings). This fixes that.

Regards,
Simon
diff mbox series

Patch

diff --git a/tools/buildman/README b/tools/buildman/README
index abbbbea9f2..87bd8ee9d7 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -1079,7 +1079,7 @@  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 (use -W to return 0 in this case)
 
 
 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