lic_checksum.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import os
  2. import tempfile
  3. from oeqa.selftest.case import OESelftestTestCase
  4. from oeqa.utils.commands import bitbake
  5. from oeqa.utils import CommandError
  6. from oeqa.core.decorator.oeid import OETestID
  7. class LicenseTests(OESelftestTestCase):
  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. @OETestID(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. self.write_config("INHERIT_remove = \"report-error\"")
  26. result = bitbake(bitbake_cmd, ignore_status=True)
  27. if error_msg not in result.output:
  28. raise AssertionError(result.output)