diff mbox

[4/4] testing/infra/basetest: move jlevel logic to constructor

Message ID 20170723042019.10323-4-ricardo.martincoski@gmail.com
State Changes Requested
Headers show

Commit Message

Ricardo Martincoski July 23, 2017, 4:20 a.m. UTC
As suggested by Arnout in [1].

While at it, simplify the logic by always appending the BR2_JLEVEL and
defaulting to 0 (the value copied from Config.in is used for 5 years now
and is very unlikely to change).

[1] http://patchwork.ozlabs.org/patch/790525/

Suggested-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
---
tip for git send-email:
Cc: Arnout Vandecappelle <arnout@mind.be>
---
 support/testing/infra/basetest.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Yann E. MORIN July 23, 2017, 9:20 a.m. UTC | #1
Ricardo, all,

On 2017-07-23 01:20 -0300, Ricardo Martincoski spake thusly:
> As suggested by Arnout in [1].
> 
> While at it, simplify the logic by always appending the BR2_JLEVEL and
> defaulting to 0 (the value copied from Config.in is used for 5 years now
> and is very unlikely to change).
> 
> [1] http://patchwork.ozlabs.org/patch/790525/
> 
> Suggested-by: Arnout Vandecappelle <arnout@mind.be>
> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
> ---
> tip for git send-email:
> Cc: Arnout Vandecappelle <arnout@mind.be>

You can (and should) leave that one below you SoB line, not after the
'---' line, because it is important that it is recorded as part of the
commit log.

It is not a problem that Arnout (or whoever) is named twice in a tag.

Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  support/testing/infra/basetest.py | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py
> index 29e7872572..431605b23f 100644
> --- a/support/testing/infra/basetest.py
> +++ b/support/testing/infra/basetest.py
> @@ -34,7 +34,7 @@ class BRTest(unittest.TestCase):
>      outputdir = None
>      logtofile = True
>      keepbuilds = False
> -    jlevel = None
> +    jlevel = 0
>  
>      def __init__(self, names):
>          super(BRTest, self).__init__(names)
> @@ -43,16 +43,14 @@ class BRTest(unittest.TestCase):
>          self.emulator = None
>          self.config = '\n'.join([line.lstrip() for line in
>                                   self.config.splitlines()]) + '\n'
> +        self.config += "BR2_JLEVEL={}\n".format(self.jlevel)
>  
>      def show_msg(self, msg):
>          print "{} {:40s} {}".format(datetime.datetime.now().strftime("%H:%M:%S"),
>                                      self.testname, msg)
>      def setUp(self):
>          self.show_msg("Starting")
> -        config = self.config
> -        if self.jlevel:
> -            config += "BR2_JLEVEL={}\n".format(self.jlevel)
> -        self.b = Builder(config, self.builddir, self.logtofile)
> +        self.b = Builder(self.config, self.builddir, self.logtofile)
>  
>          if not self.keepbuilds:
>              self.b.delete()
> -- 
> 2.13.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
diff mbox

Patch

diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py
index 29e7872572..431605b23f 100644
--- a/support/testing/infra/basetest.py
+++ b/support/testing/infra/basetest.py
@@ -34,7 +34,7 @@  class BRTest(unittest.TestCase):
     outputdir = None
     logtofile = True
     keepbuilds = False
-    jlevel = None
+    jlevel = 0
 
     def __init__(self, names):
         super(BRTest, self).__init__(names)
@@ -43,16 +43,14 @@  class BRTest(unittest.TestCase):
         self.emulator = None
         self.config = '\n'.join([line.lstrip() for line in
                                  self.config.splitlines()]) + '\n'
+        self.config += "BR2_JLEVEL={}\n".format(self.jlevel)
 
     def show_msg(self, msg):
         print "{} {:40s} {}".format(datetime.datetime.now().strftime("%H:%M:%S"),
                                     self.testname, msg)
     def setUp(self):
         self.show_msg("Starting")
-        config = self.config
-        if self.jlevel:
-            config += "BR2_JLEVEL={}\n".format(self.jlevel)
-        self.b = Builder(config, self.builddir, self.logtofile)
+        self.b = Builder(self.config, self.builddir, self.logtofile)
 
         if not self.keepbuilds:
             self.b.delete()