[OE-core] [PATCH] oeqa/selftest: added auto-test for btrfs image type

Costin Constantin costin.c.constantin at intel.com
Fri Jun 5 13:27:19 UTC 2015


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

diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index 926ffe9..e48bd04 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -2,6 +2,10 @@ import unittest
 import os
 import logging
 import re
+from time import sleep
+import pexpect as p
+import glob as g
+
 
 from oeqa.selftest.base import oeSelfTest
 from oeqa.selftest.buildhistory import BuildhistoryBase
@@ -119,8 +123,27 @@ class BuildhistoryTests(BuildhistoryBase):
         self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True)
         self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True, error_regex=error)
 
-
-
-
-
-
+class BuildImagesTest(oeSelfTest):
+    @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")
\ No newline at end of file
-- 
2.1.4




More information about the Openembedded-core mailing list