1import infra
2import infra.basetest
3
4
5class DetectBadArchTest(infra.basetest.BRConfigTest):
6    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + infra.basetest.MINIMAL_CONFIG
7    br2_external = [infra.filepath("tests/core/br2-external/detect-bad-arch")]
8
9    def test_run(self):
10        with self.assertRaises(SystemError):
11            self.b.build()
12        logf_path = infra.log_file_path(self.b.builddir, "build",
13                                        infra.basetest.BRConfigTest.logtofile)
14        if logf_path:
15            s = 'ERROR: architecture for "/usr/bin/foo" is'
16            with open(logf_path, "r") as f:
17                lines = [line for line in f.readlines() if line.startswith(s)]
18            self.assertEqual(len(lines), 1)
19