Bump buidlroot version to 2018.02.6
This commit is contained in:
0
bsp/buildroot/support/testing/tests/__init__.py
Normal file
0
bsp/buildroot/support/testing/tests/__init__.py
Normal file
82
bsp/buildroot/support/testing/tests/boot/test_atf.py
Normal file
82
bsp/buildroot/support/testing/tests/boot/test_atf.py
Normal 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
|
||||
@@ -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
|
||||
12
bsp/buildroot/support/testing/tests/core/post-build.sh
Executable file
12
bsp/buildroot/support/testing/tests/core/post-build.sh
Executable 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
|
||||
1
bsp/buildroot/support/testing/tests/core/post-fakeroot.sh
Symbolic link
1
bsp/buildroot/support/testing/tests/core/post-fakeroot.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
post-build.sh
|
||||
1
bsp/buildroot/support/testing/tests/core/post-image.sh
Symbolic link
1
bsp/buildroot/support/testing/tests/core/post-image.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
post-build.sh
|
||||
@@ -0,0 +1 @@
|
||||
foobar
|
||||
@@ -0,0 +1 @@
|
||||
barfoo
|
||||
@@ -0,0 +1 @@
|
||||
CONFIG_SQUASHFS_XATTR=y
|
||||
@@ -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])
|
||||
@@ -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")
|
||||
@@ -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)
|
||||
72
bsp/buildroot/support/testing/tests/core/test_timezone.py
Normal file
72
bsp/buildroot/support/testing/tests/core/test_timezone.py
Normal 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")
|
||||
0
bsp/buildroot/support/testing/tests/fs/__init__.py
Normal file
0
bsp/buildroot/support/testing/tests/fs/__init__.py
Normal file
125
bsp/buildroot/support/testing/tests/fs/test_ext.py
Normal file
125
bsp/buildroot/support/testing/tests/fs/test_ext.py
Normal 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)
|
||||
169
bsp/buildroot/support/testing/tests/fs/test_iso9660.py
Normal file
169
bsp/buildroot/support/testing/tests/fs/test_iso9660.py
Normal 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)
|
||||
47
bsp/buildroot/support/testing/tests/fs/test_jffs2.py
Normal file
47
bsp/buildroot/support/testing/tests/fs/test_jffs2.py
Normal 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)
|
||||
38
bsp/buildroot/support/testing/tests/fs/test_squashfs.py
Normal file
38
bsp/buildroot/support/testing/tests/fs/test_squashfs.py
Normal 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)
|
||||
40
bsp/buildroot/support/testing/tests/fs/test_ubi.py
Normal file
40
bsp/buildroot/support/testing/tests/fs/test_ubi.py
Normal 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)
|
||||
15
bsp/buildroot/support/testing/tests/fs/test_yaffs2.py
Normal file
15
bsp/buildroot/support/testing/tests/fs/test_yaffs2.py
Normal 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))
|
||||
48
bsp/buildroot/support/testing/tests/init/base.py
Normal file
48
bsp/buildroot/support/testing/tests/init/base.py
Normal 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)
|
||||
@@ -0,0 +1 @@
|
||||
foobar
|
||||
64
bsp/buildroot/support/testing/tests/init/test_busybox.py
Normal file
64
bsp/buildroot/support/testing/tests/init/test_busybox.py
Normal 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")
|
||||
33
bsp/buildroot/support/testing/tests/init/test_none.py
Normal file
33
bsp/buildroot/support/testing/tests/init/test_none.py
Normal 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")
|
||||
159
bsp/buildroot/support/testing/tests/init/test_systemd.py
Normal file
159
bsp/buildroot/support/testing/tests/init/test_systemd.py
Normal 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")
|
||||
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)
|
||||
252
bsp/buildroot/support/testing/tests/toolchain/test_external.py
Normal file
252
bsp/buildroot/support/testing/tests/toolchain/test_external.py
Normal 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)
|
||||
Reference in New Issue
Block a user