summaryrefslogtreecommitdiff
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-02-24 16:51:30 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-28 11:32:36 +0000
commitd0ae258e963f9bafffc4ca43c87497d27e57c127 (patch)
tree0e385afc038d95ac5b6ce65866c2a4c099a992cb /meta/lib/oeqa
parent28fea4a104ba85aded2ecfe891e9bf997d72a103 (diff)
downloadopenembedded-core-d0ae258e963f9bafffc4ca43c87497d27e57c127.tar.gz
openembedded-core-d0ae258e963f9bafffc4ca43c87497d27e57c127.tar.bz2
openembedded-core-d0ae258e963f9bafffc4ca43c87497d27e57c127.zip
oe-selftest: devtool: rework devtool upgrade test
* Use a more real-world test of a recipe pointing to a remote file * The cleanup tracking / teardown commands need to be added towards the top, or they won't have the desired effect of cleaning up if the test fails. * Check that a versioned subdirectory gets renamed to match the new version * Ensure the recipe contents gets changed as we expect it to * Check that the recipe directory is deleted by devtool reset at the end Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/selftest/devtool.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 036146425b..4d280bb4af 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -1095,14 +1095,18 @@ class DevtoolTests(DevtoolBase):
def test_devtool_upgrade(self):
# Check preconditions
self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory under the build directory')
+ self.track_for_cleanup(self.workspacedir)
+ self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
# Check parameters
result = runCmd('devtool upgrade -h')
for param in 'recipename srctree --version -V --branch -b --keep-temp --no-patch'.split():
self.assertIn(param, result.output)
# For the moment, we are using a real recipe.
- recipe='devtool-upgrade'
- version='0.2'
+ recipe = 'devtool-upgrade-test1'
+ version = '1.6.0'
+ oldrecipefile = get_bb_var('FILE', recipe)
tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+ self.track_for_cleanup(tempdir)
# Check that recipe is not already under devtool control
result = runCmd('devtool status')
self.assertNotIn(recipe, result.output)
@@ -1110,22 +1114,27 @@ class DevtoolTests(DevtoolBase):
# we are downgrading instead of upgrading.
result = runCmd('devtool upgrade %s %s -V %s' % (recipe, tempdir, version))
# Check if srctree at least is populated
- self.assertTrue(len(os.listdir(tempdir)) > 0, 'scrtree (%s) should be populated with new (%s) source code' % (tempdir, version))
- # Check new recipe folder is present
- self.assertTrue(os.path.exists(os.path.join(self.workspacedir,'recipes',recipe)), 'Recipe folder should exist')
+ self.assertTrue(len(os.listdir(tempdir)) > 0, 'srctree (%s) should be populated with new (%s) source code' % (tempdir, version))
+ # Check new recipe subdirectory is present
+ self.assertTrue(os.path.exists(os.path.join(self.workspacedir, 'recipes', recipe, '%s-%s' % (recipe, version))), 'Recipe folder should exist')
# Check new recipe file is present
- self.assertTrue(os.path.exists(os.path.join(self.workspacedir,'recipes',recipe,"%s_%s.bb" % (recipe,version))), 'Recipe folder should exist')
+ newrecipefile = os.path.join(self.workspacedir, 'recipes', recipe, '%s_%s.bb' % (recipe, version))
+ self.assertTrue(os.path.exists(newrecipefile), 'Recipe file should exist after upgrade')
# Check devtool status and make sure recipe is present
result = runCmd('devtool status')
self.assertIn(recipe, result.output)
self.assertIn(tempdir, result.output)
+ # Check recipe got changed as expected
+ with open(oldrecipefile + '.upgraded', 'r') as f:
+ desiredlines = f.readlines()
+ with open(newrecipefile, 'r') as f:
+ newlines = f.readlines()
+ self.assertEqual(desiredlines, newlines)
# Check devtool reset recipe
result = runCmd('devtool reset %s -n' % recipe)
result = runCmd('devtool status')
self.assertNotIn(recipe, result.output)
- self.track_for_cleanup(tempdir)
- self.track_for_cleanup(self.workspacedir)
- self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+ self.assertFalse(os.path.exists(os.path.join(self.workspacedir, 'recipes', recipe)), 'Recipe directory should not exist after resetting')
@testcase(1352)
def test_devtool_layer_plugins(self):