blob: f8681ed755b06b7a2e992eeb50fff74368856b9a [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
Brad Bishopd7bf8c12018-02-25 22:55:05 -050010
11class LicenseTests(OESelftestTestCase):
12
13 # Verify that changing a license file that has an absolute path causes
14 # the license qa to fail due to a mismatched md5sum.
Brad Bishopd7bf8c12018-02-25 22:55:05 -050015 def test_nonmatching_checksum(self):
16 bitbake_cmd = '-c populate_lic emptytest'
17 error_msg = 'emptytest: The new md5 checksum is 8d777f385d3dfec8815d20f7496026dc'
18
19 lic_file, lic_path = tempfile.mkstemp()
20 os.close(lic_file)
21 self.track_for_cleanup(lic_path)
22
Patrick Williams213cb262021-08-07 19:21:33 -050023 self.write_config("INHERIT:remove = \"report-error\"")
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080024
Brad Bishopd7bf8c12018-02-25 22:55:05 -050025 self.write_recipeinc('emptytest', """
26INHIBIT_DEFAULT_DEPS = "1"
27LIC_FILES_CHKSUM = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e"
28SRC_URI = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e"
29""" % (lic_path, lic_path))
30 result = bitbake(bitbake_cmd)
31
32 with open(lic_path, "w") as f:
33 f.write("data")
34
Brad Bishopd7bf8c12018-02-25 22:55:05 -050035 result = bitbake(bitbake_cmd, ignore_status=True)
36 if error_msg not in result.output:
37 raise AssertionError(result.output)