[oe-commits] Ed Bartosh : oe-selftest: test devtool build-image plugin

git at git.openembedded.org git at git.openembedded.org
Mon Aug 31 11:44:16 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 524c590fb44d0ef9711accf2db1a21e4a3cbcfc2
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=524c590fb44d0ef9711accf2db1a21e4a3cbcfc2

Author: Ed Bartosh <ed.bartosh at linux.intel.com>
Date:   Sun Aug 30 15:19:27 2015 +0300

oe-selftest: test devtool build-image plugin

Added test case to test functionaly of build-image plugin:

Add two packages to workspace and run 'devtool build-image
core-image-minimal'.

Checked if command is successful.

Checked if expected package is added to generated
core-image-minimal.bbappend file.

Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>

---

 meta/lib/oeqa/selftest/devtool.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 70ee634..a6474b7 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -887,3 +887,29 @@ class DevtoolTests(DevtoolBase):
             result = runCmd('devtool undeploy-target -c %s root@%s' % (testrecipe, qemu.ip))
             result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand), ignore_status=True)
             self.assertNotEqual(result, 0, 'undeploy-target did not remove command as it should have')
+
+    def test_devtool_build_image(self):
+        """Test devtool build-image plugin"""
+        # Check preconditions
+        workspacedir = os.path.join(self.builddir, 'workspace')
+        self.assertTrue(not os.path.exists(workspacedir), 'This test cannot be run with a workspace directory under the build directory')
+        image = 'core-image-minimal'
+        self.track_for_cleanup(workspacedir)
+        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+        self.add_command_to_tearDown('bitbake -c clean %s' % image)
+        bitbake('%s -c clean' % image)
+        # Add target and native recipes to workspace
+        for recipe in ('mdadm', 'parted-native'):
+            tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+            self.track_for_cleanup(tempdir)
+            self.add_command_to_tearDown('bitbake -c clean %s' % recipe)
+            runCmd('devtool modify %s -x %s' % (recipe, tempdir))
+        # Try to build image
+        result = runCmd('devtool build-image %s' % image)
+        self.assertNotEqual(result, 0, 'devtool build-image failed')
+        # Check if image.bbappend has required content
+        bbappend = os.path.join(workspacedir, 'appends', image+'.bbappend')
+        self.assertTrue(os.path.isfile(bbappend), 'bbappend not created %s' % result.output)
+        # NOTE: native recipe parted-native should not be in IMAGE_INSTALL_append
+        self.assertTrue('IMAGE_INSTALL_append = " mdadm"\n' in open(bbappend).readlines(),
+                        'IMAGE_INSTALL_append = " mdadm" not found in %s' % bbappend)



More information about the Openembedded-commits mailing list