]> code.ossystems Code Review - openembedded-core.git/commitdiff
targetcontrol.py: make possible dynamical determination of rootfs type
authorCorneliu Stoicescu <corneliux.stoicescu@intel.com>
Fri, 6 Jun 2014 19:14:32 +0000 (22:14 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 13 Jun 2014 11:51:37 +0000 (12:51 +0100)
YB: #6375

Added a new method get_image_fstype() that autodetermines what fstype to use for the rootfs file.
This method uses a new list variable 'supported_image_fstypes' that contains image fstypes supported by the target controller.

This method is also a classmethod which means outside scripts can get the image fstype.

Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/targetcontrol.py

index ff1bb89176f26f59ee50911a69815e57d3926dc1..866c414c1b3023c6e8e18eeefc1c6333028ce8db 100644 (file)
@@ -44,6 +44,8 @@ class BaseTarget(object):
 
     __metaclass__ = ABCMeta
 
+    supported_image_fstypes = []
+
     def __init__(self, d):
         self.connection = None
         self.ip = None
@@ -70,6 +72,16 @@ class BaseTarget(object):
     def stop(self):
         pass
 
+    @classmethod
+    def get_image_fstype(self, d, image_fstypes=None):
+        if not image_fstypes:
+            image_fstypes = d.getVar('IMAGE_FSTYPES', True).split(' ')
+        possible_image_fstypes = [fstype for fstype in self.supported_image_fstypes if fstype in image_fstypes]
+        if possible_image_fstypes:
+            return possible_image_fstypes[0]
+        else:
+            bb.fatal("no possible image_fstype could not be determined. IMAGE_FSTYPES=\"%s\" and supported_image_fstypes=\"%s\": " % (', '.join(map(str, image_fstypes)), ', '.join(map(str, self.supported_image_fstypes))))
+
     def restart(self, params=None):
         self.stop()
         self.start(params)
@@ -87,13 +99,16 @@ class BaseTarget(object):
 
 class QemuTarget(BaseTarget):
 
+    supported_image_fstypes = ['ext3']
+
     def __init__(self, d):
 
         super(QemuTarget, self).__init__(d)
 
+        self.image_fstype = self.get_image_fstype(d)
         self.qemulog = os.path.join(self.testdir, "qemu_boot_log.%s" % self.datetime)
-        self.origrootfs = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True),  d.getVar("IMAGE_LINK_NAME", True) + '.ext3')
-        self.rootfs = os.path.join(self.testdir, d.getVar("IMAGE_LINK_NAME", True) + '-testimage.ext3')
+        self.origrootfs = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True),  d.getVar("IMAGE_LINK_NAME", True) + '.' + self.image_fstype)
+        self.rootfs = os.path.join(self.testdir, d.getVar("IMAGE_LINK_NAME", True) + '-testimage.' + self.image_fstype)
 
         self.runner = QemuRunner(machine=d.getVar("MACHINE", True),
                         rootfs=self.rootfs,