Update buildroot & docker (#25)
* Update docker & buildroot * Fix * fix versions
This commit is contained in:
@@ -42,6 +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 += '\nBR2_DL_DIR="{}"\n'.format(self.downloaddir)
|
||||
self.config += "\nBR2_JLEVEL={}\n".format(self.jlevel)
|
||||
|
||||
def show_msg(self, msg):
|
||||
@@ -57,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)
|
||||
|
||||
@@ -24,15 +24,20 @@ class Builder(object):
|
||||
"> end defconfig\n")
|
||||
self.logfile.flush()
|
||||
|
||||
env = {"PATH": os.environ["PATH"]}
|
||||
cmd = ["make",
|
||||
"O={}".format(self.builddir),
|
||||
"olddefconfig"]
|
||||
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile)
|
||||
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile,
|
||||
env=env)
|
||||
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)
|
||||
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile,
|
||||
env=env)
|
||||
if ret != 0:
|
||||
raise SystemError("Build failed")
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ def main():
|
||||
return 1
|
||||
|
||||
BRTest.downloaddir = os.path.abspath(args.download)
|
||||
os.putenv("BR2_DL_DIR", BRTest.downloaddir)
|
||||
|
||||
if args.output is None:
|
||||
print "Missing output directory, please use -o/--output"
|
||||
|
||||
@@ -10,7 +10,7 @@ class TestATFVexpress(infra.basetest.BRTest):
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL="https://github.com/ARM-software/arm-trusted-firmware.git"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION="v1.2"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION="v1.5"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="juno"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33=y
|
||||
@@ -63,7 +63,7 @@ class TestATFMarvell(infra.basetest.BRTest):
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL="https://github.com/MarvellEmbeddedProcessors/atf-marvell.git"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION="atf-v1.3-armada-17.10"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION="43965481990fd92e9666cf9371a8cf478055ec7c"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="a80x0_mcbin"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33=y
|
||||
|
||||
@@ -18,17 +18,17 @@ class TestPostScripts(infra.basetest.BRTest):
|
||||
infra.filepath("tests/core/post-fakeroot.sh"),
|
||||
infra.filepath("tests/core/post-image.sh"))
|
||||
|
||||
def check_post_log_file(self, path, what):
|
||||
def check_post_log_file(self, f, what, target_dir):
|
||||
lines = {}
|
||||
with open(path, 'rb') as csvfile:
|
||||
with open(os.path.join(self.builddir, "build", f), 'rb') as csvfile:
|
||||
r = csv.reader(csvfile, delimiter=',')
|
||||
for row in r:
|
||||
lines[row[0]] = row[1]
|
||||
|
||||
self.assertEqual(lines["arg1"], os.path.join(self.builddir, what))
|
||||
self.assertEqual(lines["arg1"], what)
|
||||
self.assertEqual(lines["arg2"], "foobar")
|
||||
self.assertEqual(lines["arg3"], "baz")
|
||||
self.assertEqual(lines["TARGET_DIR"], os.path.join(self.builddir, "target"))
|
||||
self.assertEqual(lines["TARGET_DIR"], target_dir)
|
||||
self.assertEqual(lines["BUILD_DIR"], os.path.join(self.builddir, "build"))
|
||||
self.assertEqual(lines["HOST_DIR"], os.path.join(self.builddir, "host"))
|
||||
staging = os.readlink(os.path.join(self.builddir, "staging"))
|
||||
@@ -37,9 +37,12 @@ class TestPostScripts(infra.basetest.BRTest):
|
||||
self.assertEqual(lines["BR2_CONFIG"], os.path.join(self.builddir, ".config"))
|
||||
|
||||
def test_run(self):
|
||||
f = os.path.join(self.builddir, "build", "post-build.log")
|
||||
self.check_post_log_file(f, "target")
|
||||
f = os.path.join(self.builddir, "build", "post-fakeroot.log")
|
||||
self.check_post_log_file(f, "target")
|
||||
f = os.path.join(self.builddir, "build", "post-image.log")
|
||||
self.check_post_log_file(f, "images")
|
||||
self.check_post_log_file("post-build.log",
|
||||
os.path.join(self.builddir, "target"),
|
||||
os.path.join(self.builddir, "target"))
|
||||
self.check_post_log_file("post-fakeroot.log",
|
||||
os.path.join(self.builddir, "build/buildroot-fs/target"),
|
||||
os.path.join(self.builddir, "build/buildroot-fs/target"))
|
||||
self.check_post_log_file("post-image.log",
|
||||
os.path.join(self.builddir, "images"),
|
||||
os.path.join(self.builddir, "target"))
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
from tests.package.test_python import TestPythonBase
|
||||
|
||||
|
||||
class TestPythonCryptography(TestPythonBase):
|
||||
def fernet_test(self, timeout=-1):
|
||||
cmd = self.interpreter + " -c 'from cryptography.fernet import Fernet;"
|
||||
cmd += "key = Fernet.generate_key();"
|
||||
cmd += "f = Fernet(key)'"
|
||||
_, exit_code = self.emulator.run(cmd, timeout)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestPythonPy2Cryptography(TestPythonCryptography):
|
||||
config = TestPythonBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON=y
|
||||
BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.fernet_test(40)
|
||||
|
||||
|
||||
class TestPythonPy3Cryptography(TestPythonCryptography):
|
||||
config = TestPythonBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.fernet_test(40)
|
||||
@@ -21,6 +21,7 @@ class TestRustBase(infra.basetest.BRTest):
|
||||
def build_test_prog(self):
|
||||
hostdir = os.path.join(self.builddir, 'host')
|
||||
env = os.environ.copy()
|
||||
env["USER"] = "br-user"
|
||||
env["PATH"] = "{}:".format(os.path.join(hostdir, 'bin')) + env["PATH"]
|
||||
env["CARGO_HOME"] = os.path.join(hostdir, 'usr', 'share', 'cargo')
|
||||
env["RUST_TARGET_PATH"] = os.path.join(hostdir, 'etc', 'rustc')
|
||||
|
||||
34
buildroot/support/testing/tests/package/test_syslog_ng.py
Normal file
34
buildroot/support/testing/tests/package/test_syslog_ng.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestSyslogNg(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
|
||||
BR2_PACKAGE_SYSLOG_NG=y
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||
self.emulator.boot(arch="armv5", kernel="builtin", options=["-initrd", cpio_file])
|
||||
self.emulator.login()
|
||||
|
||||
cmd = "grep syslog-ng /var/log/messages | grep starting"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
cmd = "logger my-message;"
|
||||
cmd += "sleep 1;"
|
||||
cmd += "grep my-message /var/log/messages"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
cmd = "syslog-ng-ctl reload;"
|
||||
cmd += "sleep 1;"
|
||||
cmd += "grep syslog-ng /var/log/messages | grep -i warning"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 1)
|
||||
Reference in New Issue
Block a user