summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/sdk/context.py
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2018-08-29 10:56:31 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-09-04 11:03:55 +0100
commit227cc78b3f461164310de33194cc9e0d006fbfef (patch)
tree7c18c789958811bc5f3e57b03f0363c890bbfecf /meta/lib/oeqa/sdk/context.py
parent20cba32f2d9caab1202295424bd85c26b8c4192a (diff)
downloadpoky-227cc78b3f461164310de33194cc9e0d006fbfef.tar.gz
oeqa/sdk: fixes related to hasPackage semantics
The current _hasPackage does a regex match when checking for the existence of packages. This will sometimes result in unexpected result. For example, the condition hasTargetPackage('gcc') is likely to be always true as it matches libgcc1. For most of the time, we should do exact match instead of regex match. So change _hasPackage function to do that. For the current sdk test cases, the only place that needs regex match is '^gcc-'. This is because there's no easy way to get multilib tune arch (e.g. i686) from testdata.json file. Besides, packagegroup-cross-canadian-xxx and gcc-xxx should be check in host manifest instead of the target one. So fix to use hasHostPackage. Also, as we are doing exact match, there's no need to use r'gtk\+3', just 'gtk+3' is enough. (From OE-Core rev: 595e9922cdbacf84cf35cc83f0d03cace042e302) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/sdk/context.py')
-rw-r--r--meta/lib/oeqa/sdk/context.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/meta/lib/oeqa/sdk/context.py b/meta/lib/oeqa/sdk/context.py
index ec8972d05a..adc4166fd2 100644
--- a/meta/lib/oeqa/sdk/context.py
+++ b/meta/lib/oeqa/sdk/context.py
@@ -20,23 +20,30 @@ class OESDKTestContext(OETestContext):
20 self.target_pkg_manifest = target_pkg_manifest 20 self.target_pkg_manifest = target_pkg_manifest
21 self.host_pkg_manifest = host_pkg_manifest 21 self.host_pkg_manifest = host_pkg_manifest
22 22
23 def _hasPackage(self, manifest, pkg): 23 def _hasPackage(self, manifest, pkg, regex=False):
24 for host_pkg in manifest.keys(): 24 if regex:
25 if re.search(pkg, host_pkg): 25 # do regex match
26 pat = re.compile(pkg)
27 for p in manifest.keys():
28 if pat.search(p):
29 return True
30 else:
31 # do exact match
32 if pkg in manifest.keys():
26 return True 33 return True
27 return False 34 return False
28 35
29 def hasHostPackage(self, pkg): 36 def hasHostPackage(self, pkg, regex=False):
30 return self._hasPackage(self.host_pkg_manifest, pkg) 37 return self._hasPackage(self.host_pkg_manifest, pkg, regex=regex)
31 38
32 def hasTargetPackage(self, pkg, multilib=False): 39 def hasTargetPackage(self, pkg, multilib=False, regex=False):
33 if multilib: 40 if multilib:
34 # match multilib according to sdk_env 41 # match multilib according to sdk_env
35 mls = self.td.get('MULTILIB_VARIANTS', '').split() 42 mls = self.td.get('MULTILIB_VARIANTS', '').split()
36 for ml in mls: 43 for ml in mls:
37 if ('ml'+ml) in self.sdk_env: 44 if ('ml'+ml) in self.sdk_env:
38 pkg = ml + '-' + pkg 45 pkg = ml + '-' + pkg
39 return self._hasPackage(self.target_pkg_manifest, pkg) 46 return self._hasPackage(self.target_pkg_manifest, pkg, regex=regex)
40 47
41class OESDKTestContextExecutor(OETestContextExecutor): 48class OESDKTestContextExecutor(OETestContextExecutor):
42 _context_class = OESDKTestContext 49 _context_class = OESDKTestContext