blob: ef854f6feebb63ebc1e58a551b23f89f3f9b76f7 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001#
Patrick Williams92b42cb2022-09-03 06:53:57 -05002# Copyright OpenEmbedded Contributors
3#
Andrew Geissler82c905d2020-04-13 13:39:40 -05004# SPDX-License-Identifier: MIT
5#
6
7import uuid
8
9from oeqa.selftest.case import OESelftestTestCase
Patrick Williams45852732022-04-02 08:58:32 -050010from oeqa.utils.commands import bitbake
Andrew Geissler82c905d2020-04-13 13:39:40 -050011
12class SysrootTests(OESelftestTestCase):
13 def test_sysroot_cleanup(self):
14 """
15 Build sysroot test which depends on virtual/sysroot-test for one machine,
16 switch machine, switch provider of virtual/sysroot-test and check that the
17 sysroot is correctly cleaned up. The files in the two providers overlap
18 so can cause errors if the sysroot code doesn't function correctly.
19 Yes, sysroot-test should be machine specific really to avoid this, however
20 the sysroot cleanup should also work [YOCTO #13702].
21 """
22
23 uuid1 = uuid.uuid4()
24 uuid2 = uuid.uuid4()
25
26 self.write_config("""
27PREFERRED_PROVIDER_virtual/sysroot-test = "sysroot-test-arch1"
28MACHINE = "qemux86"
Patrick Williams213cb262021-08-07 19:21:33 -050029TESTSTRING:pn-sysroot-test-arch1 = "%s"
30TESTSTRING:pn-sysroot-test-arch2 = "%s"
Andrew Geissler82c905d2020-04-13 13:39:40 -050031""" % (uuid1, uuid2))
32 bitbake("sysroot-test")
33 self.write_config("""
34PREFERRED_PROVIDER_virtual/sysroot-test = "sysroot-test-arch2"
35MACHINE = "qemux86copy"
Patrick Williams213cb262021-08-07 19:21:33 -050036TESTSTRING:pn-sysroot-test-arch1 = "%s"
37TESTSTRING:pn-sysroot-test-arch2 = "%s"
Andrew Geissler82c905d2020-04-13 13:39:40 -050038""" % (uuid1, uuid2))
39 bitbake("sysroot-test")
Andrew Geissler615f2f12022-07-15 14:00:58 -050040
41 def test_sysroot_max_shebang(self):
42 """
43 Summary: Check max shebang triggers. To confirm [YOCTO #11053] is closed.
44 Expected: Fail when a shebang bigger than the max shebang-size is reached.
45 Author: Paulo Neves <ptsneves@gmail.com>
46 """
47 expected = "maximum shebang size exceeded, the maximum size is 128. [shebang-size]"
48 res = bitbake("sysroot-shebang-test-native -c populate_sysroot", ignore_status=True)
49 self.assertTrue(expected in res.output, msg=res.output)
50 self.assertTrue(res.status != 0)
51
52 def test_sysroot_la(self):
53 """
54 Summary: Check that workdir paths are not contained in .la files.
55 Expected: Fail when a workdir path is found in the file content.
56 Author: Paulo Neves <ptsneves@gmail.com>
57 """
58 expected = "la-test.la failed sanity test (workdir) in path"
59
60 res = bitbake("sysroot-la-test -c populate_sysroot", ignore_status=True)
61 self.assertTrue(expected in res.output, msg=res.output)
62 self.assertTrue('[la]' in res.output, msg=res.output)
63 self.assertTrue(res.status != 0)
64
65 res = bitbake("sysroot-la-test-native -c populate_sysroot", ignore_status=True)
66 self.assertTrue(expected in res.output, msg=res.output)
67 self.assertTrue('[la]' in res.output, msg=res.output)
68 self.assertTrue(res.status != 0)
69
70 def test_sysroot_pkgconfig(self):
71 """
72 Summary: Check that tmpdir paths are not contained in .pc files.
73 Expected: Fail when a tmpdir path is found in the file content.
74 Author: Paulo Neves <ptsneves@gmail.com>
75 """
76 expected = "test.pc failed sanity test (tmpdir) in path"
77
78 res = bitbake("sysroot-pc-test -c populate_sysroot", ignore_status=True)
79 self.assertTrue('[pkgconfig]' in res.output, msg=res.output)
80 self.assertTrue(expected in res.output, msg=res.output)
81 self.assertTrue(res.status != 0)
82
83 res = bitbake("sysroot-pc-test-native -c populate_sysroot", ignore_status=True)
84 self.assertTrue(expected in res.output, msg=res.output)
85 self.assertTrue('[pkgconfig]' in res.output, msg=res.output)
86 self.assertTrue(res.status != 0)