testing/infra/builder: split configure() from build()
authorRicardo Martincoski <ricardo.martincoski@gmail.com>
Sun, 29 Oct 2017 14:06:01 +0000 (12:06 -0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sun, 1 Apr 2018 17:59:36 +0000 (19:59 +0200)
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@datacom.ind.br>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
support/testing/infra/basetest.py
support/testing/infra/builder.py

index b85e8627fdaef2d855fcb1988890108b6145281b..f3f13ad97f93515543816e1547780d01933de713 100644 (file)
@@ -58,6 +58,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")
 
index 36f4801a2db2924837c6f60adf1194709f4f7795..faf1eb1494f6265f30f354853786b2ebcef86964 100644 (file)
@@ -12,7 +12,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)
 
@@ -33,6 +33,8 @@ class Builder(object):
         if ret != 0:
             raise SystemError("Cannot olddefconfig")
 
+    def build(self):
+        env = {"PATH": os.environ["PATH"]}
         cmd = ["make", "-C", self.builddir]
         ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile,
                               env=env)