summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-02-24 17:30:17 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-28 11:32:36 +0000
commitd3ec74ff4db248ea11a568d5214708d6a1757012 (patch)
treead8760eebec83b9b16759c5d827a1ab2c82f2235
parentd0ae258e963f9bafffc4ca43c87497d27e57c127 (diff)
downloadopenembedded-core-contrib-d3ec74ff4db248ea11a568d5214708d6a1757012.tar.gz
oe-selftest: devtool: add an additional test for devtool upgrade
Add a test for devtool upgrade with a recipe pointing to a git repository, since this uses several different code paths. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--meta-selftest/recipes-test/devtool/devtool-upgrade-test2_git.bb18
-rw-r--r--meta-selftest/recipes-test/devtool/devtool-upgrade-test2_git.bb.upgraded17
-rw-r--r--meta/lib/oeqa/selftest/devtool.py36
3 files changed, 71 insertions, 0 deletions
diff --git a/meta-selftest/recipes-test/devtool/devtool-upgrade-test2_git.bb b/meta-selftest/recipes-test/devtool/devtool-upgrade-test2_git.bb
new file mode 100644
index 0000000000..9bfce0afee
--- /dev/null
+++ b/meta-selftest/recipes-test/devtool/devtool-upgrade-test2_git.bb
@@ -0,0 +1,18 @@
+SUMMARY = "A simple tool to wait for a specific signal over DBus"
+HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/dbus-wait"
+SECTION = "base"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+DEPENDS = "dbus"
+
+# Note: this is intentionally not the latest version in the original .bb
+SRCREV = "1a3e1343761b30750bed70e0fd688f6d3c7b3717"
+PV = "0.1+git${SRCPV}"
+PR = "r2"
+
+SRC_URI = "git://git.yoctoproject.org/dbus-wait"
+
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig
diff --git a/meta-selftest/recipes-test/devtool/devtool-upgrade-test2_git.bb.upgraded b/meta-selftest/recipes-test/devtool/devtool-upgrade-test2_git.bb.upgraded
new file mode 100644
index 0000000000..9b947ed9ea
--- /dev/null
+++ b/meta-selftest/recipes-test/devtool/devtool-upgrade-test2_git.bb.upgraded
@@ -0,0 +1,17 @@
+SUMMARY = "A simple tool to wait for a specific signal over DBus"
+HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/dbus-wait"
+SECTION = "base"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+DEPENDS = "dbus"
+
+# Note: this is intentionally not the latest version in the original .bb
+SRCREV = "6cc6077a36fe2648a5f993fe7c16c9632f946517"
+PV = "0.1+git${SRCPV}"
+
+SRC_URI = "git://git.yoctoproject.org/dbus-wait"
+
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 4d280bb4af..d41af2fb26 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -1136,6 +1136,42 @@ class DevtoolTests(DevtoolBase):
self.assertNotIn(recipe, result.output)
self.assertFalse(os.path.exists(os.path.join(self.workspacedir, 'recipes', recipe)), 'Recipe directory should not exist after resetting')
+ def test_devtool_upgrade_git(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')
+ recipe = 'devtool-upgrade-test2'
+ commit = '6cc6077a36fe2648a5f993fe7c16c9632f946517'
+ 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)
+ # Check upgrade
+ result = runCmd('devtool upgrade %s %s -S %s' % (recipe, tempdir, commit))
+ # Check if srctree at least is populated
+ self.assertTrue(len(os.listdir(tempdir)) > 0, 'srctree (%s) should be populated with new (%s) source code' % (tempdir, commit))
+ # Check new recipe file is present
+ newrecipefile = os.path.join(self.workspacedir, 'recipes', recipe, os.path.basename(oldrecipefile))
+ 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.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):
"""Test that devtool can use plugins from other layers.