diff options
| -rw-r--r-- | meta/lib/oeqa/selftest/devtool.py | 54 |
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): |
