blob: bd3b9a1ba349aad004f9eafe49d5e87fde7968e1 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001import os
2import tempfile
3
4from oeqa.selftest.base import oeSelfTest
5from oeqa.utils.commands import bitbake
6from oeqa.utils import CommandError
7from oeqa.utils.decorators import testcase
8
9class 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'
16 error_msg = 'ERROR: 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
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)