summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/devtool.py
diff options
context:
space:
mode:
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>2015-09-08 11:39:09 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-09 14:27:51 +0100
commit8be95c5fbe6ad970943edabe288fd47d1dcac288 (patch)
treea3a658ff9b01a28d607aa68ea08789fcc666bbed /meta/lib/oeqa/selftest/devtool.py
parent7cde0ebd59f12da363e780126ca4284e0930721d (diff)
downloadpoky-8be95c5fbe6ad970943edabe288fd47d1dcac288.tar.gz
devtool: add upgrade feature
Upgrades a recipe to a particular version and downloads the source code into a folder. User can avoid patching the source code. These are the general steps of the upgrade function: - Extract current recipe source code into srctree and create a branch - Extract upgrade recipe source code into srctree and rebase with previous branch. In case the rebase is not correctly applied, source code will not be deleted, so user correct the patches - Creates the new recipe under the workspace [YOCTO #7642] (From OE-Core rev: 4020f5d91b3e4d011150d5081d36215f8eab732e) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> 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.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index a6474b7979..255f2c3820 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -913,3 +913,39 @@ class DevtoolTests(DevtoolBase):
913 # NOTE: native recipe parted-native should not be in IMAGE_INSTALL_append 913 # NOTE: native recipe parted-native should not be in IMAGE_INSTALL_append
914 self.assertTrue('IMAGE_INSTALL_append = " mdadm"\n' in open(bbappend).readlines(), 914 self.assertTrue('IMAGE_INSTALL_append = " mdadm"\n' in open(bbappend).readlines(),
915 'IMAGE_INSTALL_append = " mdadm" not found in %s' % bbappend) 915 'IMAGE_INSTALL_append = " mdadm" not found in %s' % bbappend)
916
917 def test_devtool_upgrade(self):
918 # Check preconditions
919 workspacedir = os.path.join(self.builddir, 'workspace')
920 self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
921 # Check parameters
922 result = runCmd('devtool upgrade -h')
923 for param in 'recipename srctree --version -V --branch -b --keep-temp --no-patch'.split():
924 self.assertIn(param, result.output)
925 # For the moment, we are using a real recipe.
926 recipe='devtool-upgrade'
927 version='0.2'
928 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
929 # Check that recipe is not already under devtool control
930 result = runCmd('devtool status')
931 self.assertNotIn(recipe, result.output)
932 # Check upgrade. Code does not check if new PV is older or newer that current PV, so, it may be that
933 # we are downgrading instead of upgrading.
934 result = runCmd('devtool upgrade %s %s -V %s' % (recipe, tempdir, version))
935 # Check if srctree at least is populated
936 self.assertTrue(len(os.listdir(tempdir)) > 0, 'scrtree (%s) should be populated with new (%s) source code' % (tempdir, version))
937 # Check new recipe folder is present
938 self.assertTrue(os.path.exists(os.path.join(workspacedir,'recipes',recipe)), 'Recipe folder should exist')
939 # Check new recipe file is present
940 self.assertTrue(os.path.exists(os.path.join(workspacedir,'recipes',recipe,"%s_%s.bb" % (recipe,version))), 'Recipe folder should exist')
941 # Check devtool status and make sure recipe is present
942 result = runCmd('devtool status')
943 self.assertIn(recipe, result.output)
944 self.assertIn(tempdir, result.output)
945 # Check devtool reset recipe
946 result = runCmd('devtool reset %s -n' % recipe)
947 result = runCmd('devtool status')
948 self.assertNotIn(recipe, result.output)
949 self.track_for_cleanup(tempdir)
950 self.track_for_cleanup(workspacedir)
951 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')