6 BR2_TARGET_ROOTFS_CPIO=y
7 # BR2_TARGET_ROOTFS_TAR is not set
10 def has_broken_links(path):
11 for root, dirs, files in os.walk(path):
13 fpath = os.path.join(root, f)
14 if not os.path.exists(fpath):
18 class TestExternalToolchain(infra.basetest.BRTest):
19 def common_check(self):
20 # Check for broken symlinks
21 for d in ["lib", "usr/lib"]:
22 path = os.path.join(self.builddir, "staging", d)
23 self.assertFalse(has_broken_links(path))
24 path = os.path.join(self.builddir, "target", d)
25 self.assertFalse(has_broken_links(path))
27 interp = infra.get_elf_prog_interpreter(self.builddir,
28 self.toolchain_prefix,
30 interp_path = os.path.join(self.builddir, "target", interp[1:])
31 self.assertTrue(os.path.exists(interp_path))
33 class TestExternalToolchainSourceryArmv4(TestExternalToolchain):
34 config = BASIC_CONFIG + \
38 BR2_TOOLCHAIN_EXTERNAL=y
39 BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM=y
41 toolchain_prefix = "arm-none-linux-gnueabi"
44 TestExternalToolchain.common_check(self)
46 # Check the architecture variant
47 arch = infra.get_file_arch(self.builddir,
48 self.toolchain_prefix,
50 self.assertEqual(arch, "v4T")
52 # Check the sysroot symlink
53 symlink = os.path.join(self.builddir, "staging", "armv4t")
54 self.assertTrue(os.path.exists(symlink))
55 self.assertEqual(os.readlink(symlink), "./")
58 img = os.path.join(self.builddir, "images", "rootfs.cpio")
59 self.emulator.boot(arch="armv5",
61 options=["-initrd", img])
64 class TestExternalToolchainSourceryArmv5(TestExternalToolchain):
65 config = BASIC_CONFIG + \
68 BR2_TOOLCHAIN_EXTERNAL=y
69 BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM=y
71 toolchain_prefix = "arm-none-linux-gnueabi"
74 TestExternalToolchain.common_check(self)
76 # Check the architecture variant
77 arch = infra.get_file_arch(self.builddir,
78 self.toolchain_prefix,
80 self.assertEqual(arch, "v5TE")
83 img = os.path.join(self.builddir, "images", "rootfs.cpio")
84 self.emulator.boot(arch="armv5",
86 options=["-initrd", img])
89 class TestExternalToolchainSourceryArmv7(TestExternalToolchain):
90 config = BASIC_CONFIG + \
95 BR2_ARM_INSTRUCTIONS_THUMB2=y
96 BR2_TOOLCHAIN_EXTERNAL=y
97 BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM=y
99 toolchain_prefix = "arm-none-linux-gnueabi"
102 TestExternalToolchain.common_check(self)
104 # Check the architecture variant
105 arch = infra.get_file_arch(self.builddir,
106 self.toolchain_prefix,
108 self.assertEqual(arch, "v7")
109 isa = infra.get_elf_arch_tag(self.builddir,
110 self.toolchain_prefix,
113 self.assertEqual(isa, "Thumb-2")
115 # Check we have the sysroot symlink
116 symlink = os.path.join(self.builddir, "staging", "thumb2")
117 self.assertTrue(os.path.exists(symlink))
118 self.assertEqual(os.readlink(symlink), "./")
121 img = os.path.join(self.builddir, "images", "rootfs.cpio")
122 self.emulator.boot(arch="armv7",
124 options=["-initrd", img])
125 self.emulator.login()
127 class TestExternalToolchainLinaroArm(TestExternalToolchain):
128 config = BASIC_CONFIG + \
132 BR2_TOOLCHAIN_EXTERNAL=y
133 BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM=y
135 toolchain_prefix = "arm-linux-gnueabihf"
138 TestExternalToolchain.common_check(self)
140 # Check the architecture variant
141 arch = infra.get_file_arch(self.builddir,
142 self.toolchain_prefix,
144 self.assertEqual(arch, "v7")
145 isa = infra.get_elf_arch_tag(self.builddir,
146 self.toolchain_prefix,
149 self.assertEqual(isa, "Thumb-2")
152 img = os.path.join(self.builddir, "images", "rootfs.cpio")
153 self.emulator.boot(arch="armv7",
155 options=["-initrd", img])
156 self.emulator.login()
158 class TestExternalToolchainBuildrootMusl(TestExternalToolchain):
159 config = BASIC_CONFIG + \
164 BR2_TOOLCHAIN_EXTERNAL=y
165 BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
166 BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
167 BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-cortex-a9-musl-2017.05-444-g6c704ba.tar.bz2"
168 BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
169 BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_11=y
170 BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
171 BR2_TOOLCHAIN_EXTERNAL_CXX=y
173 toolchain_prefix = "arm-linux"
176 TestExternalToolchain.common_check(self)
177 img = os.path.join(self.builddir, "images", "rootfs.cpio")
178 self.emulator.boot(arch="armv7",
180 options=["-initrd", img])
181 self.emulator.login()
183 class TestExternalToolchainCtngMusl(TestExternalToolchain):
184 config = BASIC_CONFIG + \
189 BR2_TOOLCHAIN_EXTERNAL=y
190 BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
191 BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
192 BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.net/toolchains/tarballs/arm-ctng-linux-musleabihf.tar.xz"
193 BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-ctng-linux-musleabihf"
194 BR2_TOOLCHAIN_EXTERNAL_GCC_7=y
195 BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y
196 BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
197 BR2_TOOLCHAIN_EXTERNAL_CXX=y
199 toolchain_prefix = "arm-ctng-linux-musleabihf"
202 TestExternalToolchain.common_check(self)
203 img = os.path.join(self.builddir, "images", "rootfs.cpio")
204 self.emulator.boot(arch="armv7",
206 options=["-initrd", img])
207 self.emulator.login()
209 class TestExternalToolchainBuildrootuClibc(TestExternalToolchain):
210 config = BASIC_CONFIG + \
213 BR2_TOOLCHAIN_EXTERNAL=y
214 BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
215 BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
216 BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2017.05-444-g6c704ba.tar.bz2"
217 BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
218 BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y
219 BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
220 # BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
221 BR2_TOOLCHAIN_EXTERNAL_CXX=y
223 toolchain_prefix = "arm-linux"
226 TestExternalToolchain.common_check(self)
227 img = os.path.join(self.builddir, "images", "rootfs.cpio")
228 self.emulator.boot(arch="armv7",
230 options=["-initrd", img])
231 self.emulator.login()
233 class TestExternalToolchainCCache(TestExternalToolchainBuildrootuClibc):
237 BR2_CCACHE_DIR="{builddir}/ccache-dir"
240 def __init__(self, names):
241 super(TestExternalToolchainBuildrootuClibc, self).__init__(names)
242 self.config += self.extraconfig.format(builddir=self.builddir)