oescripts.py 1.6 KB

1234567891011121314151617181920212223242526
  1. from oeqa.selftest.case import OESelftestTestCase
  2. from oeqa.selftest.cases.buildhistory import BuildhistoryBase
  3. from oeqa.utils.commands import Command, runCmd, bitbake, get_bb_var, get_test_layer
  4. class BuildhistoryDiffTests(BuildhistoryBase):
  5. def test_buildhistory_diff(self):
  6. target = 'xcursor-transparent-theme'
  7. self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True)
  8. self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True)
  9. result = runCmd("oe-pkgdata-util read-value PKGV %s" % target)
  10. pkgv = result.output.rstrip()
  11. result = runCmd("buildhistory-diff -p %s" % get_bb_var('BUILDHISTORY_DIR'))
  12. expected_endlines = [
  13. "xcursor-transparent-theme-dev: RDEPENDS: removed \"xcursor-transparent-theme (['= %s-r1'])\", added \"xcursor-transparent-theme (['= %s-r0'])\"" % (pkgv, pkgv),
  14. "xcursor-transparent-theme-staticdev: RDEPENDS: removed \"xcursor-transparent-theme-dev (['= %s-r1'])\", added \"xcursor-transparent-theme-dev (['= %s-r0'])\"" % (pkgv, pkgv)
  15. ]
  16. for line in result.output.splitlines():
  17. for el in expected_endlines:
  18. if line.endswith(el):
  19. expected_endlines.remove(el)
  20. break
  21. else:
  22. self.fail('Unexpected line:\n%s\nExpected line endings:\n %s' % (line, '\n '.join(expected_endlines)))
  23. if expected_endlines:
  24. self.fail('Missing expected line endings:\n %s' % '\n '.join(expected_endlines))