summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-11-28 11:34:06 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2016-12-13 19:55:02 +1300
commit6f500c68eb9b2d5dd3a708f6f8bab28b2472ef7a (patch)
tree9735095b3c16709e0f275397c217f6573bdeed66
parentb2b5d14d38ffd6de1dbe86f17545c5938e918dda (diff)
downloadopenembedded-core-contrib-6f500c68eb9b2d5dd3a708f6f8bab28b2472ef7a.tar.gz
openembedded-core-contrib-6f500c68eb9b2d5dd3a708f6f8bab28b2472ef7a.tar.bz2
openembedded-core-contrib-6f500c68eb9b2d5dd3a708f6f8bab28b2472ef7a.zip
oe-selftest: devtool: improve test_devtool_modify slightly
* Check that man .in file actually gets modified, since sed -i doesn't fail if it it doesn't * Use a variable for man file path Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--meta/lib/oeqa/selftest/devtool.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 7db286fc15..5f4e828ac8 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -439,7 +439,15 @@ class DevtoolTests(DevtoolBase):
# Try building
bitbake('mdadm')
# Try making (minor) modifications to the source
- result = runCmd("sed -i 's!^\.TH.*!.TH MDADM 8 \"\" v9.999-custom!' %s" % 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)
+ sedline = ''
+ with open(modfile, 'r') as f:
+ for line in f:
+ if line.startswith('.TH'):
+ sedline = line.rstrip()
+ break
+ self.assertEqual(sedline, '.TH MDADM 8 "" v9.999-custom', 'man .in file not modified (sed failed)')
bitbake('mdadm -c package')
pkgd = get_bb_var('PKGD', 'mdadm')
self.assertTrue(pkgd, 'Could not query PKGD variable')
@@ -447,10 +455,11 @@ class DevtoolTests(DevtoolBase):
self.assertTrue(mandir, 'Could not query mandir variable')
if mandir[0] == '/':
mandir = mandir[1:]
- with open(os.path.join(pkgd, mandir, 'man8', 'mdadm.8'), 'r') as f:
+ manfile = os.path.join(pkgd, mandir, 'man8', 'mdadm.8')
+ with open(manfile, 'r') as f:
for line in f:
if line.startswith('.TH'):
- self.assertEqual(line.rstrip(), '.TH MDADM 8 "" v9.999-custom', 'man file not modified. man searched file path: %s' % os.path.join(pkgd, mandir, 'man8', 'mdadm.8'))
+ self.assertEqual(line.rstrip(), '.TH MDADM 8 "" v9.999-custom', 'man file not modified. man searched file path: %s' % manfile)
# Test devtool reset
stampprefix = get_bb_var('STAMP', 'mdadm')
result = runCmd('devtool reset mdadm')