6 BR2_TARGET_ROOTFS_CPIO=y
7 # BR2_TARGET_ROOTFS_TAR is not set
11 def has_broken_links(path):
12 for root, dirs, files in os.walk(path):
14 fpath = os.path.join(root, f)
15 if not os.path.exists(fpath):
20 class TestExternalToolchain(infra.basetest.BRTest):
21 def common_check(self):
22 # Check for broken symlinks
23 for d in ["lib", "usr/lib"]:
24 path = os.path.join(self.builddir, "staging", d)
25 self.assertFalse(has_broken_links(path))
26 path = os.path.join(self.builddir, "target", d)
27 self.assertFalse(has_broken_links(path))
29 interp = infra.get_elf_prog_interpreter(self.builddir,
30 self.toolchain_prefix,
32 interp_path = os.path.join(self.builddir, "target", interp[1:])
33 self.assertTrue(os.path.exists(interp_path))
36 class TestExternalToolchainSourceryArmv4(TestExternalToolchain):
37 config = BASIC_CONFIG + \
41 BR2_TOOLCHAIN_EXTERNAL=y
42 BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM=y
44 toolchain_prefix = "arm-none-linux-gnueabi"
47 TestExternalToolchain.common_check(self)
49 # Check the architecture variant
50 arch = infra.get_file_arch(self.builddir,
51 self.toolchain_prefix,
53 self.assertEqual(arch, "v4T")
55 # Check the sysroot symlink
56 symlink = os.path.join(self.builddir, "staging", "armv4t")
57 self.assertTrue(os.path.exists(symlink))
58 self.assertEqual(os.readlink(symlink), "./")
61 img = os.path.join(self.builddir, "images", "rootfs.cpio")
62 self.emulator.boot(arch="armv5",
64 options=["-initrd", img])
68 class TestExternalToolchainSourceryArmv5(TestExternalToolchain):
69 config = BASIC_CONFIG + \
72 BR2_TOOLCHAIN_EXTERNAL=y
73 BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM=y
75 toolchain_prefix = "arm-none-linux-gnueabi"
78 TestExternalToolchain.common_check(self)
80 # Check the architecture variant
81 arch = infra.get_file_arch(self.builddir,
82 self.toolchain_prefix,
84 self.assertEqual(arch, "v5TE")
87 img = os.path.join(self.builddir, "images", "rootfs.cpio")
88 self.emulator.boot(arch="armv5",
90 options=["-initrd", img])
94 class TestExternalToolchainSourceryArmv7(TestExternalToolchain):
95 config = BASIC_CONFIG + \
100 BR2_ARM_INSTRUCTIONS_THUMB2=y
101 BR2_TOOLCHAIN_EXTERNAL=y
102 BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM=y
104 toolchain_prefix = "arm-none-linux-gnueabi"
107 TestExternalToolchain.common_check(self)
109 # Check the architecture variant
110 arch = infra.get_file_arch(self.builddir,
111 self.toolchain_prefix,
113 self.assertEqual(arch, "v7")
114 isa = infra.get_elf_arch_tag(self.builddir,
115 self.toolchain_prefix,
118 self.assertEqual(isa, "Thumb-2")
120 # Check we have the sysroot symlink
121 symlink = os.path.join(self.builddir, "staging", "thumb2")
122 self.assertTrue(os.path.exists(symlink))
123 self.assertEqual(os.readlink(symlink), "./")
126 img = os.path.join(self.builddir, "images", "rootfs.cpio")
127 self.emulator.boot(arch="armv7",
129 options=["-initrd", img])
130 self.emulator.login()
133 class TestExternalToolchainLinaroArm(TestExternalToolchain):
134 config = BASIC_CONFIG + \
138 BR2_TOOLCHAIN_EXTERNAL=y
139 BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM=y
141 toolchain_prefix = "arm-linux-gnueabihf"
144 TestExternalToolchain.common_check(self)
146 # Check the architecture variant
147 arch = infra.get_file_arch(self.builddir,
148 self.toolchain_prefix,
150 self.assertEqual(arch, "v7")
151 isa = infra.get_elf_arch_tag(self.builddir,
152 self.toolchain_prefix,
155 self.assertEqual(isa, "Thumb-2")
158 img = os.path.join(self.builddir, "images", "rootfs.cpio")
159 self.emulator.boot(arch="armv7",
161 options=["-initrd", img])
162 self.emulator.login()
165 class TestExternalToolchainBuildrootMusl(TestExternalToolchain):
166 config = BASIC_CONFIG + \
171 BR2_TOOLCHAIN_EXTERNAL=y
172 BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
173 BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
174 BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-cortex-a9-musl-2017.05-444-g6c704ba.tar.bz2"
175 BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
176 BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_11=y
177 BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
178 BR2_TOOLCHAIN_EXTERNAL_CXX=y
180 toolchain_prefix = "arm-linux"
183 TestExternalToolchain.common_check(self)
184 img = os.path.join(self.builddir, "images", "rootfs.cpio")
185 self.emulator.boot(arch="armv7",
187 options=["-initrd", img])
188 self.emulator.login()
191 class TestExternalToolchainCtngMusl(TestExternalToolchain):
192 config = BASIC_CONFIG + \
197 BR2_TOOLCHAIN_EXTERNAL=y
198 BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
199 BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
200 BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.net/toolchains/tarballs/arm-ctng-linux-musleabihf.tar.xz"
201 BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-ctng-linux-musleabihf"
202 BR2_TOOLCHAIN_EXTERNAL_GCC_7=y
203 BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y
204 BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
205 BR2_TOOLCHAIN_EXTERNAL_CXX=y
207 toolchain_prefix = "arm-ctng-linux-musleabihf"
210 TestExternalToolchain.common_check(self)
211 img = os.path.join(self.builddir, "images", "rootfs.cpio")
212 self.emulator.boot(arch="armv7",
214 options=["-initrd", img])
215 self.emulator.login()
218 class TestExternalToolchainBuildrootuClibc(TestExternalToolchain):
219 config = BASIC_CONFIG + \
222 BR2_TOOLCHAIN_EXTERNAL=y
223 BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
224 BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
225 BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2017.05-444-g6c704ba.tar.bz2"
226 BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
227 BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y
228 BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
229 # BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
230 BR2_TOOLCHAIN_EXTERNAL_CXX=y
232 toolchain_prefix = "arm-linux"
235 TestExternalToolchain.common_check(self)
236 img = os.path.join(self.builddir, "images", "rootfs.cpio")
237 self.emulator.boot(arch="armv7",
239 options=["-initrd", img])
240 self.emulator.login()
243 class TestExternalToolchainCCache(TestExternalToolchainBuildrootuClibc):
247 BR2_CCACHE_DIR="{builddir}/ccache-dir"
250 def __init__(self, names):
251 super(TestExternalToolchainBuildrootuClibc, self).__init__(names)
252 self.config += self.extraconfig.format(builddir=self.builddir)