[OE-core] [PATCH] lib/oeqa/selftest/buildoptions.py: added auto test for btrfs based images

Costin Constantin costin.c.constantin at intel.com
Tue Jun 9 11:28:13 UTC 2015


Signed-off-by: Costin Constantin <costin.c.constantin at intel.com>
---
 meta/lib/oeqa/selftest/buildoptions.py | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index c69da68..a3297fd 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -131,5 +131,28 @@ class BuildImagesTest(oeSelfTest):
         self.write_config("DISTRO_FEATURES_remove = \"x11\"\nDISTRO_FEATURES_append = \" directfb\"\nMACHINE ??= \"qemuarm\"")
         self.res = bitbake("core-image-directfb").status
         self.remove_config("DISTRO_FEATURES_remove = \"x11\"\nDISTRO_FEATURES_append = \" directfb\"\nMACHINE ??= \"qemuarm\"")
-        self.assertEqual(self.res, 0, "\ndirectfb image couldn't be built\n")
-        self.assertEqual(self.res, 0, "\ncore-image-directfb failed to build. Please check logs for further details.\n")
\ No newline at end of file
+        self.assertEqual(self.res, 0, "\ncore-image-directfb failed to build. Please check logs for further details.\n")
+
+   @testcase(283)
+    def test_btrfs(self):
+        """
+        This method is used to test the build of an image with btrfs file system. After building it, qemu is launched
+        and the test searches for the "login" keyword that it expects in order to consider an image as functional.
+        Please note that "runquemu" requires sudo access. In order to solve this please add to visudo (sudo visudo)
+        the following line:  your_username  ALL=NOPASSWD:       ALL
+        The above setting was tested in Ubuntu
+        """
+        self.add_command_to_tearDown('cleanup-workdir')
+        self.write_config("MACHINE = \"qemux86\"\nIMAGE_FSTYPES = \"btrfs\"\nKERNEL_FEATURES_append = \" cfg/fs/btrfs \"")
+        self.res = bitbake("core-image-sato").status
+        self.remove_config("MACHINE = \"qemux86\"\nIMAGE_FSTYPES = \"btrfs\"\nKERNEL_FEATURES_append = \" cfg/fs/btrfs \"")
+        self.assertEqual(self.res, 0, "\nbtrfs core-image-sato failed to build. Please check logs for further details.\n")
+        self.prc = p.spawn("runqemu qemux86 core-image-sato nographic")
+        try:
+          self.prc.expect("login", timeout=150)
+          self.prc.kill(9)
+          self.assertTrue(True, "couldn't start qemu")
+        except:
+          self.prc.kill(9)
+          self.log.error("It is possible that runquemu didn't start correctly. Add this line your_username  ALL=NOPASSWD:       ALL\nto your visudo")
+          self.assertTrue(False, "Couldn't start qemu")
-- 
2.1.4




More information about the Openembedded-core mailing list