diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-08-31 11:54:10 +1200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-31 23:30:02 +0100 |
| commit | 3be475019f5a707e1d899de1384c6e7b84836e28 (patch) | |
| tree | 9fcfcb89b851a2e051ec58a302e0ba8df8923b5f | |
| parent | dd5ceaefc0a782a5aecc5940bdb3b4a0551c7961 (diff) | |
| download | poky-3be475019f5a707e1d899de1384c6e7b84836e28.tar.gz | |
oe-selftest: devtool: test find-recipe and edit-recipe
We weren't testing the devtool find-recipe and edit-recipe subcommands,
with the result that when they regressed recently we didn't notice. Add
some code into the test_devtool_add to test this (since we need a
recipe in the workspace, and adding a new test with all that preamble
would seem a bit excessive for these simple checks). Also take the
opportunity to refactor the test a little bit so that the recipe name
and version are variables rather than hardcoding them everywhere.
(From OE-Core rev: 355d8f42679e37610c2947dece597ed7db774bee)
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/cases/devtool.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 88d69724f9..c17131a56d 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
| @@ -194,26 +194,35 @@ class DevtoolTests(DevtoolBase): | |||
| 194 | # Fetch source | 194 | # Fetch source |
| 195 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 195 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
| 196 | self.track_for_cleanup(tempdir) | 196 | self.track_for_cleanup(tempdir) |
| 197 | pn = 'pv' | ||
| 198 | pv = '1.5.3' | ||
| 197 | url = 'http://www.ivarch.com/programs/sources/pv-1.5.3.tar.bz2' | 199 | url = 'http://www.ivarch.com/programs/sources/pv-1.5.3.tar.bz2' |
| 198 | result = runCmd('wget %s' % url, cwd=tempdir) | 200 | result = runCmd('wget %s' % url, cwd=tempdir) |
| 199 | result = runCmd('tar xfv pv-1.5.3.tar.bz2', cwd=tempdir) | 201 | result = runCmd('tar xfv %s' % os.path.basename(url), cwd=tempdir) |
| 200 | srcdir = os.path.join(tempdir, 'pv-1.5.3') | 202 | srcdir = os.path.join(tempdir, '%s-%s' % (pn, pv)) |
| 201 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure')), 'Unable to find configure script in source directory') | 203 | self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure')), 'Unable to find configure script in source directory') |
| 202 | # Test devtool add | 204 | # Test devtool add |
| 203 | self.track_for_cleanup(self.workspacedir) | 205 | self.track_for_cleanup(self.workspacedir) |
| 204 | self.add_command_to_tearDown('bitbake -c cleansstate pv') | 206 | self.add_command_to_tearDown('bitbake -c cleansstate %s' % pn) |
| 205 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | 207 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') |
| 206 | result = runCmd('devtool add pv %s' % srcdir) | 208 | result = runCmd('devtool add %s %s' % (pn, srcdir)) |
| 207 | self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') | 209 | self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') |
| 208 | # Test devtool status | 210 | # Test devtool status |
| 209 | result = runCmd('devtool status') | 211 | result = runCmd('devtool status') |
| 210 | self.assertIn('pv', result.output) | 212 | recipepath = '%s/recipes/%s/%s_%s.bb' % (self.workspacedir, pn, pn, pv) |
| 213 | self.assertIn(recipepath, result.output) | ||
| 211 | self.assertIn(srcdir, result.output) | 214 | self.assertIn(srcdir, result.output) |
| 215 | # Test devtool find-recipe | ||
| 216 | result = runCmd('devtool -q find-recipe %s' % pn) | ||
| 217 | self.assertEqual(recipepath, result.output.strip()) | ||
| 218 | # Test devtool edit-recipe | ||
| 219 | result = runCmd('EDITOR="echo 123" devtool -q edit-recipe %s' % pn) | ||
| 220 | self.assertEqual('123 %s' % recipepath, result.output.strip()) | ||
| 212 | # Clean up anything in the workdir/sysroot/sstate cache (have to do this *after* devtool add since the recipe only exists then) | 221 | # Clean up anything in the workdir/sysroot/sstate cache (have to do this *after* devtool add since the recipe only exists then) |
| 213 | bitbake('pv -c cleansstate') | 222 | bitbake('%s -c cleansstate' % pn) |
| 214 | # Test devtool build | 223 | # Test devtool build |
| 215 | result = runCmd('devtool build pv') | 224 | result = runCmd('devtool build %s' % pn) |
| 216 | bb_vars = get_bb_vars(['D', 'bindir'], 'pv') | 225 | bb_vars = get_bb_vars(['D', 'bindir'], pn) |
| 217 | installdir = bb_vars['D'] | 226 | installdir = bb_vars['D'] |
| 218 | self.assertTrue(installdir, 'Could not query installdir variable') | 227 | self.assertTrue(installdir, 'Could not query installdir variable') |
| 219 | bindir = bb_vars['bindir'] | 228 | bindir = bb_vars['bindir'] |
