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