summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorOla x Nilsson <ola.x.nilsson@axis.com>2016-12-22 14:16:33 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-09 13:39:11 +0000
commitcfa6a7aa6f08ae9ae395e4b1d2d506fbcf785bf6 (patch)
tree9c3e4ff3a2eb692d0de9b6c283a4e1609c216908 /meta/lib
parentc782cb40d791e959b328998de2f77ca65546084e (diff)
downloadpoky-cfa6a7aa6f08ae9ae395e4b1d2d506fbcf785bf6.tar.gz
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>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/devtool.py54
1 files changed, 38 insertions, 16 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 19c5ccf60b..a3beefa2c2 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -437,17 +437,33 @@ class DevtoolTests(DevtoolBase):
437 # Check git repo 437 # Check git repo
438 self._check_src_repo(tempdir) 438 self._check_src_repo(tempdir)
439 # Try building 439 # Try building
440 bitbake('mdadm') 440 def list_stamps(globsuffix='*'):
441 stampprefix = get_bb_var('STAMP', 'mdadm')
442 self.assertTrue(stampprefix, 'Unable to get STAMP value for recipe mdadm')
443 return glob.glob(stampprefix + globsuffix)
444
445 numstamps = len(list_stamps('.do_compile.*'))
446 self.assertEqual(numstamps, 0, 'do_compile stamps before first build')
447 for x in range(10):
448 bitbake('mdadm')
449 nowstamps = len(list_stamps('.do_compile.*'))
450 if nowstamps == numstamps:
451 break
452 numstamps = nowstamps
453 else:
454 self.fail('build did not stabilize in 10 iterations')
455
441 # Try making (minor) modifications to the source 456 # Try making (minor) modifications to the source
442 modfile = os.path.join(tempdir, 'mdadm.8.in') 457 modfile = os.path.join(tempdir, 'mdadm.8.in')
443 result = runCmd("sed -i 's!^\.TH.*!.TH MDADM 8 \"\" v9.999-custom!' %s" % modfile) 458 result = runCmd("sed -i 's!^\.TH.*!.TH MDADM 8 \"\" v9.999-custom!' %s" % modfile)
444 sedline = '' 459
445 with open(modfile, 'r') as f: 460 def check_TH_line(checkfile, expected, message):
446 for line in f: 461 with open(checkfile, 'r') as f:
447 if line.startswith('.TH'): 462 for line in f:
448 sedline = line.rstrip() 463 if line.startswith('.TH'):
449 break 464 self.assertEqual(line.rstrip(), expected, message)
450 self.assertEqual(sedline, '.TH MDADM 8 "" v9.999-custom', 'man .in file not modified (sed failed)') 465
466 check_TH_line(modfile, '.TH MDADM 8 "" v9.999-custom', 'man .in file not modified (sed failed)')
451 bitbake('mdadm -c package') 467 bitbake('mdadm -c package')
452 pkgd = get_bb_var('PKGD', 'mdadm') 468 pkgd = get_bb_var('PKGD', 'mdadm')
453 self.assertTrue(pkgd, 'Could not query PKGD variable') 469 self.assertTrue(pkgd, 'Could not query PKGD variable')
@@ -456,18 +472,24 @@ class DevtoolTests(DevtoolBase):
456 if mandir[0] == '/': 472 if mandir[0] == '/':
457 mandir = mandir[1:] 473 mandir = mandir[1:]
458 manfile = os.path.join(pkgd, mandir, 'man8', 'mdadm.8') 474 manfile = os.path.join(pkgd, mandir, 'man8', 'mdadm.8')
459 with open(manfile, 'r') as f: 475 check_TH_line(manfile, '.TH MDADM 8 "" v9.999-custom', 'man file not modified. man searched file path: %s' % manfile)
460 for line in f: 476 # Test reverting the change
461 if line.startswith('.TH'): 477 result = runCmd("git -C %s checkout -- %s" % (tempdir, modfile))
462 self.assertEqual(line.rstrip(), '.TH MDADM 8 "" v9.999-custom', 'man file not modified. man searched file path: %s' % manfile) 478 check_TH_line(modfile, '.TH MDADM 8 "" v3.4', 'man .in file not restored (git failed)')
479 bitbake('mdadm -c package')
480 pkgd = get_bb_var('PKGD', 'mdadm')
481 self.assertTrue(pkgd, 'Could not query PKGD variable')
482 mandir = get_bb_var('mandir', 'mdadm')
483 self.assertTrue(mandir, 'Could not query mandir variable')
484 if mandir[0] == '/':
485 mandir = mandir[1:]
486 manfile = os.path.join(pkgd, mandir, 'man8', 'mdadm.8')
487 check_TH_line(manfile, '.TH MDADM 8 "" v3.4', 'man file not updated. man searched file path: %s' % manfile)
463 # Test devtool reset 488 # Test devtool reset
464 stampprefix = get_bb_var('STAMP', 'mdadm')
465 result = runCmd('devtool reset mdadm') 489 result = runCmd('devtool reset mdadm')
466 result = runCmd('devtool status') 490 result = runCmd('devtool status')
467 self.assertNotIn('mdadm', result.output) 491 self.assertNotIn('mdadm', result.output)
468 self.assertTrue(stampprefix, 'Unable to get STAMP value for recipe mdadm') 492 self.assertFalse(list_stamps(), 'Stamp files exist for recipe mdadm that should have been cleaned')
469 matches = glob.glob(stampprefix + '*')
470 self.assertFalse(matches, 'Stamp files exist for recipe mdadm that should have been cleaned')
471 493
472 @testcase(1166) 494 @testcase(1166)
473 def test_devtool_modify_invalid(self): 495 def test_devtool_modify_invalid(self):