testing/infra/builder: split configure() from build()
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>
This commit is contained in:
parent
b19cb8143b
commit
998300c5f5
@ -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")
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user