Add buildroot 2018-02

This commit is contained in:
Pascal Vizeli
2018-03-17 23:47:00 +00:00
parent 3776c47f83
commit 67742041ad
10007 changed files with 405098 additions and 0 deletions

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,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")