blob: 91021ac335062e34db01099aeb7370626dc6aaf8 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
2# SPDX-License-Identifier: MIT
3#
4
Brad Bishopd7bf8c12018-02-25 22:55:05 -05005import os
6import tempfile
7
8from oeqa.selftest.case import OESelftestTestCase
9from oeqa.utils.commands import bitbake
10from oeqa.utils import CommandError
Brad Bishopd7bf8c12018-02-25 22:55:05 -050011
12class 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 Bishopd7bf8c12018-02-25 22:55:05 -050016 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 Williams213cb262021-08-07 19:21:33 -050024 self.write_config("INHERIT:remove = \"report-error\"")
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080025
Brad Bishopd7bf8c12018-02-25 22:55:05 -050026 self.write_recipeinc('emptytest', """
27INHIBIT_DEFAULT_DEPS = "1"
28LIC_FILES_CHKSUM = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e"
29SRC_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 Bishopd7bf8c12018-02-25 22:55:05 -050036 result = bitbake(bitbake_cmd, ignore_status=True)
37 if error_msg not in result.output:
38 raise AssertionError(result.output)