diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-04-27 10:53:15 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-27 15:05:39 +0100 |
commit | 5be62624a6537659f9f6229c82762da45909f902 (patch) | |
tree | ab8783fd28440e99714b6d00c43fd6bb922a3c36 /meta | |
parent | 5cc348c0a3016e4ccc1e80d099e2e197b3b38bd2 (diff) | |
download | openembedded-core-5be62624a6537659f9f6229c82762da45909f902.tar.gz openembedded-core-5be62624a6537659f9f6229c82762da45909f902.tar.bz2 openembedded-core-5be62624a6537659f9f6229c82762da45909f902.zip |
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.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/selftest/devtool.py | 26 |
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 |