Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | import os |
| 2 | import tempfile |
| 3 | |
| 4 | from oeqa.selftest.base import oeSelfTest |
| 5 | from oeqa.utils.commands import bitbake |
| 6 | from oeqa.utils import CommandError |
| 7 | from oeqa.utils.decorators import testcase |
| 8 | |
| 9 | class LicenseTests(oeSelfTest): |
| 10 | |
| 11 | # Verify that changing a license file that has an absolute path causes |
| 12 | # the license qa to fail due to a mismatched md5sum. |
| 13 | @testcase(1197) |
| 14 | def test_nonmatching_checksum(self): |
| 15 | bitbake_cmd = '-c configure emptytest' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 16 | error_msg = 'emptytest: The new md5 checksum is 8d777f385d3dfec8815d20f7496026dc' |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 17 | |
| 18 | lic_file, lic_path = tempfile.mkstemp() |
| 19 | os.close(lic_file) |
| 20 | self.track_for_cleanup(lic_path) |
| 21 | |
| 22 | self.write_recipeinc('emptytest', 'INHIBIT_DEFAULT_DEPS = "1"') |
| 23 | self.append_recipeinc('emptytest', 'LIC_FILES_CHKSUM = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e"' % lic_path) |
| 24 | result = bitbake(bitbake_cmd) |
| 25 | |
| 26 | with open(lic_path, "w") as f: |
| 27 | f.write("data") |
| 28 | |
| 29 | result = bitbake(bitbake_cmd, ignore_status=True) |
| 30 | if error_msg not in result.output: |
| 31 | raise AssertionError(result.output) |