diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-12-22 17:03:18 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-22 16:44:04 +0000 |
commit | 7c7df9f62fe15578af0420c63e320c317e058708 (patch) | |
tree | 3c373f16c23c6af76ceb47df53507dd74d61037b /meta/lib/oeqa/selftest/devtool.py | |
parent | 91714a52e91cddba5a16c73cf5765d1f47f7856c (diff) | |
download | openembedded-core-contrib-7c7df9f62fe15578af0420c63e320c317e058708.tar.gz |
oe-selftest: add tests for simple devtool add / recipetool create URL case
Add an oe-selftest test case for the newly supported syntax with only
the remote URL specified (auto-detecting name and version).
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/devtool.py')
-rw-r--r-- | meta/lib/oeqa/selftest/devtool.py | 63 |
1 files changed, 57 insertions, 6 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py index 7af82df632..41e1b4bf51 100644 --- a/meta/lib/oeqa/selftest/devtool.py +++ b/meta/lib/oeqa/selftest/devtool.py @@ -15,18 +15,43 @@ class DevtoolBase(oeSelfTest): def _test_recipe_contents(self, recipefile, checkvars, checkinherits): with open(recipefile, 'r') as f: + invar = None + invalue = None for line in f: - if '=' in line: + var = None + if invar: + value = line.strip().strip('"') + if value.endswith('\\'): + invalue += ' ' + value[:-1].strip() + continue + else: + invalue += ' ' + value.strip() + var = invar + value = invalue + invar = None + elif '=' in line: splitline = line.split('=', 1) var = splitline[0].rstrip() value = splitline[1].strip().strip('"') - if var in checkvars: - needvalue = checkvars.pop(var) - self.assertEqual(value, needvalue, 'values for %s do not match' % var) - if line.startswith('inherit '): + if value.endswith('\\'): + invalue = value[:-1].strip() + invar = var + continue + elif line.startswith('inherit '): inherits = line.split()[1:] - self.assertEqual(checkvars, {}, 'Some variables not found: %s' % checkvars) + if var and var in checkvars: + needvalue = checkvars.pop(var) + if needvalue is None: + self.fail('Variable %s should not appear in recipe') + self.assertEqual(value, needvalue, 'values for %s do not match' % var) + + + missingvars = {} + for var, value in checkvars.iteritems(): + if value is not None: + missingvars[var] = value + self.assertEqual(missingvars, {}, 'Some expected variables not found in recipe: %s' % checkvars) for inherit in checkinherits: self.assertIn(inherit, inherits, 'Missing inherit of %s' % inherit) @@ -304,6 +329,32 @@ class DevtoolTests(DevtoolBase): checkvars['SRCREV'] = checkrev self._test_recipe_contents(recipefile, checkvars, []) + def test_devtool_add_fetch_simple(self): + # Fetch source from a remote URL, auto-detecting name + tempdir = tempfile.mkdtemp(prefix='devtoolqa') + self.track_for_cleanup(tempdir) + testver = '1.6.0' + url = 'http://www.ivarch.com/programs/sources/pv-%s.tar.bz2' % testver + testrecipe = 'pv' + srcdir = os.path.join(self.workspacedir, 'sources', testrecipe) + # Test devtool add + self.track_for_cleanup(self.workspacedir) + self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') + result = runCmd('devtool add %s' % url) + self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'conf', 'layer.conf')), 'Workspace directory not created. %s' % result.output) + self.assertTrue(os.path.isfile(os.path.join(srcdir, 'configure')), 'Unable to find configure script in source directory') + # Test devtool status + result = runCmd('devtool status') + self.assertIn(testrecipe, result.output) + self.assertIn(srcdir, result.output) + # Check recipe + recipefile = get_bb_var('FILE', testrecipe) + self.assertIn('%s_%s.bb' % (testrecipe, testver), recipefile, 'Recipe file incorrectly named') + checkvars = {} + checkvars['S'] = None + checkvars['SRC_URI'] = url.replace(testver, '${PV}') + self._test_recipe_contents(recipefile, checkvars, []) + @testcase(1164) def test_devtool_modify(self): # Clean up anything in the workdir/sysroot/sstate cache |