4d5d0124c7
Some upcoming test cases can use one or more br2-external trees as fixtures that provide packages used only in runtime tests. Add support for br2-external into the BRTest class. Any test case can then provide a list of paths for being used as br2-external trees during the build of the image to test. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br> Cc: Arnout Vandecappelle <arnout@mind.be> Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com> Signed-off-by: Daniel J. Leach <dleach@belcan.com> Signed-off-by: Adam Duskett <Aduskett@gmail.com> Tested-by: Matthew Weber <matthew.weber@rockwellcollins.com> [Thomas: use named argument for make_extra_opts.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
75 lines
2.2 KiB
Python
75 lines
2.2 KiB
Python
import unittest
|
|
import os
|
|
import datetime
|
|
|
|
from infra.builder import Builder
|
|
from infra.emulator import Emulator
|
|
|
|
BASIC_TOOLCHAIN_CONFIG = \
|
|
"""
|
|
BR2_arm=y
|
|
BR2_TOOLCHAIN_EXTERNAL=y
|
|
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
|
|
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
|
|
BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2017.05-1078-g95b1dae.tar.bz2"
|
|
BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
|
|
BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y
|
|
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
|
|
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
|
|
BR2_TOOLCHAIN_EXTERNAL_CXX=y
|
|
"""
|
|
|
|
MINIMAL_CONFIG = \
|
|
"""
|
|
BR2_INIT_NONE=y
|
|
BR2_SYSTEM_BIN_SH_NONE=y
|
|
# BR2_PACKAGE_BUSYBOX is not set
|
|
# BR2_TARGET_ROOTFS_TAR is not set
|
|
"""
|
|
|
|
|
|
class BRTest(unittest.TestCase):
|
|
config = None
|
|
br2_external = list()
|
|
downloaddir = None
|
|
outputdir = None
|
|
logtofile = True
|
|
keepbuilds = False
|
|
jlevel = 0
|
|
timeout_multiplier = 1
|
|
|
|
def __init__(self, names):
|
|
super(BRTest, self).__init__(names)
|
|
self.testname = self.__class__.__name__
|
|
self.builddir = self.outputdir and os.path.join(self.outputdir, self.testname)
|
|
self.emulator = None
|
|
self.config += '\nBR2_DL_DIR="{}"\n'.format(self.downloaddir)
|
|
self.config += "\nBR2_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")
|
|
self.b = Builder(self.config, self.builddir, self.logtofile)
|
|
|
|
if not self.keepbuilds:
|
|
self.b.delete()
|
|
|
|
if not self.b.is_finished():
|
|
self.show_msg("Building")
|
|
self.b.configure(make_extra_opts=["BR2_EXTERNAL={}".format(":".join(self.br2_external))])
|
|
self.b.build()
|
|
self.show_msg("Building done")
|
|
|
|
self.emulator = Emulator(self.builddir, self.downloaddir,
|
|
self.logtofile, self.timeout_multiplier)
|
|
|
|
def tearDown(self):
|
|
self.show_msg("Cleaning up")
|
|
if self.emulator:
|
|
self.emulator.stop()
|
|
if self.b and not self.keepbuilds:
|
|
self.b.delete()
|