blob: f992b3736e4996169a71b8872d94a434edaccf91 [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001import os
2import tempfile
3
4from oeqa.selftest.case import OESelftestTestCase
5from oeqa.utils.commands import bitbake
6from oeqa.utils import CommandError
7from oeqa.core.decorator.oeid import OETestID
8
9class LicenseTests(OESelftestTestCase):
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 @OETestID(1197)
14 def test_nonmatching_checksum(self):
15 bitbake_cmd = '-c populate_lic emptytest'
16 error_msg = 'emptytest: The new md5 checksum is 8d777f385d3dfec8815d20f7496026dc'
17
18 lic_file, lic_path = tempfile.mkstemp()
19 os.close(lic_file)
20 self.track_for_cleanup(lic_path)
21
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080022 self.write_config("INHERIT_remove = \"report-error\"")
23
Brad Bishopd7bf8c12018-02-25 22:55:05 -050024 self.write_recipeinc('emptytest', """
25INHIBIT_DEFAULT_DEPS = "1"
26LIC_FILES_CHKSUM = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e"
27SRC_URI = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e"
28""" % (lic_path, lic_path))
29 result = bitbake(bitbake_cmd)
30
31 with open(lic_path, "w") as f:
32 f.write("data")
33
Brad Bishopd7bf8c12018-02-25 22:55:05 -050034 result = bitbake(bitbake_cmd, ignore_status=True)
35 if error_msg not in result.output:
36 raise AssertionError(result.output)