mirror of
https://git.yoctoproject.org/poky
synced 2026-09-29 07:36:20 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
dd5ceaefc0
commit
3be475019f
@@ -194,26 +194,35 @@ class DevtoolTests(DevtoolBase):
|
|||||||
# Fetch source
|
# Fetch source
|
||||||
tempdir = tempfile.mkdtemp(prefix='devtoolqa')
|
tempdir = tempfile.mkdtemp(prefix='devtoolqa')
|
||||||
self.track_for_cleanup(tempdir)
|
self.track_for_cleanup(tempdir)
|
||||||
|
pn = 'pv'
|
||||||
|
pv = '1.5.3'
|
||||||
url = 'http://www.ivarch.com/programs/sources/pv-1.5.3.tar.bz2'
|
url = 'http://www.ivarch.com/programs/sources/pv-1.5.3.tar.bz2'
|
||||||
result = runCmd('wget %s' % url, cwd=tempdir)
|
result = runCmd('wget %s' % url, cwd=tempdir)
|
||||||
result = runCmd('tar xfv pv-1.5.3.tar.bz2', cwd=tempdir)
|
result = runCmd('tar xfv %s' % os.path.basename(url), cwd=tempdir)
|
||||||
srcdir = os.path.join(tempdir, 'pv-1.5.3')
|
srcdir = os.path.join(tempdir, '%s-%s' % (pn, pv))
|
||||||
self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure')), 'Unable to find configure script in source directory')
|
self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure')), 'Unable to find configure script in source directory')
|
||||||
# Test devtool add
|
# Test devtool add
|
||||||
self.track_for_cleanup(self.workspacedir)
|
self.track_for_cleanup(self.workspacedir)
|
||||||
self.add_command_to_tearDown('bitbake -c cleansstate pv')
|
self.add_command_to_tearDown('bitbake -c cleansstate %s' % pn)
|
||||||
self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
|
self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
|
||||||
result = runCmd('devtool add pv %s' % srcdir)
|
result = runCmd('devtool add %s %s' % (pn, srcdir))
|
||||||
self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created')
|
self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created')
|
||||||
# Test devtool status
|
# Test devtool status
|
||||||
result = runCmd('devtool status')
|
result = runCmd('devtool status')
|
||||||
self.assertIn('pv', result.output)
|
recipepath = '%s/recipes/%s/%s_%s.bb' % (self.workspacedir, pn, pn, pv)
|
||||||
|
self.assertIn(recipepath, result.output)
|
||||||
self.assertIn(srcdir, result.output)
|
self.assertIn(srcdir, result.output)
|
||||||
|
# Test devtool find-recipe
|
||||||
|
result = runCmd('devtool -q find-recipe %s' % pn)
|
||||||
|
self.assertEqual(recipepath, result.output.strip())
|
||||||
|
# Test devtool edit-recipe
|
||||||
|
result = runCmd('EDITOR="echo 123" devtool -q edit-recipe %s' % pn)
|
||||||
|
self.assertEqual('123 %s' % recipepath, result.output.strip())
|
||||||
# Clean up anything in the workdir/sysroot/sstate cache (have to do this *after* devtool add since the recipe only exists then)
|
# Clean up anything in the workdir/sysroot/sstate cache (have to do this *after* devtool add since the recipe only exists then)
|
||||||
bitbake('pv -c cleansstate')
|
bitbake('%s -c cleansstate' % pn)
|
||||||
# Test devtool build
|
# Test devtool build
|
||||||
result = runCmd('devtool build pv')
|
result = runCmd('devtool build %s' % pn)
|
||||||
bb_vars = get_bb_vars(['D', 'bindir'], 'pv')
|
bb_vars = get_bb_vars(['D', 'bindir'], pn)
|
||||||
installdir = bb_vars['D']
|
installdir = bb_vars['D']
|
||||||
self.assertTrue(installdir, 'Could not query installdir variable')
|
self.assertTrue(installdir, 'Could not query installdir variable')
|
||||||
bindir = bb_vars['bindir']
|
bindir = bb_vars['bindir']
|
||||||
|
|||||||
Reference in New Issue
Block a user