[Buildroot] [next v2 1/7] testing/infra/builder: split configure() from build()

Ricardo Martincoski ricardo.martincoski at gmail.com
Sat Aug 26 22:20:50 UTC 2017


From: Ricardo Martincoski <ricardo.martincoski at datacom.ind.br>

Some test cases don't use a full build as setup, so split the build()
method into configure() and build().
It allows a test case to perform configuration at the setup stage and
the build inside the test itself.

Call this new method just before build in the BRTest base class, to keep
the current behavior for existing test cases.

This change will be needed when adding a common class to test the git
download infra.

Signed-off-by: Ricardo Martincoski <ricardo.martincoski at datacom.ind.br>
---
Changes v1 -> v2:
  - new patch to adapt the test infra to test git download
---
 support/testing/infra/basetest.py | 1 +
 support/testing/infra/builder.py  | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py
index 431605b23f..d61f4d337b 100644
--- a/support/testing/infra/basetest.py
+++ b/support/testing/infra/basetest.py
@@ -57,6 +57,7 @@ class BRTest(unittest.TestCase):
 
         if not self.b.is_finished():
             self.show_msg("Building")
+            self.b.configure()
             self.b.build()
             self.show_msg("Building done")
 
diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py
index 905b127c91..e7c8e0102c 100644
--- a/support/testing/infra/builder.py
+++ b/support/testing/infra/builder.py
@@ -10,7 +10,7 @@ class Builder(object):
         self.builddir = builddir
         self.logfile = infra.open_log_file(builddir, "build", logtofile)
 
-    def build(self):
+    def configure(self):
         if not os.path.isdir(self.builddir):
             os.makedirs(self.builddir)
 
@@ -29,6 +29,7 @@ class Builder(object):
         if ret != 0:
             raise SystemError("Cannot olddefconfig")
 
+    def build(self):
         cmd = ["make", "-C", self.builddir]
         ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile)
         if ret != 0:
-- 
2.13.0



More information about the buildroot mailing list