aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-04-27 10:53:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-27 15:05:51 +0100
commita8c7558c76bb5f512d3aca4e3bbb1158635601c8 (patch)
treeb039e77e7efcd68e28257d4e914e3a078e649b05
parent240b4ef3c6ce9612d53d85ea68fab6172bafe471 (diff)
downloadopenembedded-core-contrib-a8c7558c76bb5f512d3aca4e3bbb1158635601c8.tar.gz
oe-selftest: devtool: fix test_devtool_update_recipe_git
Make this test work after recent changes to the mtd-utils recipe, and hopefully make it robust against any future changes. (From OE-Core rev: 5be62624a6537659f9f6229c82762da45909f902) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/devtool.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index dc1cf21064..1a5eecd84c 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -370,6 +370,11 @@ class DevtoolTests(oeSelfTest):
recipefile = get_bb_var('FILE', testrecipe)
src_uri = get_bb_var('SRC_URI', testrecipe)
self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe)
+ patches = []
+ for entry in src_uri.split():
+ if entry.startswith('file://') and entry.endswith('.patch'):
+ patches.append(entry[7:].split(';')[0])
+ self.assertGreater(len(patches), 0, 'The %s recipe does not appear to contain any patches, so this test will not be effective' % testrecipe)
result = runCmd('git status . --porcelain', cwd=os.path.dirname(recipefile))
self.assertEqual(result.output.strip(), "", '%s recipe is not clean' % testrecipe)
# First, modify a recipe
@@ -397,19 +402,22 @@ class DevtoolTests(oeSelfTest):
result = runCmd('git status . --porcelain', cwd=os.path.dirname(recipefile))
self.assertNotEqual(result.output.strip(), "", '%s recipe should be modified' % testrecipe)
status = result.output.splitlines()
- self.assertEqual(len(status), 3, 'Less/more files modified than expected. Entire status:\n%s' % result.output)
for line in status:
- if line.endswith('add-exclusion-to-mkfs-jffs2-git-2.patch'):
- self.assertEqual(line[:3], ' D ', 'Unexpected status in line: %s' % line)
- elif line.endswith('fix-armv7-neon-alignment.patch'):
- self.assertEqual(line[:3], ' D ', 'Unexpected status in line: %s' % line)
- elif re.search('%s_[^_]*.bb$' % testrecipe, line):
- self.assertEqual(line[:3], ' M ', 'Unexpected status in line: %s' % line)
+ for patch in patches:
+ if line.endswith(patch):
+ self.assertEqual(line[:3], ' D ', 'Unexpected status in line: %s' % line)
+ break
else:
- raise AssertionError('Unexpected modified file in status: %s' % line)
+ if re.search('%s_[^_]*.bb$' % testrecipe, line):
+ self.assertEqual(line[:3], ' M ', 'Unexpected status in line: %s' % line)
+ else:
+ raise AssertionError('Unexpected modified file in status: %s' % line)
result = runCmd('git diff %s' % os.path.basename(recipefile), cwd=os.path.dirname(recipefile))
addlines = ['SRCREV = ".*"', 'SRC_URI = "git://git.infradead.org/mtd-utils.git"']
- removelines = ['SRCREV = ".*"', 'SRC_URI = "git://git.infradead.org/mtd-utils.git \\\\', 'file://add-exclusion-to-mkfs-jffs2-git-2.patch \\\\', 'file://fix-armv7-neon-alignment.patch \\\\', '"']
+ srcurilines = src_uri.split()
+ srcurilines[0] = 'SRC_URI = "' + srcurilines[0]
+ srcurilines.append('"')
+ removelines = ['SRCREV = ".*"'] + srcurilines
for line in result.output.splitlines():
if line.startswith('+++') or line.startswith('---'):
continue