summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorneliu Stoicescu <corneliux.stoicescu@intel.com>2014-06-06 22:14:32 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-06-13 12:52:20 +0100
commitaf384220175dc548d8eb0b94209c49c937292d91 (patch)
tree9f8d1276a48d061cf795d5717c7afeca74384192
parent60846a0ce2dfbf9a87d4f84f04738851dfbba598 (diff)
downloadpoky-af384220175dc548d8eb0b94209c49c937292d91.tar.gz
targetcontrol.py: make possible dynamical determination of rootfs type
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. (From OE-Core rev: 39d5aa5c9f2916700f81d15adc220a30c6b120d1) Signed-off-by: Corneliu Stoicescu <corneliux.stoicescu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/targetcontrol.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index ff1bb89176..866c414c1b 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -44,6 +44,8 @@ class BaseTarget(object):
44 44
45 __metaclass__ = ABCMeta 45 __metaclass__ = ABCMeta
46 46
47 supported_image_fstypes = []
48
47 def __init__(self, d): 49 def __init__(self, d):
48 self.connection = None 50 self.connection = None
49 self.ip = None 51 self.ip = None
@@ -70,6 +72,16 @@ class BaseTarget(object):
70 def stop(self): 72 def stop(self):
71 pass 73 pass
72 74
75 @classmethod
76 def get_image_fstype(self, d, image_fstypes=None):
77 if not image_fstypes:
78 image_fstypes = d.getVar('IMAGE_FSTYPES', True).split(' ')
79 possible_image_fstypes = [fstype for fstype in self.supported_image_fstypes if fstype in image_fstypes]
80 if possible_image_fstypes:
81 return possible_image_fstypes[0]
82 else:
83 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))))
84
73 def restart(self, params=None): 85 def restart(self, params=None):
74 self.stop() 86 self.stop()
75 self.start(params) 87 self.start(params)
@@ -87,13 +99,16 @@ class BaseTarget(object):
87 99
88class QemuTarget(BaseTarget): 100class QemuTarget(BaseTarget):
89 101
102 supported_image_fstypes = ['ext3']
103
90 def __init__(self, d): 104 def __init__(self, d):
91 105
92 super(QemuTarget, self).__init__(d) 106 super(QemuTarget, self).__init__(d)
93 107
108 self.image_fstype = self.get_image_fstype(d)
94 self.qemulog = os.path.join(self.testdir, "qemu_boot_log.%s" % self.datetime) 109 self.qemulog = os.path.join(self.testdir, "qemu_boot_log.%s" % self.datetime)
95 self.origrootfs = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("IMAGE_LINK_NAME", True) + '.ext3') 110 self.origrootfs = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("IMAGE_LINK_NAME", True) + '.' + self.image_fstype)
96 self.rootfs = os.path.join(self.testdir, d.getVar("IMAGE_LINK_NAME", True) + '-testimage.ext3') 111 self.rootfs = os.path.join(self.testdir, d.getVar("IMAGE_LINK_NAME", True) + '-testimage.' + self.image_fstype)
97 112
98 self.runner = QemuRunner(machine=d.getVar("MACHINE", True), 113 self.runner = QemuRunner(machine=d.getVar("MACHINE", True),
99 rootfs=self.rootfs, 114 rootfs=self.rootfs,