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:51 +0100 |
| commit | a8c7558c76bb5f512d3aca4e3bbb1158635601c8 (patch) | |
| tree | b039e77e7efcd68e28257d4e914e3a078e649b05 | |
| parent | 240b4ef3c6ce9612d53d85ea68fab6172bafe471 (diff) | |
| download | poky-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.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): | |||
| 370 | recipefile = get_bb_var('FILE', testrecipe) | 370 | recipefile = get_bb_var('FILE', testrecipe) |
| 371 | src_uri = get_bb_var('SRC_URI', testrecipe) | 371 | src_uri = get_bb_var('SRC_URI', testrecipe) |
| 372 | self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe) | 372 | self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe) |
| 373 | patches = [] | ||
| 374 | for entry in src_uri.split(): | ||
| 375 | if entry.startswith('file://') and entry.endswith('.patch'): | ||
| 376 | patches.append(entry[7:].split(';')[0]) | ||
| 377 | self.assertGreater(len(patches), 0, 'The %s recipe does not appear to contain any patches, so this test will not be effective' % testrecipe) | ||
| 373 | result = runCmd('git status . --porcelain', cwd=os.path.dirname(recipefile)) | 378 | result = runCmd('git status . --porcelain', cwd=os.path.dirname(recipefile)) |
| 374 | self.assertEqual(result.output.strip(), "", '%s recipe is not clean' % testrecipe) | 379 | self.assertEqual(result.output.strip(), "", '%s recipe is not clean' % testrecipe) |
| 375 | # First, modify a recipe | 380 | # First, modify a recipe |
| @@ -397,19 +402,22 @@ class DevtoolTests(oeSelfTest): | |||
| 397 | result = runCmd('git status . --porcelain', cwd=os.path.dirname(recipefile)) | 402 | result = runCmd('git status . --porcelain', cwd=os.path.dirname(recipefile)) |
| 398 | self.assertNotEqual(result.output.strip(), "", '%s recipe should be modified' % testrecipe) | 403 | self.assertNotEqual(result.output.strip(), "", '%s recipe should be modified' % testrecipe) |
| 399 | status = result.output.splitlines() | 404 | status = result.output.splitlines() |
| 400 | self.assertEqual(len(status), 3, 'Less/more files modified than expected. Entire status:\n%s' % result.output) | ||
| 401 | for line in status: | 405 | for line in status: |
| 402 | if line.endswith('add-exclusion-to-mkfs-jffs2-git-2.patch'): | 406 | for patch in patches: |
| 403 | self.assertEqual(line[:3], ' D ', 'Unexpected status in line: %s' % line) | 407 | if line.endswith(patch): |
| 404 | elif line.endswith('fix-armv7-neon-alignment.patch'): | 408 | self.assertEqual(line[:3], ' D ', 'Unexpected status in line: %s' % line) |
| 405 | self.assertEqual(line[:3], ' D ', 'Unexpected status in line: %s' % line) | 409 | break |
| 406 | elif re.search('%s_[^_]*.bb$' % testrecipe, line): | ||
| 407 | self.assertEqual(line[:3], ' M ', 'Unexpected status in line: %s' % line) | ||
| 408 | else: | 410 | else: |
| 409 | raise AssertionError('Unexpected modified file in status: %s' % line) | 411 | if re.search('%s_[^_]*.bb$' % testrecipe, line): |
| 412 | self.assertEqual(line[:3], ' M ', 'Unexpected status in line: %s' % line) | ||
| 413 | else: | ||
| 414 | raise AssertionError('Unexpected modified file in status: %s' % line) | ||
| 410 | result = runCmd('git diff %s' % os.path.basename(recipefile), cwd=os.path.dirname(recipefile)) | 415 | result = runCmd('git diff %s' % os.path.basename(recipefile), cwd=os.path.dirname(recipefile)) |
| 411 | addlines = ['SRCREV = ".*"', 'SRC_URI = "git://git.infradead.org/mtd-utils.git"'] | 416 | addlines = ['SRCREV = ".*"', 'SRC_URI = "git://git.infradead.org/mtd-utils.git"'] |
| 412 | 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 \\\\', '"'] | 417 | srcurilines = src_uri.split() |
| 418 | srcurilines[0] = 'SRC_URI = "' + srcurilines[0] | ||
| 419 | srcurilines.append('"') | ||
| 420 | removelines = ['SRCREV = ".*"'] + srcurilines | ||
| 413 | for line in result.output.splitlines(): | 421 | for line in result.output.splitlines(): |
| 414 | if line.startswith('+++') or line.startswith('---'): | 422 | if line.startswith('+++') or line.startswith('---'): |
| 415 | continue | 423 | continue |
