Bump buidlroot version to 2018.02.6
This commit is contained in:
29
bsp/buildroot/support/testing/tests/package/test_dropbear.py
Normal file
29
bsp/buildroot/support/testing/tests/package/test_dropbear.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestDropbear(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_GENERIC_ROOT_PASSWD="testpwd"
|
||||
BR2_SYSTEM_DHCP="eth0"
|
||||
BR2_PACKAGE_DROPBEAR=y
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
img = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||
self.emulator.boot(arch="armv5",
|
||||
kernel="builtin",
|
||||
options=["-initrd", img,
|
||||
"-net", "nic",
|
||||
"-net", "user,hostfwd=tcp::2222-:22"])
|
||||
self.emulator.login("testpwd")
|
||||
cmd = "netstat -ltn 2>/dev/null | grep 0.0.0.0:22"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
# Would be useful to try to login through SSH here, through
|
||||
# localhost:2222, though it is not easy to pass the ssh
|
||||
# password on the command line.
|
||||
36
bsp/buildroot/support/testing/tests/package/test_ipython.py
Normal file
36
bsp/buildroot/support/testing/tests/package/test_ipython.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from tests.package.test_python import TestPythonBase
|
||||
#
|
||||
# The following pythong tests are not being used here:
|
||||
#
|
||||
# - version_test: IPython does not support --version option
|
||||
#
|
||||
# - zlib_test: IPython does not return a non-zero code the way CPython
|
||||
# does, so this test ends up being a false-negative
|
||||
|
||||
|
||||
class TestIPythonPy2(TestPythonBase):
|
||||
config = TestPythonBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON=y
|
||||
BR2_PACKAGE_PYTHON_IPYTHON=y
|
||||
"""
|
||||
interpreter = "ipython"
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.math_floor_test(40)
|
||||
self.libc_time_test(40)
|
||||
|
||||
|
||||
class TestIPythonPy3(TestPythonBase):
|
||||
config = TestPythonBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
BR2_PACKAGE_PYTHON_IPYTHON=y
|
||||
"""
|
||||
interpreter = "ipython"
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.math_floor_test(40)
|
||||
self.libc_time_test(40)
|
||||
70
bsp/buildroot/support/testing/tests/package/test_python.py
Normal file
70
bsp/buildroot/support/testing/tests/package/test_python.py
Normal file
@@ -0,0 +1,70 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestPythonBase(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
interpreter = "python"
|
||||
|
||||
def login(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()
|
||||
|
||||
def version_test(self, version, timeout=-1):
|
||||
cmd = self.interpreter + " --version 2>&1 | grep '^{}'".format(version)
|
||||
_, exit_code = self.emulator.run(cmd, timeout)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
def math_floor_test(self, timeout=-1):
|
||||
cmd = self.interpreter + " -c 'import math; math.floor(12.3)'"
|
||||
_, exit_code = self.emulator.run(cmd, timeout)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
def libc_time_test(self, timeout=-1):
|
||||
cmd = self.interpreter + " -c 'from __future__ import print_function;"
|
||||
cmd += "import ctypes;"
|
||||
cmd += "libc = ctypes.cdll.LoadLibrary(\"libc.so.1\");"
|
||||
cmd += "print(libc.time(None))'"
|
||||
_, exit_code = self.emulator.run(cmd, timeout)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
def zlib_test(self, timeout=-1):
|
||||
cmd = self.interpreter + " -c 'import zlib'"
|
||||
_, exit_code = self.emulator.run(cmd, timeout)
|
||||
self.assertEqual(exit_code, 1)
|
||||
|
||||
|
||||
class TestPython2(TestPythonBase):
|
||||
config = TestPythonBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.version_test("Python 2")
|
||||
self.math_floor_test()
|
||||
self.libc_time_test()
|
||||
self.zlib_test()
|
||||
|
||||
|
||||
class TestPython3(TestPythonBase):
|
||||
config = TestPythonBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.version_test("Python 3")
|
||||
self.math_floor_test()
|
||||
self.libc_time_test()
|
||||
self.zlib_test()
|
||||
114
bsp/buildroot/support/testing/tests/package/test_rust.py
Normal file
114
bsp/buildroot/support/testing/tests/package/test_rust.py
Normal file
@@ -0,0 +1,114 @@
|
||||
import os
|
||||
import tempfile
|
||||
import subprocess
|
||||
import shutil
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestRustBase(infra.basetest.BRTest):
|
||||
|
||||
target = 'armv7-unknown-linux-gnueabihf'
|
||||
crate = 'hello-world'
|
||||
|
||||
def login(self):
|
||||
img = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||
self.emulator.boot(arch="armv7",
|
||||
kernel="builtin",
|
||||
options=["-initrd", img])
|
||||
self.emulator.login()
|
||||
|
||||
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')
|
||||
cargo = os.path.join(hostdir, 'bin', 'cargo')
|
||||
workdir = os.path.join(tempfile.mkdtemp(suffix='-br2-testing-rust'),
|
||||
self.crate)
|
||||
manifest = os.path.join(workdir, 'Cargo.toml')
|
||||
prog = os.path.join(workdir, 'target', self.target, 'debug', self.crate)
|
||||
|
||||
cmd = [cargo, 'init', '--bin', '--vcs', 'none', '-vv', workdir]
|
||||
ret = subprocess.call(cmd,
|
||||
stdout=self.b.logfile,
|
||||
stderr=self.b.logfile,
|
||||
env=env)
|
||||
if ret != 0:
|
||||
raise SystemError("Cargo init failed")
|
||||
|
||||
cmd = [
|
||||
cargo, 'build', '-vv', '--target', self.target,
|
||||
'--manifest-path', manifest
|
||||
]
|
||||
ret = subprocess.call(cmd,
|
||||
stdout=self.b.logfile,
|
||||
stderr=self.b.logfile,
|
||||
env=env)
|
||||
if ret != 0:
|
||||
raise SystemError("Cargo build failed")
|
||||
|
||||
shutil.copy(prog, os.path.join(self.builddir, 'target', 'usr', 'bin'))
|
||||
self.b.build()
|
||||
shutil.rmtree(workdir)
|
||||
|
||||
|
||||
class TestRustBin(TestRustBase):
|
||||
config = \
|
||||
"""
|
||||
BR2_arm=y
|
||||
BR2_cortex_a9=y
|
||||
BR2_ARM_ENABLE_NEON=y
|
||||
BR2_ARM_ENABLE_VFP=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
|
||||
BR2_SYSTEM_DHCP="eth0"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11.3"
|
||||
BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
|
||||
BR2_LINUX_KERNEL_DTS_SUPPORT=y
|
||||
BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_PACKAGE_HOST_CARGO=y
|
||||
BR2_PACKAGE_HOST_RUSTC=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.build_test_prog()
|
||||
self.login()
|
||||
_, exit_code = self.emulator.run(self.crate)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestRust(TestRustBase):
|
||||
config = \
|
||||
"""
|
||||
BR2_arm=y
|
||||
BR2_cortex_a9=y
|
||||
BR2_ARM_ENABLE_NEON=y
|
||||
BR2_ARM_ENABLE_VFP=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
|
||||
BR2_SYSTEM_DHCP="eth0"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11.3"
|
||||
BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
|
||||
BR2_LINUX_KERNEL_DTS_SUPPORT=y
|
||||
BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_PACKAGE_HOST_CARGO=y
|
||||
BR2_PACKAGE_HOST_RUSTC=y
|
||||
BR2_PACKAGE_HOST_RUST=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.build_test_prog()
|
||||
self.login()
|
||||
_, exit_code = self.emulator.run(self.crate)
|
||||
self.assertEqual(exit_code, 0)
|
||||
Reference in New Issue
Block a user