mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:49:46 +00:00
oe-selftest: devtool: Reverting a change should trigger rebuild
Add code to verify that not only does a change trigger a build, but so does reverting that change. Reverting a change in a devtool managed git repo may cause the current checksum to match the checksum of a previous build, which will cause bitbake to skip builds that are needed. (From OE-Core rev: 58a31d8dd7293f14c70e56ec9639c420d15e7dfc) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
c782cb40d7
commit
cfa6a7aa6f
@@ -437,17 +437,33 @@ class DevtoolTests(DevtoolBase):
|
|||||||
# Check git repo
|
# Check git repo
|
||||||
self._check_src_repo(tempdir)
|
self._check_src_repo(tempdir)
|
||||||
# Try building
|
# Try building
|
||||||
bitbake('mdadm')
|
def list_stamps(globsuffix='*'):
|
||||||
|
stampprefix = get_bb_var('STAMP', 'mdadm')
|
||||||
|
self.assertTrue(stampprefix, 'Unable to get STAMP value for recipe mdadm')
|
||||||
|
return glob.glob(stampprefix + globsuffix)
|
||||||
|
|
||||||
|
numstamps = len(list_stamps('.do_compile.*'))
|
||||||
|
self.assertEqual(numstamps, 0, 'do_compile stamps before first build')
|
||||||
|
for x in range(10):
|
||||||
|
bitbake('mdadm')
|
||||||
|
nowstamps = len(list_stamps('.do_compile.*'))
|
||||||
|
if nowstamps == numstamps:
|
||||||
|
break
|
||||||
|
numstamps = nowstamps
|
||||||
|
else:
|
||||||
|
self.fail('build did not stabilize in 10 iterations')
|
||||||
|
|
||||||
# Try making (minor) modifications to the source
|
# Try making (minor) modifications to the source
|
||||||
modfile = os.path.join(tempdir, 'mdadm.8.in')
|
modfile = os.path.join(tempdir, 'mdadm.8.in')
|
||||||
result = runCmd("sed -i 's!^\.TH.*!.TH MDADM 8 \"\" v9.999-custom!' %s" % modfile)
|
result = runCmd("sed -i 's!^\.TH.*!.TH MDADM 8 \"\" v9.999-custom!' %s" % modfile)
|
||||||
sedline = ''
|
|
||||||
with open(modfile, 'r') as f:
|
def check_TH_line(checkfile, expected, message):
|
||||||
for line in f:
|
with open(checkfile, 'r') as f:
|
||||||
if line.startswith('.TH'):
|
for line in f:
|
||||||
sedline = line.rstrip()
|
if line.startswith('.TH'):
|
||||||
break
|
self.assertEqual(line.rstrip(), expected, message)
|
||||||
self.assertEqual(sedline, '.TH MDADM 8 "" v9.999-custom', 'man .in file not modified (sed failed)')
|
|
||||||
|
check_TH_line(modfile, '.TH MDADM 8 "" v9.999-custom', 'man .in file not modified (sed failed)')
|
||||||
bitbake('mdadm -c package')
|
bitbake('mdadm -c package')
|
||||||
pkgd = get_bb_var('PKGD', 'mdadm')
|
pkgd = get_bb_var('PKGD', 'mdadm')
|
||||||
self.assertTrue(pkgd, 'Could not query PKGD variable')
|
self.assertTrue(pkgd, 'Could not query PKGD variable')
|
||||||
@@ -456,18 +472,24 @@ class DevtoolTests(DevtoolBase):
|
|||||||
if mandir[0] == '/':
|
if mandir[0] == '/':
|
||||||
mandir = mandir[1:]
|
mandir = mandir[1:]
|
||||||
manfile = os.path.join(pkgd, mandir, 'man8', 'mdadm.8')
|
manfile = os.path.join(pkgd, mandir, 'man8', 'mdadm.8')
|
||||||
with open(manfile, 'r') as f:
|
check_TH_line(manfile, '.TH MDADM 8 "" v9.999-custom', 'man file not modified. man searched file path: %s' % manfile)
|
||||||
for line in f:
|
# Test reverting the change
|
||||||
if line.startswith('.TH'):
|
result = runCmd("git -C %s checkout -- %s" % (tempdir, modfile))
|
||||||
self.assertEqual(line.rstrip(), '.TH MDADM 8 "" v9.999-custom', 'man file not modified. man searched file path: %s' % manfile)
|
check_TH_line(modfile, '.TH MDADM 8 "" v3.4', 'man .in file not restored (git failed)')
|
||||||
|
bitbake('mdadm -c package')
|
||||||
|
pkgd = get_bb_var('PKGD', 'mdadm')
|
||||||
|
self.assertTrue(pkgd, 'Could not query PKGD variable')
|
||||||
|
mandir = get_bb_var('mandir', 'mdadm')
|
||||||
|
self.assertTrue(mandir, 'Could not query mandir variable')
|
||||||
|
if mandir[0] == '/':
|
||||||
|
mandir = mandir[1:]
|
||||||
|
manfile = os.path.join(pkgd, mandir, 'man8', 'mdadm.8')
|
||||||
|
check_TH_line(manfile, '.TH MDADM 8 "" v3.4', 'man file not updated. man searched file path: %s' % manfile)
|
||||||
# Test devtool reset
|
# Test devtool reset
|
||||||
stampprefix = get_bb_var('STAMP', 'mdadm')
|
|
||||||
result = runCmd('devtool reset mdadm')
|
result = runCmd('devtool reset mdadm')
|
||||||
result = runCmd('devtool status')
|
result = runCmd('devtool status')
|
||||||
self.assertNotIn('mdadm', result.output)
|
self.assertNotIn('mdadm', result.output)
|
||||||
self.assertTrue(stampprefix, 'Unable to get STAMP value for recipe mdadm')
|
self.assertFalse(list_stamps(), 'Stamp files exist for recipe mdadm that should have been cleaned')
|
||||||
matches = glob.glob(stampprefix + '*')
|
|
||||||
self.assertFalse(matches, 'Stamp files exist for recipe mdadm that should have been cleaned')
|
|
||||||
|
|
||||||
@testcase(1166)
|
@testcase(1166)
|
||||||
def test_devtool_modify_invalid(self):
|
def test_devtool_modify_invalid(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user