Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
| 2 | # SPDX-License-Identifier: MIT |
| 3 | # |
| 4 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 5 | import os |
| 6 | import tempfile |
| 7 | |
| 8 | from oeqa.selftest.case import OESelftestTestCase |
| 9 | from oeqa.utils.commands import bitbake |
| 10 | from oeqa.utils import CommandError |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 11 | |
| 12 | class LicenseTests(OESelftestTestCase): |
| 13 | |
| 14 | # Verify that changing a license file that has an absolute path causes |
| 15 | # the license qa to fail due to a mismatched md5sum. |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 16 | def test_nonmatching_checksum(self): |
| 17 | bitbake_cmd = '-c populate_lic emptytest' |
| 18 | error_msg = 'emptytest: The new md5 checksum is 8d777f385d3dfec8815d20f7496026dc' |
| 19 | |
| 20 | lic_file, lic_path = tempfile.mkstemp() |
| 21 | os.close(lic_file) |
| 22 | self.track_for_cleanup(lic_path) |
| 23 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 24 | self.write_config("INHERIT:remove = \"report-error\"") |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 25 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 26 | self.write_recipeinc('emptytest', """ |
| 27 | INHIBIT_DEFAULT_DEPS = "1" |
| 28 | LIC_FILES_CHKSUM = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e" |
| 29 | SRC_URI = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e" |
| 30 | """ % (lic_path, lic_path)) |
| 31 | result = bitbake(bitbake_cmd) |
| 32 | |
| 33 | with open(lic_path, "w") as f: |
| 34 | f.write("data") |
| 35 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 36 | result = bitbake(bitbake_cmd, ignore_status=True) |
| 37 | if error_msg not in result.output: |
| 38 | raise AssertionError(result.output) |