lic-checksum.py 1.1 KB

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