Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | # |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
| 7 | import uuid |
| 8 | |
| 9 | from oeqa.selftest.case import OESelftestTestCase |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 10 | from oeqa.utils.commands import bitbake |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 11 | |
| 12 | class 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(""" |
| 27 | PREFERRED_PROVIDER_virtual/sysroot-test = "sysroot-test-arch1" |
| 28 | MACHINE = "qemux86" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 29 | TESTSTRING:pn-sysroot-test-arch1 = "%s" |
| 30 | TESTSTRING:pn-sysroot-test-arch2 = "%s" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 31 | """ % (uuid1, uuid2)) |
| 32 | bitbake("sysroot-test") |
| 33 | self.write_config(""" |
| 34 | PREFERRED_PROVIDER_virtual/sysroot-test = "sysroot-test-arch2" |
| 35 | MACHINE = "qemux86copy" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 36 | TESTSTRING:pn-sysroot-test-arch1 = "%s" |
| 37 | TESTSTRING:pn-sysroot-test-arch2 = "%s" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 38 | """ % (uuid1, uuid2)) |
| 39 | bitbake("sysroot-test") |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 40 | |
| 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) |