Bump buidlroot version to 2018.02.6

This commit is contained in:
jbnadal
2018-10-22 14:55:59 +02:00
parent 222960cedb
commit bec94fdb63
6150 changed files with 84803 additions and 117446 deletions

View File

@@ -0,0 +1,7 @@
set default="0"
set timeout="1"
menuentry "Buildroot" {
linux __KERNEL_PATH__ root=/dev/sr0 console=ttyS0,115200
initrd __INITRD_PATH__
}

View File

@@ -0,0 +1,5 @@
default 1
label 1
kernel __KERNEL_PATH__
initrd __INITRD_PATH__
append root=/dev/sr0 console=ttyS0,115200

View File

@@ -0,0 +1,49 @@
CONFIG_SYSVIPC=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_SMP=y
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_VIRTIO_BLK=y
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_DEV_SR=y
CONFIG_SCSI_VIRTIO=y
CONFIG_ATA=y
CONFIG_ATA_PIIX=y
CONFIG_NETDEVICES=y
CONFIG_VIRTIO_NET=y
CONFIG_NE2K_PCI=y
CONFIG_8139CP=y
CONFIG_INPUT_EVDEV=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_HW_RANDOM_VIRTIO=m
CONFIG_DRM=y
CONFIG_DRM_BOCHS=y
CONFIG_DRM_QXL=y
CONFIG_DRM_VIRTIO_GPU=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_HDA_INTEL=y
CONFIG_SND_HDA_GENERIC=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_UHCI_HCD=y
CONFIG_USB_STORAGE=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
CONFIG_EXT4_FS=y
CONFIG_ISO9660_FS=y
CONFIG_ZISOFS=y
CONFIG_JOLIET=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y

View File

@@ -0,0 +1,5 @@
[unittest]
plugins = nose2.plugins.mp
[multiprocess]
always-on = True

View File

@@ -0,0 +1,97 @@
import os
import re
import sys
import tempfile
import subprocess
from urllib2 import urlopen, HTTPError, URLError
ARTIFACTS_URL = "http://autobuild.buildroot.net/artefacts/"
def open_log_file(builddir, stage, logtofile=True):
"""
Open a file for logging and return its handler.
If logtofile is True, returns sys.stdout. Otherwise opens a file
with a suitable name in the build directory.
"""
if logtofile:
fhandle = open("{}-{}.log".format(builddir, stage), 'a+')
else:
fhandle = sys.stdout
return fhandle
def filepath(relpath):
return os.path.join(os.getcwd(), "support/testing", relpath)
def download(dldir, filename):
finalpath = os.path.join(dldir, filename)
if os.path.exists(finalpath):
return finalpath
if not os.path.exists(dldir):
os.makedirs(dldir)
tmpfile = tempfile.mktemp(dir=dldir)
print "Downloading to {}".format(tmpfile)
try:
url_fh = urlopen(os.path.join(ARTIFACTS_URL, filename))
with open(tmpfile, "w+") as tmpfile_fh:
tmpfile_fh.write(url_fh.read())
except (HTTPError, URLError), err:
os.unlink(tmpfile)
raise err
print "Renaming from %s to %s" % (tmpfile, finalpath)
os.rename(tmpfile, finalpath)
return finalpath
def get_elf_arch_tag(builddir, prefix, fpath, tag):
"""
Runs the cross readelf on 'fpath', then extracts the value of tag 'tag'.
Example:
>>> get_elf_arch_tag('output', 'arm-none-linux-gnueabi-',
'bin/busybox', 'Tag_CPU_arch')
v5TEJ
>>>
"""
cmd = ["host/bin/{}-readelf".format(prefix),
"-A", os.path.join("target", fpath)]
out = subprocess.check_output(cmd, cwd=builddir, env={"LANG": "C"})
regexp = re.compile("^ {}: (.*)$".format(tag))
for line in out.splitlines():
m = regexp.match(line)
if not m:
continue
return m.group(1)
return None
def get_file_arch(builddir, prefix, fpath):
return get_elf_arch_tag(builddir, prefix, fpath, "Tag_CPU_arch")
def get_elf_prog_interpreter(builddir, prefix, fpath):
"""
Runs the cross readelf on 'fpath' to extract the program interpreter
name and returns it.
Example:
>>> get_elf_prog_interpreter('br-tests/TestExternalToolchainLinaroArm',
'arm-linux-gnueabihf',
'bin/busybox')
/lib/ld-linux-armhf.so.3
>>>
"""
cmd = ["host/bin/{}-readelf".format(prefix),
"-l", os.path.join("target", fpath)]
out = subprocess.check_output(cmd, cwd=builddir, env={"LANG": "C"})
regexp = re.compile("^ *\[Requesting program interpreter: (.*)\]$")
for line in out.splitlines():
m = regexp.match(line)
if not m:
continue
return m.group(1)
return None

View File

@@ -0,0 +1,71 @@
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
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_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.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()

View File

@@ -0,0 +1,49 @@
import os
import shutil
import subprocess
import infra
class Builder(object):
def __init__(self, config, builddir, logtofile):
self.config = '\n'.join([line.lstrip() for line in
config.splitlines()]) + '\n'
self.builddir = builddir
self.logfile = infra.open_log_file(builddir, "build", logtofile)
def build(self):
if not os.path.isdir(self.builddir):
os.makedirs(self.builddir)
config_file = os.path.join(self.builddir, ".config")
with open(config_file, "w+") as cf:
cf.write(self.config)
# dump the defconfig to the logfile for easy debugging
self.logfile.write("> start defconfig\n" + self.config +
"> end defconfig\n")
self.logfile.flush()
cmd = ["make",
"O={}".format(self.builddir),
"olddefconfig"]
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile)
if ret != 0:
raise SystemError("Cannot olddefconfig")
cmd = ["make", "-C", self.builddir]
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile)
if ret != 0:
raise SystemError("Build failed")
open(self.stamp_path(), 'a').close()
def stamp_path(self):
return os.path.join(self.builddir, "build-done")
def is_finished(self):
return os.path.exists(self.stamp_path())
def delete(self):
if os.path.exists(self.builddir):
shutil.rmtree(self.builddir)

View File

@@ -0,0 +1,119 @@
import pexpect
import infra
class Emulator(object):
def __init__(self, builddir, downloaddir, logtofile, timeout_multiplier):
self.qemu = None
self.downloaddir = downloaddir
self.logfile = infra.open_log_file(builddir, "run", logtofile)
# We use elastic runners on the cloud to runs our tests. Those runners
# can take a long time to run the emulator. Use a timeout multiplier
# when running the tests to avoid sporadic failures.
self.timeout_multiplier = timeout_multiplier
# Start Qemu to boot the system
#
# arch: Qemu architecture to use
#
# kernel: path to the kernel image, or the special string
# 'builtin'. 'builtin' means a pre-built kernel image will be
# downloaded from ARTEFACTS_URL and suitable options are
# automatically passed to qemu and added to the kernel cmdline. So
# far only armv5, armv7 and i386 builtin kernels are available.
# If None, then no kernel is used, and we assume a bootable device
# will be specified.
#
# kernel_cmdline: array of kernel arguments to pass to Qemu -append option
#
# options: array of command line options to pass to Qemu
#
def boot(self, arch, kernel=None, kernel_cmdline=None, options=None):
if arch in ["armv7", "armv5"]:
qemu_arch = "arm"
else:
qemu_arch = arch
qemu_cmd = ["qemu-system-{}".format(qemu_arch),
"-serial", "stdio",
"-display", "none"]
if options:
qemu_cmd += options
if kernel_cmdline is None:
kernel_cmdline = []
if kernel:
if kernel == "builtin":
if arch in ["armv7", "armv5"]:
kernel_cmdline.append("console=ttyAMA0")
if arch == "armv7":
kernel = infra.download(self.downloaddir,
"kernel-vexpress")
dtb = infra.download(self.downloaddir,
"vexpress-v2p-ca9.dtb")
qemu_cmd += ["-dtb", dtb]
qemu_cmd += ["-M", "vexpress-a9"]
elif arch == "armv5":
kernel = infra.download(self.downloaddir,
"kernel-versatile")
qemu_cmd += ["-M", "versatilepb"]
qemu_cmd += ["-kernel", kernel]
if kernel_cmdline:
qemu_cmd += ["-append", " ".join(kernel_cmdline)]
self.logfile.write("> starting qemu with '%s'\n" % " ".join(qemu_cmd))
self.qemu = pexpect.spawn(qemu_cmd[0], qemu_cmd[1:],
timeout=5 * self.timeout_multiplier,
env={"QEMU_AUDIO_DRV": "none"})
# We want only stdout into the log to avoid double echo
self.qemu.logfile_read = self.logfile
# Wait for the login prompt to appear, and then login as root with
# the provided password, or no password if not specified.
def login(self, password=None):
# The login prompt can take some time to appear when running multiple
# instances in parallel, so set the timeout to a large value
index = self.qemu.expect(["buildroot login:", pexpect.TIMEOUT],
timeout=60 * self.timeout_multiplier)
if index != 0:
self.logfile.write("==> System does not boot")
raise SystemError("System does not boot")
self.qemu.sendline("root")
if password:
self.qemu.expect("Password:")
self.qemu.sendline(password)
index = self.qemu.expect(["# ", pexpect.TIMEOUT])
if index != 0:
raise SystemError("Cannot login")
self.run("dmesg -n 1")
# Run the given 'cmd' with a 'timeout' on the target
# return a tuple (output, exit_code)
def run(self, cmd, timeout=-1):
self.qemu.sendline(cmd)
if timeout != -1:
timeout *= self.timeout_multiplier
self.qemu.expect("# ", timeout=timeout)
# Remove double carriage return from qemu stdout so str.splitlines()
# works as expected.
output = self.qemu.before.replace("\r\r", "\r").splitlines()[1:]
self.qemu.sendline("echo $?")
self.qemu.expect("# ")
exit_code = self.qemu.before.splitlines()[2]
exit_code = int(exit_code)
return output, exit_code
def stop(self):
if self.qemu is None:
return
self.qemu.terminate(force=True)

View File

@@ -0,0 +1,123 @@
#!/usr/bin/env python2
import argparse
import sys
import os
import nose2
import multiprocessing
from infra.basetest import BRTest
def main():
parser = argparse.ArgumentParser(description='Run Buildroot tests')
parser.add_argument('testname', nargs='*',
help='list of test cases to execute')
parser.add_argument('-l', '--list', action='store_true',
help='list of available test cases')
parser.add_argument('-a', '--all', action='store_true',
help='execute all test cases')
parser.add_argument('-s', '--stdout', action='store_true',
help='log everything to stdout')
parser.add_argument('-o', '--output',
help='output directory')
parser.add_argument('-d', '--download',
help='download directory')
parser.add_argument('-k', '--keep',
help='keep build directories',
action='store_true')
parser.add_argument('-t', '--testcases', type=int, default=1,
help='number of testcases to run simultaneously')
parser.add_argument('-j', '--jlevel', type=int,
help='BR2_JLEVEL to use for each testcase')
parser.add_argument('--timeout-multiplier', type=int, default=1,
help='increase timeouts (useful for slow machines)')
args = parser.parse_args()
script_path = os.path.realpath(__file__)
test_dir = os.path.dirname(script_path)
if args.stdout:
BRTest.logtofile = False
if args.list:
print "List of tests"
nose2.discover(argv=[script_path,
"-s", test_dir,
"-v",
"--collect-only"],
plugins=["nose2.plugins.collect"])
return 0
if args.download is None:
args.download = os.getenv("BR2_DL_DIR")
if args.download is None:
print "Missing download directory, please use -d/--download"
print ""
parser.print_help()
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"
print ""
parser.print_help()
return 1
if not os.path.exists(args.output):
os.mkdir(args.output)
BRTest.outputdir = os.path.abspath(args.output)
if args.all is False and len(args.testname) == 0:
print "No test selected"
print ""
parser.print_help()
return 1
BRTest.keepbuilds = args.keep
if args.testcases != 1:
if args.testcases < 1:
print "Invalid number of testcases to run simultaneously"
print ""
parser.print_help()
return 1
# same default BR2_JLEVEL as package/Makefile.in
br2_jlevel = 1 + multiprocessing.cpu_count()
each_testcase = br2_jlevel / args.testcases
if each_testcase < 1:
each_testcase = 1
BRTest.jlevel = each_testcase
if args.jlevel:
if args.jlevel < 0:
print "Invalid BR2_JLEVEL to use for each testcase"
print ""
parser.print_help()
return 1
# the user can override the auto calculated value
BRTest.jlevel = args.jlevel
if args.timeout_multiplier < 1:
print "Invalid multiplier for timeout values"
print ""
parser.print_help()
return 1
BRTest.timeout_multiplier = args.timeout_multiplier
nose2_args = ["-v",
"-N", str(args.testcases),
"-s", test_dir,
"-c", os.path.join(test_dir, "conf/unittest.cfg")]
if len(args.testname) != 0:
nose2_args += args.testname
nose2.discover(argv=nose2_args)
if __name__ == "__main__":
sys.exit(main())

View File

@@ -0,0 +1,82 @@
import infra.basetest
class TestATFVexpress(infra.basetest.BRTest):
config = \
"""
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64=y
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.5"
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="juno"
BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33=y
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BOARDNAME="vexpress_aemv8a_juno"
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2016.03"
BR2_TARGET_VEXPRESS_FIRMWARE=y
"""
def test_run(self):
pass
class TestATFAllwinner(infra.basetest.BRTest):
config = \
"""
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64=y
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/apritzel/arm-trusted-firmware.git"
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="sun50iw1p1"
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION="aa75c8da415158a94b82a430b2b40000778e851f"
BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31=y
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2017.09"
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="bananapi_m64"
BR2_TARGET_UBOOT_NEEDS_DTC=y
BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb"
BR2_TARGET_UBOOT_SPL=y
BR2_TARGET_UBOOT_SPL_NAME="spl/sunxi-spl.bin"
"""
def test_run(self):
pass
class TestATFMarvell(infra.basetest.BRTest):
config = \
"""
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64=y
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="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
BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="USE_COHERENT_MEM=0"
BR2_TARGET_BINARIES_MARVELL=y
BR2_TARGET_BINARIES_MARVELL_8040=y
BR2_TARGET_MV_DDR_MARVELL=y
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BOARDNAME="mvebu_mcbin-88f8040"
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2017.09"
BR2_TARGET_UBOOT_NEEDS_DTC=y
"""
def test_run(self):
pass

View File

@@ -0,0 +1,7 @@
# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
/usr/sbin/getcap f 755 0 0 - - - - -
|xattr cap_sys_nice+eip
# leading spaces are ignored for xattr
|xattr cap_kill+eip
# leading tabs are ignored for xattr
|xattr cap_sys_time+eip

View File

@@ -0,0 +1,12 @@
#!/bin/sh
(
printf "arg1,%s\n" "${1}"
printf "arg2,%s\n" "${2}"
printf "arg3,%s\n" "${3}"
printf "TARGET_DIR,%s\n" "${TARGET_DIR}"
printf "BUILD_DIR,%s\n" "${BUILD_DIR}"
printf "HOST_DIR,%s\n" "${HOST_DIR}"
printf "STAGING_DIR,%s\n" "${STAGING_DIR}"
printf "BINARIES_DIR,%s\n" "${BINARIES_DIR}"
printf "BR2_CONFIG,%s\n" "${BR2_CONFIG}"
) > ${BUILD_DIR}/$(basename "${0}" .sh).log

View File

@@ -0,0 +1 @@
post-build.sh

View File

@@ -0,0 +1 @@
post-build.sh

View File

@@ -0,0 +1 @@
foobar

View File

@@ -0,0 +1 @@
barfoo

View File

@@ -0,0 +1 @@
CONFIG_SQUASHFS_XATTR=y

View File

@@ -0,0 +1,47 @@
import os
import subprocess
import infra.basetest
class TestFileCapabilities(infra.basetest.BRTest):
config = \
"""
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_ROOTFS_DEVICE_TABLE="system/device_table.txt {}"
BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
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_CONFIG_FRAGMENT_FILES="{}"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
BR2_PACKAGE_LIBCAP=y
BR2_PACKAGE_LIBCAP_TOOLS=y
BR2_TARGET_ROOTFS_SQUASHFS=y
# BR2_TARGET_ROOTFS_TAR is not set
""".format(infra.filepath("tests/core/device_table2.txt"),
infra.filepath("tests/core/squashfs-xattr-kernel.config"))
def test_run(self):
img = os.path.join(self.builddir, "images", "rootfs.squashfs")
subprocess.call(["truncate", "-s", "%1M", img])
self.emulator.boot(arch="armv7",
kernel=os.path.join(self.builddir, "images", "zImage"),
kernel_cmdline=["root=/dev/mmcblk0",
"rootfstype=squashfs"],
options=["-drive", "file={},if=sd,format=raw".format(img),
"-M", "vexpress-a9",
"-dtb", os.path.join(self.builddir, "images", "vexpress-v2p-ca9.dtb")])
self.emulator.login()
cmd = "getcap -v /usr/sbin/getcap"
output, _ = self.emulator.run(cmd)
self.assertIn("cap_kill", output[0])
self.assertIn("cap_sys_nice", output[0])
self.assertIn("cap_sys_time", output[0])
self.assertIn("+eip", output[0])

View File

@@ -0,0 +1,45 @@
import os
import csv
import infra.basetest
class TestPostScripts(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
BR2_ROOTFS_POST_FAKEROOT_SCRIPT="{}"
BR2_ROOTFS_POST_IMAGE_SCRIPT="{}"
BR2_ROOTFS_POST_SCRIPT_ARGS="foobar baz"
""".format(infra.filepath("tests/core/post-build.sh"),
infra.filepath("tests/core/post-fakeroot.sh"),
infra.filepath("tests/core/post-image.sh"))
def check_post_log_file(self, path, what):
lines = {}
with open(path, '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["arg2"], "foobar")
self.assertEqual(lines["arg3"], "baz")
self.assertEqual(lines["TARGET_DIR"], os.path.join(self.builddir, "target"))
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"))
self.assertEqual(lines["STAGING_DIR"], staging)
self.assertEqual(lines["BINARIES_DIR"], os.path.join(self.builddir, "images"))
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")

View File

@@ -0,0 +1,30 @@
import os
import subprocess
import infra.basetest
def compare_file(file1, file2):
return subprocess.call(["cmp", file1, file2])
class TestRootfsOverlay(infra.basetest.BRTest):
rootfs_overlay_path = infra.filepath("tests/core/rootfs-overlay")
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
infra.basetest.MINIMAL_CONFIG + \
"""
BR2_ROOTFS_OVERLAY="{0}1 {0}2"
""".format(rootfs_overlay_path)
def test_run(self):
target_file = os.path.join(self.builddir, "target", "test-file1")
overlay_file = "{}1/test-file1".format(self.rootfs_overlay_path)
ret = compare_file(overlay_file, target_file)
self.assertEqual(ret, 0)
target_file = os.path.join(self.builddir, "target", "etc", "test-file2")
overlay_file = "{}2/etc/test-file2".format(self.rootfs_overlay_path)
ret = compare_file(overlay_file, target_file)
self.assertEqual(ret, 0)

View File

@@ -0,0 +1,72 @@
import os
import infra.basetest
def boot_armv5_cpio(emulator, builddir):
img = os.path.join(builddir, "images", "rootfs.cpio")
emulator.boot(arch="armv5", kernel="builtin",
options=["-initrd", img])
emulator.login()
class TestNoTimezone(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
# BR2_TARGET_TZ_INFO is not set
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
boot_armv5_cpio(self.emulator, self.builddir)
tz, _ = self.emulator.run("TZ=UTC date +%Z")
self.assertEqual(tz[0].strip(), "UTC")
tz, _ = self.emulator.run("TZ=America/Los_Angeles date +%Z")
self.assertEqual(tz[0].strip(), "UTC")
class TestGlibcAllTimezone(infra.basetest.BRTest):
config = \
"""
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_TZ_INFO=y
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
boot_armv5_cpio(self.emulator, self.builddir)
tz, _ = self.emulator.run("date +%Z")
self.assertEqual(tz[0].strip(), "UTC")
tz, _ = self.emulator.run("TZ=UTC date +%Z")
self.assertEqual(tz[0].strip(), "UTC")
tz, _ = self.emulator.run("TZ=America/Los_Angeles date +%Z")
self.assertEqual(tz[0].strip(), "PST")
tz, _ = self.emulator.run("TZ=Europe/Paris date +%Z")
self.assertEqual(tz[0].strip(), "CET")
class TestGlibcNonDefaultLimitedTimezone(infra.basetest.BRTest):
config = \
"""
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_TZ_INFO=y
BR2_TARGET_TZ_ZONELIST="northamerica"
BR2_TARGET_LOCALTIME="America/New_York"
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
boot_armv5_cpio(self.emulator, self.builddir)
tz, _ = self.emulator.run("date +%Z")
self.assertEqual(tz[0].strip(), "EST")
tz, _ = self.emulator.run("TZ=UTC date +%Z")
self.assertEqual(tz[0].strip(), "UTC")
tz, _ = self.emulator.run("TZ=America/Los_Angeles date +%Z")
self.assertEqual(tz[0].strip(), "PST")
tz, _ = self.emulator.run("TZ=Europe/Paris date +%Z")
self.assertEqual(tz[0].strip(), "Europe")

View File

@@ -0,0 +1,125 @@
import os
import subprocess
import infra.basetest
VOLNAME_PROP = "Filesystem volume name"
REVISION_PROP = "Filesystem revision #"
FEATURES_PROP = "Filesystem features"
BLOCKCNT_PROP = "Block count"
INODECNT_PROP = "Inode count"
RESBLKCNT_PROP = "Reserved block count"
CHECK_FS_TYPE_CMD = "mount | grep '/dev/root on / type {}'"
def dumpe2fs_run(builddir, image):
cmd = ["host/sbin/dumpe2fs", os.path.join("images", image)]
ret = subprocess.check_output(cmd,
stderr=open(os.devnull, "w"),
cwd=builddir,
env={"LANG": "C"})
return ret.strip().splitlines()
def dumpe2fs_getprop(out, prop):
for line in out:
fields = line.split(": ")
if fields[0] == prop:
return fields[1].strip()
def boot_img_and_check_fs_type(emulator, builddir, fs_type):
img = os.path.join(builddir, "images", "rootfs.{}".format(fs_type))
emulator.boot(arch="armv7",
kernel="builtin",
kernel_cmdline=["root=/dev/mmcblk0",
"rootfstype={}".format(fs_type)],
options=["-drive", "file={},if=sd".format(img)])
emulator.login()
_, exit_code = emulator.run(CHECK_FS_TYPE_CMD.format(fs_type))
return exit_code
class TestExt2(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_2r0=y
BR2_TARGET_ROOTFS_EXT2_LABEL="foobaz"
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
out = dumpe2fs_run(self.builddir, "rootfs.ext2")
self.assertEqual(dumpe2fs_getprop(out, VOLNAME_PROP), "foobaz")
self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "0 (original)")
exit_code = boot_img_and_check_fs_type(self.emulator,
self.builddir, "ext2")
self.assertEqual(exit_code, 0)
class TestExt2r1(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_2r1=y
BR2_TARGET_ROOTFS_EXT2_LABEL="foobar"
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
out = dumpe2fs_run(self.builddir, "rootfs.ext2")
self.assertEqual(dumpe2fs_getprop(out, VOLNAME_PROP), "foobar")
self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "1 (dynamic)")
self.assertNotIn("has_journal", dumpe2fs_getprop(out, FEATURES_PROP))
exit_code = boot_img_and_check_fs_type(self.emulator,
self.builddir, "ext2")
self.assertEqual(exit_code, 0)
class TestExt3(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_3=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
out = dumpe2fs_run(self.builddir, "rootfs.ext3")
self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "1 (dynamic)")
self.assertIn("has_journal", dumpe2fs_getprop(out, FEATURES_PROP))
self.assertNotIn("extent", dumpe2fs_getprop(out, FEATURES_PROP))
exit_code = boot_img_and_check_fs_type(self.emulator,
self.builddir, "ext3")
self.assertEqual(exit_code, 0)
class TestExt4(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="16384"
BR2_TARGET_ROOTFS_EXT2_INODES=3000
BR2_TARGET_ROOTFS_EXT2_RESBLKS=10
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
out = dumpe2fs_run(self.builddir, "rootfs.ext4")
self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "1 (dynamic)")
self.assertEqual(dumpe2fs_getprop(out, BLOCKCNT_PROP), "16384")
# Yes there are 8 more inodes than requested
self.assertEqual(dumpe2fs_getprop(out, INODECNT_PROP), "3008")
self.assertEqual(dumpe2fs_getprop(out, RESBLKCNT_PROP), "1638")
self.assertIn("has_journal", dumpe2fs_getprop(out, FEATURES_PROP))
self.assertIn("extent", dumpe2fs_getprop(out, FEATURES_PROP))
exit_code = boot_img_and_check_fs_type(self.emulator,
self.builddir, "ext4")
self.assertEqual(exit_code, 0)

View File

@@ -0,0 +1,169 @@
import os
import infra.basetest
BASIC_CONFIG = \
"""
BR2_x86_pentium4=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-i386-pentium4-full-2017.05-1078-g95b1dae.tar.bz2"
BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_2=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="{}"
# BR2_TARGET_ROOTFS_TAR is not set
""".format(infra.filepath("conf/minimal-x86-qemu-kernel.config"))
def test_mount_internal_external(emulator, builddir, internal=True):
img = os.path.join(builddir, "images", "rootfs.iso9660")
emulator.boot(arch="i386", options=["-cdrom", img])
emulator.login()
if internal:
cmd = "mount | grep 'rootfs on / type rootfs'"
else:
cmd = "mount | grep '/dev/root on / type iso9660'"
_, exit_code = emulator.run(cmd)
return exit_code
def test_touch_file(emulator):
_, exit_code = emulator.run("touch test")
return exit_code
#
# Grub 2
class TestIso9660Grub2External(infra.basetest.BRTest):
config = BASIC_CONFIG + \
"""
BR2_TARGET_ROOTFS_ISO9660=y
# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set
BR2_TARGET_GRUB2=y
BR2_TARGET_GRUB2_BOOT_PARTITION="cd"
BR2_TARGET_GRUB2_BUILTIN_MODULES="boot linux ext2 fat part_msdos part_gpt normal biosdisk iso9660"
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
""".format(infra.filepath("conf/grub2.cfg"))
def test_run(self):
exit_code = test_mount_internal_external(self.emulator,
self.builddir, internal=False)
self.assertEqual(exit_code, 0)
exit_code = test_touch_file(self.emulator)
self.assertEqual(exit_code, 1)
class TestIso9660Grub2ExternalCompress(infra.basetest.BRTest):
config = BASIC_CONFIG + \
"""
BR2_TARGET_ROOTFS_ISO9660=y
# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set
BR2_TARGET_ROOTFS_ISO9660_TRANSPARENT_COMPRESSION=y
BR2_TARGET_GRUB2=y
BR2_TARGET_GRUB2_BOOT_PARTITION="cd"
BR2_TARGET_GRUB2_BUILTIN_MODULES="boot linux ext2 fat part_msdos part_gpt normal biosdisk iso9660"
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
""".format(infra.filepath("conf/grub2.cfg"))
def test_run(self):
exit_code = test_mount_internal_external(self.emulator,
self.builddir, internal=False)
self.assertEqual(exit_code, 0)
exit_code = test_touch_file(self.emulator)
self.assertEqual(exit_code, 1)
class TestIso9660Grub2Internal(infra.basetest.BRTest):
config = BASIC_CONFIG + \
"""
BR2_TARGET_ROOTFS_ISO9660=y
BR2_TARGET_ROOTFS_ISO9660_INITRD=y
BR2_TARGET_GRUB2=y
BR2_TARGET_GRUB2_BOOT_PARTITION="cd"
BR2_TARGET_GRUB2_BUILTIN_MODULES="boot linux ext2 fat part_msdos part_gpt normal biosdisk iso9660"
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
""".format(infra.filepath("conf/grub2.cfg"))
def test_run(self):
exit_code = test_mount_internal_external(self.emulator,
self.builddir, internal=True)
self.assertEqual(exit_code, 0)
exit_code = test_touch_file(self.emulator)
self.assertEqual(exit_code, 0)
#
# Syslinux
class TestIso9660SyslinuxExternal(infra.basetest.BRTest):
config = BASIC_CONFIG + \
"""
BR2_TARGET_ROOTFS_ISO9660=y
# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set
BR2_TARGET_ROOTFS_ISO9660_HYBRID=y
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
BR2_TARGET_SYSLINUX=y
""".format(infra.filepath("conf/isolinux.cfg"))
def test_run(self):
exit_code = test_mount_internal_external(self.emulator,
self.builddir, internal=False)
self.assertEqual(exit_code, 0)
exit_code = test_touch_file(self.emulator)
self.assertEqual(exit_code, 1)
class TestIso9660SyslinuxExternalCompress(infra.basetest.BRTest):
config = BASIC_CONFIG + \
"""
BR2_TARGET_ROOTFS_ISO9660=y
# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set
BR2_TARGET_ROOTFS_ISO9660_TRANSPARENT_COMPRESSION=y
BR2_TARGET_ROOTFS_ISO9660_HYBRID=y
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
BR2_TARGET_SYSLINUX=y
""".format(infra.filepath("conf/isolinux.cfg"))
def test_run(self):
exit_code = test_mount_internal_external(self.emulator,
self.builddir, internal=False)
self.assertEqual(exit_code, 0)
exit_code = test_touch_file(self.emulator)
self.assertEqual(exit_code, 1)
class TestIso9660SyslinuxInternal(infra.basetest.BRTest):
config = BASIC_CONFIG + \
"""
BR2_TARGET_ROOTFS_ISO9660=y
BR2_TARGET_ROOTFS_ISO9660_INITRD=y
BR2_TARGET_ROOTFS_ISO9660_HYBRID=y
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
BR2_TARGET_SYSLINUX=y
""".format(infra.filepath("conf/isolinux.cfg"))
def test_run(self):
exit_code = test_mount_internal_external(self.emulator,
self.builddir, internal=True)
self.assertEqual(exit_code, 0)
exit_code = test_touch_file(self.emulator)
self.assertEqual(exit_code, 0)

View File

@@ -0,0 +1,47 @@
import os
import subprocess
import infra.basetest
def jffs2dump_find_file(files_list, fname):
for file_name in files_list:
file_name = file_name.strip()
if file_name.startswith("Dirent") and file_name.endswith(fname):
return True
return False
class TestJffs2(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_TARGET_ROOTFS_JFFS2=y
BR2_TARGET_ROOTFS_JFFS2_CUSTOM=y
BR2_TARGET_ROOTFS_JFFS2_CUSTOM_EBSIZE=0x80000
BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER=y
BR2_TARGET_ROOTFS_JFFS2_PAD=y
BR2_TARGET_ROOTFS_JFFS2_PADSIZE=0x4000000
# BR2_TARGET_ROOTFS_TAR is not set
"""
# TODO: there are some scary JFFS2 messages when one starts to
# write files in the rootfs: "jffs2: Newly-erased block contained
# word 0x0 at offset 0x046c0000". To be investigated.
def test_run(self):
img = os.path.join(self.builddir, "images", "rootfs.jffs2")
out = subprocess.check_output(["host/sbin/jffs2dump", "-c", img],
cwd=self.builddir,
env={"LANG": "C"})
out = out.splitlines()
self.assertTrue(jffs2dump_find_file(out, "busybox"))
self.emulator.boot(arch="armv7",
kernel="builtin",
kernel_cmdline=["root=/dev/mtdblock0",
"rootfstype=jffs2"],
options=["-drive", "file={},if=pflash".format(img)])
self.emulator.login()
cmd = "mount | grep '/dev/root on / type jffs2'"
_, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 0)

View File

@@ -0,0 +1,38 @@
import os
import subprocess
import infra.basetest
class TestSquashfs(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_TARGET_ROOTFS_SQUASHFS=y
# BR2_TARGET_ROOTFS_SQUASHFS4_GZIP is not set
BR2_TARGET_ROOTFS_SQUASHFS4_LZ4=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
unsquashfs_cmd = ["host/bin/unsquashfs", "-s", "images/rootfs.squashfs"]
out = subprocess.check_output(unsquashfs_cmd,
cwd=self.builddir,
env={"LANG": "C"})
out = out.splitlines()
self.assertEqual(out[0],
"Found a valid SQUASHFS 4:0 superblock on images/rootfs.squashfs.")
self.assertEqual(out[3], "Compression lz4")
img = os.path.join(self.builddir, "images", "rootfs.squashfs")
subprocess.call(["truncate", "-s", "%1M", img])
self.emulator.boot(arch="armv7",
kernel="builtin",
kernel_cmdline=["root=/dev/mmcblk0",
"rootfstype=squashfs"],
options=["-drive", "file={},if=sd,format=raw".format(img)])
self.emulator.login()
cmd = "mount | grep '/dev/root on / type squashfs'"
_, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 0)

View File

@@ -0,0 +1,40 @@
import subprocess
import os
import infra.basetest
class TestUbi(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_TARGET_ROOTFS_UBIFS=y
BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x7ff80
BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x1
BR2_TARGET_ROOTFS_UBI=y
BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x80000
BR2_TARGET_ROOTFS_UBI_SUBSIZE=1
"""
# TODO: if you boot Qemu twice on the same UBI image, it fails to
# attach the image the second time, with "ubi0 error:
# ubi_read_volume_table: the layout volume was not found".
# To be investigated.
def test_run(self):
img = os.path.join(self.builddir, "images", "rootfs.ubi")
out = subprocess.check_output(["file", img],
cwd=self.builddir,
env={"LANG": "C"})
out = out.splitlines()
subprocess.call(["truncate", "-s 128M", img])
self.emulator.boot(arch="armv7",
kernel="builtin",
kernel_cmdline=["root=ubi0:rootfs",
"ubi.mtd=0",
"rootfstype=ubifs"],
options=["-drive", "file={},if=pflash".format(img)])
self.emulator.login()
cmd = "mount | grep 'ubi0:rootfs on / type ubifs'"
_, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 0)

View File

@@ -0,0 +1,15 @@
import os
import infra.basetest
class TestYaffs2(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
infra.basetest.MINIMAL_CONFIG + \
"""
BR2_TARGET_ROOTFS_YAFFS2=y
"""
def test_run(self):
img = os.path.join(self.builddir, "images", "rootfs.yaffs2")
self.assertTrue(os.path.exists(img))

View File

@@ -0,0 +1,48 @@
import os
import subprocess
import infra.basetest
class InitSystemBase(infra.basetest.BRTest):
def start_emulator(self, fs_type, kernel=None, dtb=None, init=None):
img = os.path.join(self.builddir, "images", "rootfs.{}".format(fs_type))
subprocess.call(["truncate", "-s", "%1M", img])
options = ["-drive",
"file={},if=sd,format=raw".format(img),
"-M", "vexpress-a9"]
if kernel is None:
kernel = "builtin"
else:
kernel = os.path.join(self.builddir, "images", kernel)
options.extend(["-dtb", os.path.join(self.builddir, "images",
"{}.dtb".format(dtb))])
kernel_cmdline = ["root=/dev/mmcblk0",
"rootfstype={}".format(fs_type),
"rootwait",
"ro",
"console=ttyAMA0"]
if init is not None:
kernel_cmdline.extend(["init={}".format(init)])
self.emulator.boot(arch="armv7",
kernel=kernel,
kernel_cmdline=kernel_cmdline,
options=options)
if init is None:
self.emulator.login()
def check_init(self, path):
cmd = "cmp /proc/1/exe {}".format(path)
_, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 0)
def check_network(self, interface, exitCode=0):
cmd = "ip addr show {} |grep inet".format(interface)
_, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, exitCode)

View File

@@ -0,0 +1 @@
foobar

View File

@@ -0,0 +1,64 @@
import infra.basetest
from tests.init.base import InitSystemBase as InitSystemBase
class InitSystemBusyboxBase(InitSystemBase):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
# BR2_TARGET_ROOTFS_TAR is not set
"""
def check_init(self):
super(InitSystemBusyboxBase, self).check_init("/bin/busybox")
class TestInitSystemBusyboxRo(InitSystemBusyboxBase):
config = InitSystemBusyboxBase.config + \
"""
# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
BR2_TARGET_ROOTFS_SQUASHFS=y
"""
def test_run(self):
self.start_emulator("squashfs")
self.check_init()
self.check_network("eth0", 1)
class TestInitSystemBusyboxRw(InitSystemBusyboxBase):
config = InitSystemBusyboxBase.config + \
"""
BR2_TARGET_ROOTFS_EXT2=y
"""
def test_run(self):
self.start_emulator("ext2")
self.check_init()
self.check_network("eth0", 1)
class TestInitSystemBusyboxRoNet(InitSystemBusyboxBase):
config = InitSystemBusyboxBase.config + \
"""
BR2_SYSTEM_DHCP="eth0"
# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
BR2_TARGET_ROOTFS_SQUASHFS=y
"""
def test_run(self):
self.start_emulator("squashfs")
self.check_init()
self.check_network("eth0")
class TestInitSystemBusyboxRwNet(InitSystemBusyboxBase):
config = InitSystemBusyboxBase.config + \
"""
BR2_SYSTEM_DHCP="eth0"
BR2_TARGET_ROOTFS_EXT2=y
"""
def test_run(self):
self.start_emulator("ext2")
self.check_init()
self.check_network("eth0")

View File

@@ -0,0 +1,33 @@
import pexpect
import infra.basetest
from tests.init.base import InitSystemBase as InitSystemBase
class TestInitSystemNone(InitSystemBase):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_INIT_NONE=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_ROOTFS_SQUASHFS=y
"""
def test_run(self):
self.start_emulator(fs_type="squashfs", init="/bin/sh")
index = self.emulator.qemu.expect(["/bin/sh: can't access tty; job control turned off", pexpect.TIMEOUT], timeout=60)
if index != 0:
self.emulator.logfile.write("==> System does not boot")
raise SystemError("System does not boot")
index = self.emulator.qemu.expect(["#", pexpect.TIMEOUT], timeout=60)
if index != 0:
self.emulator.logfile.write("==> System does not boot")
raise SystemError("System does not boot")
out, exit_code = self.emulator.run("sh -c 'echo $PPID'")
self.assertEqual(exit_code, 0)
self.assertEqual(out[0], "1")
_, exit_code = self.emulator.run("mount -t proc none /proc")
self.assertEqual(exit_code, 0)
self.check_init("/bin/sh")

View File

@@ -0,0 +1,159 @@
import infra.basetest
from tests.init.base import InitSystemBase as InitSystemBase
class InitSystemSystemdBase(InitSystemBase):
config = \
"""
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_INIT_SYSTEMD=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
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_TAR is not set
"""
def check_init(self):
super(InitSystemSystemdBase, self).check_init("/lib/systemd/systemd")
# Test all units are OK
output, _ = self.emulator.run("systemctl --no-pager --failed --no-legend")
self.assertEqual(len(output), 0)
# Test we can reach the DBus daemon
_, exit_code = self.emulator.run("busctl --no-pager")
self.assertEqual(exit_code, 0)
# Test we can read at least one line from the journal
output, _ = self.emulator.run("journalctl --no-pager --lines 1 --quiet")
self.assertEqual(len(output), 1)
class TestInitSystemSystemdRoNetworkd(InitSystemSystemdBase):
config = InitSystemSystemdBase.config + \
"""
BR2_SYSTEM_DHCP="eth0"
# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
BR2_ROOTFS_OVERLAY="{}"
BR2_TARGET_ROOTFS_SQUASHFS=y
""".format(infra.filepath("tests/init/systemd-factory"))
def test_run(self):
self.start_emulator("squashfs", "zImage", "vexpress-v2p-ca9")
self.check_init()
self.check_network("eth0")
# This one must be executed on the target, to check that
# the factory feature works as expected
out, exit_code = self.emulator.run("cat /var/foo/bar")
self.assertEqual(exit_code, 0)
self.assertEqual(out[0], "foobar")
class TestInitSystemSystemdRwNetworkd(InitSystemSystemdBase):
config = InitSystemSystemdBase.config + \
"""
BR2_SYSTEM_DHCP="eth0"
BR2_TARGET_ROOTFS_EXT2=y
"""
def test_run(self):
self.start_emulator("ext2", "zImage", "vexpress-v2p-ca9")
self.check_init()
self.check_network("eth0")
class TestInitSystemSystemdRoIfupdown(InitSystemSystemdBase):
config = InitSystemSystemdBase.config + \
"""
BR2_SYSTEM_DHCP="eth0"
# BR2_PACKAGE_SYSTEMD_NETWORKD is not set
# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
BR2_TARGET_ROOTFS_SQUASHFS=y
"""
def test_run(self):
self.start_emulator("squashfs", "zImage", "vexpress-v2p-ca9")
self.check_init()
self.check_network("eth0")
class TestInitSystemSystemdRwIfupdown(InitSystemSystemdBase):
config = InitSystemSystemdBase.config + \
"""
BR2_SYSTEM_DHCP="eth0"
# BR2_PACKAGE_SYSTEMD_NETWORKD is not set
# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
BR2_TARGET_ROOTFS_EXT2=y
"""
def test_run(self):
self.start_emulator("ext2", "zImage", "vexpress-v2p-ca9")
self.check_init()
self.check_network("eth0")
class TestInitSystemSystemdRoFull(InitSystemSystemdBase):
config = InitSystemSystemdBase.config + \
"""
BR2_SYSTEM_DHCP="eth0"
# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
BR2_PACKAGE_SYSTEMD_JOURNAL_GATEWAY=y
BR2_PACKAGE_SYSTEMD_BACKLIGHT=y
BR2_PACKAGE_SYSTEMD_BINFMT=y
BR2_PACKAGE_SYSTEMD_COREDUMP=y
BR2_PACKAGE_SYSTEMD_FIRSTBOOT=y
BR2_PACKAGE_SYSTEMD_HIBERNATE=y
BR2_PACKAGE_SYSTEMD_IMPORTD=y
BR2_PACKAGE_SYSTEMD_LOCALED=y
BR2_PACKAGE_SYSTEMD_LOGIND=y
BR2_PACKAGE_SYSTEMD_MACHINED=y
BR2_PACKAGE_SYSTEMD_POLKIT=y
BR2_PACKAGE_SYSTEMD_QUOTACHECK=y
BR2_PACKAGE_SYSTEMD_RANDOMSEED=y
BR2_PACKAGE_SYSTEMD_RFKILL=y
BR2_PACKAGE_SYSTEMD_SMACK_SUPPORT=y
BR2_PACKAGE_SYSTEMD_SYSUSERS=y
BR2_PACKAGE_SYSTEMD_VCONSOLE=y
BR2_TARGET_ROOTFS_SQUASHFS=y
"""
def test_run(self):
self.start_emulator("squashfs", "zImage", "vexpress-v2p-ca9")
self.check_init()
self.check_network("eth0")
class TestInitSystemSystemdRwFull(InitSystemSystemdBase):
config = InitSystemSystemdBase.config + \
"""
BR2_SYSTEM_DHCP="eth0"
BR2_PACKAGE_SYSTEMD_JOURNAL_GATEWAY=y
BR2_PACKAGE_SYSTEMD_BACKLIGHT=y
BR2_PACKAGE_SYSTEMD_BINFMT=y
BR2_PACKAGE_SYSTEMD_COREDUMP=y
BR2_PACKAGE_SYSTEMD_FIRSTBOOT=y
BR2_PACKAGE_SYSTEMD_HIBERNATE=y
BR2_PACKAGE_SYSTEMD_IMPORTD=y
BR2_PACKAGE_SYSTEMD_LOCALED=y
BR2_PACKAGE_SYSTEMD_LOGIND=y
BR2_PACKAGE_SYSTEMD_MACHINED=y
BR2_PACKAGE_SYSTEMD_POLKIT=y
BR2_PACKAGE_SYSTEMD_QUOTACHECK=y
BR2_PACKAGE_SYSTEMD_RANDOMSEED=y
BR2_PACKAGE_SYSTEMD_RFKILL=y
BR2_PACKAGE_SYSTEMD_SMACK_SUPPORT=y
BR2_PACKAGE_SYSTEMD_SYSUSERS=y
BR2_PACKAGE_SYSTEMD_VCONSOLE=y
BR2_TARGET_ROOTFS_EXT2=y
"""
def test_run(self):
self.start_emulator("ext2", "zImage", "vexpress-v2p-ca9")
self.check_init()
self.check_network("eth0")

View 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.

View 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)

View 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()

View 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)

View File

@@ -0,0 +1,252 @@
import os
import infra
BASIC_CONFIG = \
"""
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
def has_broken_links(path):
for root, dirs, files in os.walk(path):
for f in files:
fpath = os.path.join(root, f)
if not os.path.exists(fpath):
return True
return False
class TestExternalToolchain(infra.basetest.BRTest):
def common_check(self):
# Check for broken symlinks
for d in ["lib", "usr/lib"]:
path = os.path.join(self.builddir, "staging", d)
self.assertFalse(has_broken_links(path))
path = os.path.join(self.builddir, "target", d)
self.assertFalse(has_broken_links(path))
interp = infra.get_elf_prog_interpreter(self.builddir,
self.toolchain_prefix,
"bin/busybox")
interp_path = os.path.join(self.builddir, "target", interp[1:])
self.assertTrue(os.path.exists(interp_path))
class TestExternalToolchainSourceryArmv4(TestExternalToolchain):
config = BASIC_CONFIG + \
"""
BR2_arm=y
BR2_arm920t=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM=y
"""
toolchain_prefix = "arm-none-linux-gnueabi"
def test_run(self):
TestExternalToolchain.common_check(self)
# Check the architecture variant
arch = infra.get_file_arch(self.builddir,
self.toolchain_prefix,
"lib/libc.so.6")
self.assertEqual(arch, "v4T")
# Check the sysroot symlink
symlink = os.path.join(self.builddir, "staging", "armv4t")
self.assertTrue(os.path.exists(symlink))
self.assertEqual(os.readlink(symlink), "./")
# Boot the system
img = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv5",
kernel="builtin",
options=["-initrd", img])
self.emulator.login()
class TestExternalToolchainSourceryArmv5(TestExternalToolchain):
config = BASIC_CONFIG + \
"""
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM=y
"""
toolchain_prefix = "arm-none-linux-gnueabi"
def test_run(self):
TestExternalToolchain.common_check(self)
# Check the architecture variant
arch = infra.get_file_arch(self.builddir,
self.toolchain_prefix,
"lib/libc.so.6")
self.assertEqual(arch, "v5TE")
# Boot the system
img = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv5",
kernel="builtin",
options=["-initrd", img])
self.emulator.login()
class TestExternalToolchainSourceryArmv7(TestExternalToolchain):
config = BASIC_CONFIG + \
"""
BR2_arm=y
BR2_cortex_a8=y
BR2_ARM_EABI=y
BR2_ARM_INSTRUCTIONS_THUMB2=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM=y
"""
toolchain_prefix = "arm-none-linux-gnueabi"
def test_run(self):
TestExternalToolchain.common_check(self)
# Check the architecture variant
arch = infra.get_file_arch(self.builddir,
self.toolchain_prefix,
"lib/libc.so.6")
self.assertEqual(arch, "v7")
isa = infra.get_elf_arch_tag(self.builddir,
self.toolchain_prefix,
"lib/libc.so.6",
"Tag_THUMB_ISA_use")
self.assertEqual(isa, "Thumb-2")
# Check we have the sysroot symlink
symlink = os.path.join(self.builddir, "staging", "thumb2")
self.assertTrue(os.path.exists(symlink))
self.assertEqual(os.readlink(symlink), "./")
# Boot the system
img = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv7",
kernel="builtin",
options=["-initrd", img])
self.emulator.login()
class TestExternalToolchainLinaroArm(TestExternalToolchain):
config = BASIC_CONFIG + \
"""
BR2_arm=y
BR2_cortex_a8=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM=y
"""
toolchain_prefix = "arm-linux-gnueabihf"
def test_run(self):
TestExternalToolchain.common_check(self)
# Check the architecture variant
arch = infra.get_file_arch(self.builddir,
self.toolchain_prefix,
"lib/libc.so.6")
self.assertEqual(arch, "v7")
isa = infra.get_elf_arch_tag(self.builddir,
self.toolchain_prefix,
"lib/libc.so.6",
"Tag_THUMB_ISA_use")
self.assertEqual(isa, "Thumb-2")
# Boot the system
img = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv7",
kernel="builtin",
options=["-initrd", img])
self.emulator.login()
class TestExternalToolchainBuildrootMusl(TestExternalToolchain):
config = BASIC_CONFIG + \
"""
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=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-cortex-a9-musl-2017.05-1078-g95b1dae.tar.bz2"
BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_12=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
"""
toolchain_prefix = "arm-linux"
def test_run(self):
TestExternalToolchain.common_check(self)
img = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv7",
kernel="builtin",
options=["-initrd", img])
self.emulator.login()
class TestExternalToolchainCtngMusl(TestExternalToolchain):
config = BASIC_CONFIG + \
"""
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.net/toolchains/tarballs/arm-ctng-linux-musleabihf.tar.xz"
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-ctng-linux-musleabihf"
BR2_TOOLCHAIN_EXTERNAL_GCC_7=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
"""
toolchain_prefix = "arm-ctng-linux-musleabihf"
def test_run(self):
TestExternalToolchain.common_check(self)
img = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv7",
kernel="builtin",
options=["-initrd", img])
self.emulator.login()
class TestExternalToolchainBuildrootuClibc(TestExternalToolchain):
config = BASIC_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
"""
toolchain_prefix = "arm-linux"
def test_run(self):
TestExternalToolchain.common_check(self)
img = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv7",
kernel="builtin",
options=["-initrd", img])
self.emulator.login()
class TestExternalToolchainCCache(TestExternalToolchainBuildrootuClibc):
extraconfig = \
"""
BR2_CCACHE=y
BR2_CCACHE_DIR="{builddir}/ccache-dir"
"""
def __init__(self, names):
super(TestExternalToolchainBuildrootuClibc, self).__init__(names)
self.config += self.extraconfig.format(builddir=self.builddir)