blob: bcdc2d5ac07396ceaf77a4108bc76d8ac9e2300f [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001from oeqa.selftest.case import OESelftestTestCase
2from oeqa.selftest.cases.buildhistory import BuildhistoryBase
3from oeqa.utils.commands import Command, runCmd, bitbake, get_bb_var, get_test_layer
4from oeqa.core.decorator.oeid import OETestID
5
6class BuildhistoryDiffTests(BuildhistoryBase):
7
8 @OETestID(295)
9 def test_buildhistory_diff(self):
10 target = 'xcursor-transparent-theme'
11 self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True)
12 self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080013 result = runCmd("oe-pkgdata-util read-value PKGV %s" % target)
14 pkgv = result.output.rstrip()
Brad Bishopd7bf8c12018-02-25 22:55:05 -050015 result = runCmd("buildhistory-diff -p %s" % get_bb_var('BUILDHISTORY_DIR'))
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080016 expected_endlines = [
17 "xcursor-transparent-theme-dev: RDEPENDS: removed \"xcursor-transparent-theme (['= %s-r1'])\", added \"xcursor-transparent-theme (['= %s-r0'])\"" % (pkgv, pkgv),
18 "xcursor-transparent-theme-staticdev: RDEPENDS: removed \"xcursor-transparent-theme-dev (['= %s-r1'])\", added \"xcursor-transparent-theme-dev (['= %s-r0'])\"" % (pkgv, pkgv)
19 ]
20 for line in result.output.splitlines():
21 for el in expected_endlines:
22 if line.endswith(el):
23 expected_endlines.remove(el)
24 break
25 else:
26 self.fail('Unexpected line:\n%s\nExpected line endings:\n %s' % (line, '\n '.join(expected_endlines)))
27 if expected_endlines:
28 self.fail('Missing expected line endings:\n %s' % '\n '.join(expected_endlines))