support/testing: allow to indent ccache defconfig fragment
authorRicardo Martincoski <ricardo.martincoski@gmail.com>
Thu, 5 Oct 2017 21:42:07 +0000 (18:42 -0300)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Fri, 6 Oct 2017 16:53:13 +0000 (18:53 +0200)
Move the strip out of leading spaces in defconfig fragments from the
BRTest class to the Builder class. It actually postpones the strip out,
consequentially allowing test cases to post-process the defconfig in
their own __init__ before calling the __init__ method from BRTest.

Moving this code to the Builder class also allows any new test class
that inherits from BRTest to reuse the same code even if the new class
overrides the setUp method.

At same time, prepend a newline to the jlevel handling otherwise it
would stop working for defconfig fragments that don't end in a newline.

Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
support/testing/infra/basetest.py
support/testing/infra/builder.py

index 493dea5125d29f43ad13235531674debc3efb88c..d6fcc619b1f26d19101a6c631a45bd773f0bbeae 100644 (file)
@@ -42,9 +42,7 @@ class BRTest(unittest.TestCase):
         self.testname = self.__class__.__name__
         self.builddir = self.outputdir and os.path.join(self.outputdir, self.testname)
         self.emulator = None
-        self.config = '\n'.join([line.lstrip() for line in
-                                 self.config.splitlines()]) + '\n'
-        self.config += "BR2_JLEVEL={}\n".format(self.jlevel)
+        self.config += "\nBR2_JLEVEL={}\n".format(self.jlevel)
 
     def show_msg(self, msg):
         print "{} {:40s} {}".format(datetime.datetime.now().strftime("%H:%M:%S"),
index 905b127c91d7145ac2ff543fa7e4314b54211f6e..ef66b861137f6bef7ab462b3774b6e7685bbce9b 100644 (file)
@@ -6,7 +6,8 @@ import infra
 
 class Builder(object):
     def __init__(self, config, builddir, logtofile):
-        self.config = config
+        self.config = '\n'.join([line.lstrip() for line in
+                                 config.splitlines()]) + '\n'
         self.builddir = builddir
         self.logfile = infra.open_log_file(builddir, "build", logtofile)